A single process has several threads. Which of the following are shared by all the threads of this process?
Show solution
Solution MSQ · 1 mark · no negative marking
Answer: (A) Global variables in the data segment; (C) The table of open file descriptors
Method. Split the state into what belongs to the process and what belongs to each thread of execution.
- Per process (shared by its threads): the address space (code, global/static data, heap), open files, and other OS resources.
- Per thread (private): program counter, registers, stack pointer and the stack itself, thread state.
So globals (a) and the open-file table (c) are shared; the stack pointer (b) and register contents (d) are not.
The trap. The stack is in the shared address space, so another thread could reach it through a pointer; but each thread has its own stack and its own stack pointer value. "Shared address space" does not mean "shared execution context".
What was tested. The basic thread/process split: a thread is an execution context (PC, registers, stack) running inside a process's shared resources.
Copied. Paste it into the new chat.Too long to send. Copy the question and solution by hand.