It was pointed out that two advantages of using multiple threads within a process are that (1) less work is involved in creating a new thread within an existing process than in creating a new process, and (2) communication among threads within the same process is simplified. Is it also the case that a mode switch between two threads within the same process involves less work than a mode switch between two threads in different processes?
It was pointed out that two advantages of using multiple threads within a process are that (1) less work is involved in creating a new thread within an existing process than in creating a new process, and (2) communication among threads within the same process is simplified. Is it also the case that a mode switch between two threads within the same process involves less work than a mode switch between two threads in different processes?
Let's understand this things step by step .
1) When we talk about creating the new process then it requires so many things along with the process such as virtual address space as well as the other system resources . It also requires the file descriptors if required . While on the other hand if we consider creating the thread instead of the process then the thread does not require personal address space .It creates it's own stack in the same address space of the parent memory space hence the process is quite fast.
2) Hence when the threads do communicate with each other it is quite easy for them to do so as compared to two processes. The threads because are situated in the same virtual memory space on the other hands the processes are on different memory spaces .
Trending now
This is a popular solution!
Step by step
Solved in 2 steps