Skip to content
Official PYQ · 2022

GATE CS 2022 Q32 — CPU Scheduling

Explain with AI

Consider four processes P, Q, R,\text{P, Q, R,} and S\text{S} scheduled on a CPU\text{CPU} as per round robin algorithm with a time quantum of 4 units.4\text{ units.} The processes arrive in the order P, Q, R, S,\text{P, Q, R, S,} all at time t = 0.\text{t = 0}. There is exactly one context switch from S\text{S} to Q,\text{Q}, exactly one context switch from R\text{R} to Q,\text{Q}, and exactly two context switches from Q\text{Q} to R.\text{R}. There is no context switch from S\text{S} to P.\text{P}. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT\text{NOT} possible as CPU\text{CPU} burst time (in time units)\text{(in time units)} of these processes?

Choose one option
View worked solution

Answer: D

To determine which option is not possible, let us trace the Round Robin scheduling with a time quantum of q=4q = 4 and the initial ready queue order [P,Q,R,S][P, Q, R, S] at t=0t = 0.

Let us test Option D with burst times P=3,Q=7,R=7,S=3P = 3, Q = 7, R = 7, S = 3:

  1. PP runs for 33 units and terminates. Ready queue: [Q,R,S][Q, R, S].
  2. QQ runs for 44 units (remaining: 33) and is preempted. Ready queue: [R,S,Q][R, S, Q].
  3. RR runs for 44 units (remaining: 33) and is preempted. Ready queue: [S,Q,R][S, Q, R].
  4. SS runs for 33 units and terminates. Ready queue: [Q,R][Q, R].
  5. QQ runs for 33 units and terminates. Ready queue: [R][R].
  6. RR runs for 33 units and terminates.

The execution sequence of processes is: P→Q→R→S→Q→R\text{P} \to \text{Q} \to \text{R} \to \text{S} \to \text{Q} \to \text{R} Let us verify the constraints for this sequence:

  • Context switch from SS to QQ: Exactly 11 (from S→QS \to Q).
  • Context switch from QQ to RR: Exactly 22 (first Q→RQ \to R, second Q→RQ \to R).
  • Context switch from RR to QQ: 00 (there is no transition from RR to QQ).
Since the constraint requires exactly one context switch from RR to QQ, the burst times in Option D are NOT possible.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore CPU Scheduling questions