Threads of a process share
View worked solution
Answer: D
Threads belonging to the same process share the process's address space and resources. Specifically, they share:
- Code section: The executable instructions.
- Data section: This contains global variables and static variables.
- Heap: Dynamically allocated memory (via
mallocornew) is shared among all threads of the process. - OS resources: Open files, signals, and sockets.
However, each thread maintains its own private copy of:
- Program Counter (PC)
- Register set
- Stack: Used for local variables and function call history.
Since both global variables (data section) and the heap are shared among all threads of a process, the correct option is D.
Free practice · Your answers on this page are not saved.
