Threads vs Processes (Mechanisms used for executing code concurrently)
Threads(User Space) | Processes | |
---|---|---|
What | Lightweight process within a process.(Since no duplication of process space) | Heavy(Complete process space(CS,DS,SS,HS) duplicated) to child |
Compared |
|
|
Disadv | If 1 thread blocks, whole process blocks. |
Why Processes(if they are Heavy wrt Threds?)
2. Security: Processes offer better security because they have separate memory spaces. This helps prevent unintended access or modification of data.
3. Compatibility and Portability: Processes are more portable across different operating systems compared to threads