0
6.0kviews
Compare processes and threads. Explain user level and kernel level threads. What is the need of lightweight threads?
1 Answer
written 8.7 years ago by |
Process | Thread |
---|---|
1) Process is called heavy weight process. | 1) Thread is called light weight process. |
2) Process switching needs interface with OS. | 2) Threads switching needs no interface with OS. |
3) Multiple redundant process uses more resources than multiple threaded. | 3) Multiple threaded uses few resources than multiple resources than multiple redundant processes. |
4) In multiple processes, each process operates independently of the others. | 4) One thread can read, with or even completely wipe out another threads stacks. |
5) If one server process is blocked so other server process can execute until the first process unblocked. | 5) While one server thread is blocked and waiting, second thread in same task could run. |
Threads and Threads in DS
Thread is basic unit of CPU utilization.
User – level Threads | Kernel – level Threads |
---|---|
1) User level threads are faster to create and manage. | 1) Kernel level threads are slower to create and manage. |
2) Implemented by a thread library at user - level | 2) OS directly supports to kernel threads. |
3) User level thread can run on any OS. | 3) Kernel – level threads are specific to OS. |
Multithreading: It is a type of execution model that allows multiple threads to execute independently but share their process resources.
Types:
1) Preemptive Multithreading
2) Co – operative Multithreading
Threads in DS
Threads provide convenient way of allowing blocking system calls without blocking the entire process in which thread is running.
This makes it attractive to use in DS as it makes it much easier to do communication in form of maintaining multiple logical connections at the same time.