In the above figure, it shows the structure of memory block where single thread and multithread are performing. It shows that a thread has state like a process does, but its state are the values which held in its register and the data on its stack.
Multiprocessing | Multithreading |
---|
A process is the unit of resource allocation and protection. | A thread is the unit of computation that runs in the context of a process. |
It manages certain resources for example, virtual memory, I/O handlers and signal handlers. | It manages certain resources for example, stack, registers, signal masks, priorities and thread-specific data. |
It is protected from other processes via an MMU. | Threads can interfere with each other. |
Interprocess communication between processes can be complicated and inefficient. | Intraprocess communication between threads are more efficient than Interprocess communication between processes. |