Skip to main content

GATE CSE 2023Operating System › Process Concepts, Threads & System CallsVerified

GATE CSE 2023 PYQ: Which one or more of the following need to be saved on a context switch from one thread (T1) \text{(T1)}…

Which one or more of the following need to be saved on a context switch from one thread (T1)\text{(T1)} of a process to another thread (T2)\text{(T2)} of the same process?

  1. A
    Page table base register
  2. B
    Stack pointer
    Correct answer
  3. C
    Program counter
    Correct answer
  4. D
    General purpose registers
    Correct answer

Answer

(B, C, D) Stack pointer; Program counter; General purpose registers

Approach

Identify which CPU/process state is per-thread versus per-process. Threads in the same process share the address space, but each thread has its own execution context: PC, stack pointer, and register values.

Threads of the same process share the page table/address space, so the page table base register does not change. However, each thread has independent stack pointer, program counter, and general-purpose registers, so B, C, and D must be saved on a context switch.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.