The GATE Grind

GATE 2024 CS (CS2) – Question 25

Operating System · System Calls, Processes, Threads and IPC · 1 mark · Multiple select

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)?

  1. P makes a blocking system call to read a block of data from the disk
  2. P tries to access a page that is in the swap space, triggering a page fault
  3. An interrupt is raised by the disk to deliver data requested by some other process
  4. A timer interrupt is raised by the hardware

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.