Consider a process running on a . Which one or more of the following events will always trigger a context switch by the that results in process moving to a non-running state (e.g., ready, blocked)?
GATE CSE 2024Operating System › Process Concepts, Threads & System CallsVerified
GATE CSE 2024 PYQ: Consider a process P \text{P} P running on a CPU \text{CPU} CPU . Which one or more of the following…
- Amakes a blocking system call to read a block of data from the diskCorrect answer
- Btries to access a page that is in the swap space, triggering a page faultCorrect answer
- CAn interrupt is raised by the disk to deliver data requested by some other process
- DA timer interrupt is raised by the hardware
Answer
(A, B) P \text{P} P makes a blocking system call to read a block of data from the disk; P \text{P} P tries to access a page that is in the swap space, triggering a page fault
Approach
A context switch that moves P out of the running state occurs only when P itself can no longer continue execution — e.g., it blocks waiting for I/O or a major page fault. Interrupts caused by other devices or by the timer do not necessarily deschedule P.
Options A and B both represent conditions in which process P cannot continue until external I/O completes, so the OS must always block P and perform a context switch. Options C and D are interrupts that do not necessarily force P out of the running state.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.