Skip to content
Official PYQ · 2017

GATE CS 2017 Set 2 Q07 — Processes and Threads

Explain with AI

Which of the following is/are shared by all the threads in a process?

  1. Program counter
  2. Stack
  3. Address space
  4. Registers
Choose one option
View worked solution

Answer: B

In a multi-threaded process, threads share certain resources of the process while maintaining their own individual execution context.

Shared among all threads of a process:

  • Address space: All threads share the same virtual address space (including the code section, data section, and heap). Therefore, global variables and dynamically allocated memory are accessible by all threads.
  • OS resources: Open files, sockets, and signals are shared.

Private to each thread (Not shared):

  • Program Counter (PC): Each thread executes instructions independently, so it must have its own PC to track its execution path.
  • Registers: Each thread has its own register set to store its current working state and local CPU computation.
  • Stack: Each thread has its own stack to store local variables, function parameters, and return addresses.

Evaluating the given options:

  • I. Program counter: Private (Not shared)
  • II. Stack: Private (Not shared)
  • III. Address space: Shared
  • IV. Registers: Private (Not shared)

Thus, only (III) Address space is shared by all threads in a process.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Processes and Threads questions