As we mentioned earlier that in many respect threads operate in the same way as that of processes. Some of the similarities and differences are:
Similarities
- Like processes threads share CPU and only one thread active (running) at a time.
- Like processes, threads within processes, threads within processes execute sequentially.
- Like processes, thread can create children.
- And like process, if one thread is blocked, another thread can run.
|
PROCESS |
THREAD |
|
Doesn’t share memory (loosely coupled) |
Shares memories and files (tightly coupled) |
|
Creation is time consuming |
Fast |
|
Execution slow |
Fast |
|
More time to terminate |
Less time |
|
More time to switch between processes |
Less time |
|
System calls are required for communication |
Not required |
|
more resources are required |
fewer resources are required |
|
Not suitable for parallelism |
Suitable |