Skip to main content

GATE CSE 2012Operating System › CPU SchedulingVerified

GATE CSE 2012 PYQ: Consider the 3 3 3 processes, P 1 , P 2 P1, P2 P 1 , P 2 and P 3 P3 P 3 shown in the table. Process Arrival…

Consider the 3 processes, P1,P2P1, P2 and P3P3 shown in the table. ProcessArrival TimeTime Units RequiredP105P217P334\small \begin{array}{|c|c|c|} \hline \textbf{Process} & \textbf{Arrival Time} & \textbf{Time Units Required} \\\hline \text{P1} & 0 & 5\\\hline \text{P2} & 1 & 7 \\\hline \text{P3} & 3 & 4 \\\hline \end{array}The completion order of the 3 processes under the policies FCFS and RR2 (round robin scheduling with CPU quantum of 2 time units) are

  1. A
    FCFS: P1,P2,P3P1, P2, P3  RR2: P1,P2,P3P1, P2, P3
  2. B
    FCFS: P1,P3,P2P1, P3, P2  RR2: P1,P3,P2P1, P3, P2
  3. C
    FCFS: P1,P2,P3P1, P2, P3  RR2: P1,P3,P2P1, P3, P2
    Correct answer
  4. D
    FCFS: P1,P3,P2P1, P3, P2  RR2: P1,P2,P3P1, P2, P3

Answer

(C) FCFS : P 1 , P 2 , P 3 P1, P2, P3 P 1 , P 2 , P 3 RR2 : P 1 , P 3 , P 2 P1, P3, P2 P 1 , P 3 , P 2

Approach

Simulate FCFS using arrival order, then simulate RR2 by tracking the ready queue and completion times with a quantum of 2 time units.

Simulating both algorithms shows FCFS completes processes in the order P1, P2, P3, whereas RR2 completes them in the order P1, P3, P2. Since these orders are different, option C is correct.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.