Skip to content
Official PYQ · 2012

GATE CS 2012 Q31 — CPU Scheduling

Explain with AI

Consider the 33 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 33 processes under the policies FCFS and RR22 (round robin scheduling with CPU quantum of 22 time units) are

Choose one option
View worked solution

Answer: C

1. First-Come, First-Served (FCFS):

Since FCFS schedules processes strictly in the order of their arrival times (P1P1 at 00, P2P2 at 11, and P3P3 at 33), they execute and complete in the same order:

  • P1P1 runs from 00 to 55 (completes at 55)
  • P2P2 runs from 55 to 1212 (completes at 1212)
  • P3P3 runs from 1212 to 1616 (completes at 1616)

Thus, the FCFS completion order is P1,P2,P3P1, P2, P3.

2. Round Robin with Quantum = 2 (RR2):

We track the ready queue (RQ) and execution step-by-step:

  • [0−2][0 - 2]: P1P1 runs. At t=1t=1, P2P2 arrives. At t=2t=2, P1P1 is preempted.
    RQ=[P2,P1]\text{RQ} = [P2, P1]
  • [2−4][2 - 4]: P2P2 runs. At t=3t=3, P3P3 arrives. At t=4t=4, P2P2 is preempted.
    RQ=[P1,P3,P2]\text{RQ} = [P1, P3, P2]
  • [4−6][4 - 6]: P1P1 runs. At t=6t=6, P1P1 is preempted.
    RQ=[P3,P2,P1]\text{RQ} = [P3, P2, P1]
  • [6−8][6 - 8]: P3P3 runs. At t=8t=8, P3P3 is preempted.
    RQ=[P2,P1,P3]\text{RQ} = [P2, P1, P3]
  • [8−10][8 - 10]: P2P2 runs. At t=10t=10, P2P2 is preempted.
    RQ=[P1,P3,P2]\text{RQ} = [P1, P3, P2]
  • [10−11][10 - 11]: P1P1 runs for its remaining 11 unit and completes at 1111.
    RQ=[P3,P2]\text{RQ} = [P3, P2]
  • [11−13][11 - 13]: P3P3 runs for its remaining 22 units and completes at 1313.
    RQ=[P2]\text{RQ} = [P2]
  • [13−16][13 - 16]: P2P2 runs for its remaining 33 units and completes at 1616.

Thus, the RR2 completion order is P1,P3,P2P1, P3, P2.

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

Published
Report a correction
Keep exploringMore CPU Scheduling questions