Operating System :: Process Management - Discussion
25 / 41
Which one of the following is not shared by threads?
Aprogram counter
Bstack
Cboth (a) and (b)
DNone of these
Show Explanation
Asked In ::
A process has code, data, heap and stack segments. Now, the Instruction Pointer (IP) of a thread or threads points to the code segment of the process. The data and heap segments are shared by all the threads. On the other hand, the stack area is an area created by the process just for its thread to use, because stacks can be used in a much faster way than heaps. The stack area of the process is divided among threads, i.e. if there are 3 threads, then the stack area of the process is divided into 3 parts and each is given to the 3 threads. In other words, when we say that each thread has its own stack, that stack is actually a part of the process stack area allocated to each thread. When a thread finishes its execution, the stack of the thread is reclaimed by the process. In fact, not only the stack of a process is divided among threads, but all the set of registers that a thread uses like Stack Pointer, Program Counter and state registers are the registers of the process. So when it comes to sharing, the code, data and heap areas are shared, while the stack area is just divided among threads.
Read Full Answer
Report Error
Please Login First Click Here