Which of the following is/are shared by all the threads in a process? I.…
2017
Which of the following is/are shared by all the threads in a process?
I. Program counter
II. Stack
III. Address space
IV. Registers
- A.
(I) and (II) only
- B.
(III) only
- C.
(IV) only
- D.
(III) and (IV) only
Attempted by 254 students.
Show answer & explanation
Correct answer: B
Answer: Only the process address space is shared by all threads.
Explanation:
Shared by all threads: the process address space (code segment, global/static data, and heap). This allows threads to access the same memory and share data structures.
Private to each thread: program counter, stack, and registers. These store the thread's execution state so threads can run independently at different points in the code.
Therefore, the correct choice is the one that states only the address space is shared.
A video solution is available for this question — log in and enroll to watch it.