Which one or more of the following need to be saved on a context switch from one thread (T1) of a process to another thread (T2) of the same process?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2023 · Q22
Time
Select all that applyOne or more correct
Solution
Official answer: B) Stack pointer; C) Program counter; D) General purpose registers
Processes, Threads and IPCThreads belonging to the same process share common resources, such as:
Address space (code, data, and heap segments)
Open files and I/O devices
Page table / Page table base register (PTBR)
However, each thread maintains its own private execution state, which includes:
Program counter (PC): Tracks the next instruction to execute for that thread.
Stack pointer (SP): Points to the top of the thread's own execution stack.
General purpose registers: Stores active local computation states.
State and priority.
When a context switch occurs between two threads and of the same process:
The CPU register set—including the Stack pointer, Program counter, and General purpose registers—must be saved into the Thread Control Block (TCB) of and restored from the TCB of .
The Page table base register does not need to be saved or changed because both threads share the identical address space and page tables.
Hence, the correct options are B, C, and D.
Try the question first, then check your work.
Examiner trap
Identify which execution state is private to each individual thread versus which resources are shared across all threads within the same process.
This Processes, Threads and IPC previous year question is Q22 of the GATE CSE 2023 paper. Find more GATE CSE PYQs on Processes, Threads and IPC in Operating Systems, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Processes, Threads and IPC PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Processes, Threads and IPC has 15 GATE CSE PYQs across 13 papers from 2011 to 2026. 4 of them are 1-mark MSQs like this one, and it is the only one in GATE CSE 2023.
How GATE tests Processes, Threads and IPCIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.