There are six processes in the ready queue. When the currently running process…

There are six processes in the ready queue. When the currently running process requests I/O, how many process switches take place? __________

Answer: 1ConceptA process switch (context switch) is the single operation in which the CPU stops executing one process and starts executing another: the OS saves the…

Attempted by 84 students.

Show answer & explanation

Correct answer: 1

Concept

A process switch (context switch) is the single operation in which the CPU stops executing one process and starts executing another: the OS saves the state (PCB) of the outgoing process and loads the state of the incoming process. One such CPU handover from one process to the next is counted as exactly ONE context switch — regardless of how many state transitions accompany it.

Application

When the currently running process requests I/O, a single handover occurs:

  1. The running process can no longer use the CPU, so its state is saved and it is moved from Running to the Blocked (waiting) list to await its I/O.

  2. The scheduler picks the first process from the Ready queue, loads its state, and moves it from Ready to Running so the CPU is never left idle.

These two state transitions are the two halves of one and the same handover — save the old, load the new — so they constitute a single process switch. The number of processes waiting in the ready queue (three, six, or any count) does not change this: only one process is dispatched to the CPU, so only one switch happens.

Why not 2

The common mistake is to count each state transition as its own switch:

  • Running to Blocked is not a switch by itself — it is the act of vacating the CPU, which is half of the handover.

  • Ready to Running completes that same handover by occupying the freed CPU.

  • A context switch is defined per CPU handover (one process out, one process in), not per individual state change, so the two transitions together are one switch, not two.

Result

Exactly 1 process switch takes place. (This is the standard counting used in ISRO CSE 2011 Q55 and the GATE syllabus, where the identical question with three ready processes also has the answer 1.)

Explore the full course: Operating System

Loading lesson…