OS & Hardware
What mechanism mainly lets the OS reclaim the CPU at regular intervals, even from programs that never give it up voluntarily, and switch to other processes?
- ACache misses
- BTimer interrupts
- CCopy-on-write
Show answer and explanation
Answer: B. Timer interrupts
The OS programs a timer to raise an interrupt after each time slice. When it fires, the CPU always enters the kernel's interrupt handler, so even if a program is stuck in an infinite loop, the OS regains control and can context-switch to another process. This is preemptive scheduling. Cache misses and copy-on-write do not return control to the OS.
- A. Cache misses are handled in hardware and do not transfer control to the OS.
- B. Correct. Periodic interrupts let the OS regain control.
- C. Copy-on-write copies pages when they are written.