Question

Consider the 3 processes, P1P_1, P2P_2 and P3P_3 shown in the table.

Process Arrival time Time Units Required
P1P_1 0 5
P2P_2 1 7
P3P_3 3 4

The completion order of the 3 processes under the policies FCFS and RR2 (round robin scheduling with CPU quantum of 2 time units) are

Choose one option
Official answer and solution
Official answer
C
From
Official GATE 2012 answer key

Solution

Simulate process execution and trace completion times under FCFS and RR2 scheduling policies.

  1. Under FCFS (First-Come First-Served):
  • t=0t = 0 to 55: P1P_1 runs and finishes at t=5t = 5.
  • t=5t = 5 to 1212: P2P_2 runs and finishes at t=12t = 12.
  • t=12t = 12 to 1616: P3P_3 runs and finishes at t=16t = 16.
  • Completion order: P1,P2,P3P_1, P_2, P_3.
  1. Under RR2 (Round Robin with time quantum = 2):
  • At t=0t = 0: P1P_1 arrives (burst 5). Runs from t=0t = 0 to 22 (remaining: 3). P2P_2 arrives at t=1t = 1. Ready queue: [P2,P1][P_2, P_1].
  • At t=2t = 2: P2P_2 runs from t=2t = 2 to 44 (remaining: 5). P3P_3 arrives at t=3t = 3. Ready queue: [P1,P3,P2][P_1, P_3, P_2].
  • At t=4t = 4: P1P_1 runs from t=4t = 4 to 66 (remaining: 1). Ready queue: [P3,P2,P1][P_3, P_2, P_1].
  • At t=6t = 6: P3P_3 runs from t=6t = 6 to 88 (remaining: 2). Ready queue: [P2,P1,P3][P_2, P_1, P_3].
  • At t=8t = 8: P2P_2 runs from t=8t = 8 to 1010 (remaining: 3). Ready queue: [P1,P3,P2][P_1, P_3, P_2].
  • At t=10t = 10: P1P_1 runs for its remaining 1 unit from t=10t = 10 to 1111. P1P_1 completes at t=11t = 11.
  • At t=11t = 11: P3P_3 runs for its remaining 2 units from t=11t = 11 to 1313. P3P_3 completes at t=13t = 13.
  • At t=13t = 13: P2P_2 runs for its remaining 3 units from t=13t = 13 to 1616. P2P_2 completes at t=16t = 16.
  • Completion order: P1,P3,P2P_1, P_3, P_2.
  1. Thus, completion orders are FCFS: P1,P2,P3P_1, P_2, P_3 and RR2: P1,P3,P2P_1, P_3, P_2.
Final answer

C

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2012 Computer Science and Information Technology (CS)
Question
31 of 65, printed as CS Q.31
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.