GATE 2024 CS (CS2) – Question 25
Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) P makes a blocking system call to read a block of data from the disk; (B) P tries to access a page that is in the swap space, triggering a page fault
Explanation
A blocking disk read and a page fault on a swapped-out page both force P to wait for I/O, so P is blocked. A disk interrupt for another process or a timer interrupt does not always deschedule P.