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

2011

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

Answer: A. 1A process switch (also called a context switch) is the single operating-system action that changes which process is occupying the CPU. The OS saves the…

  1. A.

    1

  2. B.

    2

  3. C.

    3

  4. D.

    4

Attempted by 810 students.

Show answer & explanation

Correct answer: A

A process switch (also called a context switch) is the single operating-system action that changes which process is occupying the CPU. The OS saves the execution context — program counter, registers, and other state — of the process being removed from the CPU, then loads the saved context of the process being placed onto the CPU. This save-and-restore action is counted as exactly one process switch per change of CPU ownership, no matter how many arrows on a process-state diagram are involved in bringing it about.

  1. The currently running process issues an I/O request, so the operating system removes it from the CPU and moves it into the waiting (blocked) state, saving its execution context.

  2. The short-term scheduler picks one process out of the ready queue, which has three processes waiting, to run next.

  3. The chosen process's saved context is loaded and it starts executing on the CPU.

  4. Steps 1 through 3 together are a single hand-off of CPU ownership, since exactly one process took over the CPU as a direct result of this one I/O request.

The size of the ready queue only confirms that a process is available to be dispatched immediately; it does not multiply the switch count, because only one of those waiting processes actually takes the CPU. A further switch would occur only if CPU ownership changed hands again afterward — for instance when the blocked process itself is eventually rescheduled — which is a separate event, not part of this single I/O-blocking transition.

So this single I/O request produces exactly one process switch.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…