GATE 2022 CS – Question 42
Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time t = 0. There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to 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 possible as CPU burst time (in time units) of these processes?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (D) P = 3, Q = 7, R = 7, S = 3
Explanation
Simulating option D gives the order P,Q,R,S,Q,R with R finishing last, so there is no R→Q switch. The requirement of exactly one R→Q switch fails. Options A, B and C each satisfy all the switch counts.