Skip to main content

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…

​​​​Consider a process P\text{P} running on a CPU\text{CPU}. Which one or more of the following events will always trigger a context switch by the OS\text{OS} that results in process P\mathrm{P} moving to a non-running state (e.g., ready, blocked)?

  1. A
    P\text{P} makes a blocking system call to read a block of data from the disk
    Correct answer
  2. B
    P\text{P} tries to access a page that is in the swap space, triggering a page fault
    Correct answer
  3. C
    An interrupt is raised by the disk to deliver data requested by some other process
  4. D
    A 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.