Which component is primarily responsible for saving and restoring CPU registers during a context switch?
easy🔍 Pattern Recognition Q11 of Q15
Operating Systems - Context Switch - Cost & Causes
Which component is primarily responsible for saving and restoring CPU registers during a context switch?
AThe Interrupt Handler
BThe CPU scheduler
CThe Memory Management Unit (MMU)
DThe Process Control Block (PCB)
Step-by-Step Solution
Step 1: Understand the role of PCB
The PCB stores the CPU register states and other process information needed to resume execution later.
Step 2: Differentiate from scheduler and interrupt handler
The scheduler decides which process runs next but does not save registers; the interrupt handler triggers context switches but does not save registers itself.
Step 3: MMU role
The MMU handles memory address translation, unrelated to register saving.
Final Answer:
Option D -> Option D
Quick Check:
PCB contains saved CPU state -> correct component for saving/restoring registers.
Quick Trick:PCB = process snapshot including CPU registers [OK]
Common Mistakes:
MISTAKES
Confusing scheduler with register saving
Assuming interrupt handler saves registers
Thinking MMU handles CPU state
Trap Explanation:
PITFALL
Scheduler and interrupt handler are involved in context switching but do not save CPU registers; PCB holds the saved state.
Interviewer Note:
CONTEXT
Tests candidate's understanding of OS components involved in context switching.
Master "Context Switch - Cost & Causes" in Operating Systems
2 interactive learning modes - each teaches the same concept differently