Question
Threads of a process share
Official answer and solution
- Official answer
- D
- From
- Official GATE 2017 answer key
Solution
Identify the shared and private memory segments across threads of a common process in standard operating system architectures.
In a multithreaded process:
- Each thread has its own private execution context: thread ID, register state (including program counter), and execution stack (local variables and function activation records).
- All threads belonging to the same process share the process address space, which includes the code section (text), data section (initialized and uninitialized global and static variables), and heap section (dynamically allocated memory via
malloc/new).
Therefore, threads of a process share both heap and global variables.
Final answer
D
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 1
- Question
- 18 of 65, printed as CS Q.18
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.