The Gateway to Computer Science Excellence
+27 votes

Consider the $3$ processes, $P1, P2$ and $P3$ shown in the table. $$\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. FCFS: $P1, P2, P3$  RR2: $P1, P2, P3 $
  2. FCFS: $P1, P3, P2$  RR2: $P1, P3, P2$
  3. FCFS: $P1, P2, P3$  RR2: $P1, P3, P2$
  4. FCFS: $P1, P3, P2$  RR2: $P1, P2, P3$
in Operating System by Veteran (434k points)
edited by | 4.4k views

6 Answers

+37 votes
Best answer

FCFS First Come First Server


In Round Robin We are using the concept called Ready Queue. 

 at $t=2$ ,

  • $P1$ finishes and sent to Ready Queue
  • $P2$ arrives and schedules $P2$

This is the Ready Queue

At $t=3$

  • $P3$ arrives at ready queue

At $t =4$

  • $P1$ is scheduled as it is the first process to arrive at Ready Queue

Option (C) is correct

by Boss (21.6k points)
edited by
@mcjoshi see this answer .
order of computation is actually this
Is it the way we always follow with round robin ?

At t = 1, P2 arrives, before P1 finishes its execution.
Ready queue explanation is so ambiguous above, though the order is correct.
This was a really nice question which indirectly says "Solve it if you understand the Ready Que concept or not." ;)
+17 votes
FCFS :- First come first serve.

Here arrival times of all processes are different, So for completion time just order them according of their arrival time. We get P1,P2,P3. So this eliminates option B & D.

Round Robin - Here when you run round robin algorithm on this 3 processes. completion sequence is P1, P3, P2.As Burst Time for P2 is big, P3 completes before P2.


So answer is (C)

Referemce :-
by Boss (42.1k points)
I'm not understanding how P3 finishes after P1.

   P1    P2    P3    P1    P2    P3    P1    P2

0       2      4      6      8      10    12     14      16

is the sequence I'm getting.
i am getting the sequance p3 p1 p2 for RR
round robin takes the first process in ready queue,after time quantum 2 p1 is sent to ready queue and is joined by p3 at time quantum 3. When p2 is preempted in time quantum 4,p1 is executed as it is in ready queue before p3
Someone explain how $RR2: P1,P3,P2$ ?

iam getting $RR2: P3,P1,P2$

@mcjoshi It is P1 P3 P2 itself..!


See the order of completion in round robin


Order of computation is

p1 p2 p1 p3 p2 p1 p3 p2

See my answer below for more explanation

+3 votes
option C  is correct  here FCFS is completion order               P1   P2   P3

                                                                                       0    5      12     16

 and RR scheduling    P1   P2   P1   P3   P2   P1   P3    P2

                             0     2      4     6      8     10   11     13     16

  ready queue -  P1,P2,P1,P3 ,P2,P1,P3,P2

           completion order P1, P3 ,P2  hence optionC is correct
by Loyal (6.5k points)
edited by
+3 votes
by Active (2.4k points)
edited by
+1 vote

You can  appy this method to solve every question related to round robin process 

by Active (4.7k points)
In the gantt chart, Completion time of P1 = 11, P2 = 16 and P3 = 13.
–1 vote
Ans is c..
by Active (1.1k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,833 questions
57,725 answers
107,835 users