56. State The Advantages & Disadvantages Of Kernel Level Threads?
Advantages
- Kernel can simultaneously schedule multiple threads from the same process on multiple processes.
- If one thread in a process is blocked, the Kernel can schedule another thread of the same process.
- Kernel routines themselves can multithreaded.
- Kernel threads are generally slower to create and manage than the user threads.
- Transfer of control from one thread to another within same process requires a mode switch to the Kernel.
57. State The Basic Differences Between Process & Thread?
The differences between process and threads are:
- Process is heavy weight or resource intensive whereas Thread is light weight taking lesser resources than a process.
- Process switching needs interaction with operating system whereas Thread switching does not need to interact with operating system.
- In multiple processing environments each process executes the same code but has its own memory and file resources whereas all threads can share same set of open files, child processes.
- If one process is blocked then no other process can execute until the first process is unblocked whereas while one thread is blocked and waiting, second thread in the same task can run.
58. What Are The Advantages Of Threads Over Multiple Processes?
Advantages of Threads over Multiple Processes are:
- Context Switching: Threads are very inexpensive to create and destroy, and they are inexpensive to represent. For example, they require space to store, the PC, the SP, and the general-purpose registers, but they do not require space to share memory information, Information about open files of I/O devices in use, etc. With so little context, it is much faster to switch between threads. In other words, it is relatively easier for a context switch using threads.
- Sharing: Treads allow the sharing of a lot resources that cannot be shared in process, for example, sharing code section, data section, Operating System resources like open file etc.
59. What Are The Disadvantages Of Threads Over Multiple Processes?
Disadvantages of Threads over Multiple processes are:
- Blocking: The major disadvantage if that if the kernel is single threaded, a system call of one thread will block the whole process and CPU may be idle during the blocking period.
- Security: Since there is, an extensive sharing among threads there is a potential problem of security. It is quite possible that one thread over writes the stack of another thread (or damaged shared data) although it is very unlikely.
60. Why Should A Web Server Not Run As A Single Threaded Process?
For a web server that runs as a single threaded process, only one client can be serviced at a time. This could result in potentially enormous wait times for a busy server.
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com