47 votes 47 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 RR$2$ (round robin scheduling with CPU quantum of $2$ time units) are FCFS: $P1, P2, P3$ RR2: $P1, P2, P3 $ FCFS: $P1, P3, P2$ RR2: $P1, P3, P2$ FCFS: $P1, P2, P3$ RR2: $P1, P3, P2$ FCFS: $P1, P3, P2$ RR2: $P1, P2, P3$ Operating System gatecse-2012 operating-system process-scheduling normal + – Arjun asked Sep 26, 2014 • edited Jun 18, 2021 by Lakshman Bhaiya Arjun 19.6k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 54 votes 54 votes FCFS First Come First Server RR2 In Round Robin We are using the concept called Ready Queue. Note 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 pC answered Oct 8, 2016 • edited Apr 19, 2019 by ajaysoni1924 pC comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments vishalshrm539 commented Dec 31, 2017 reply Follow Share @pc At t = 1, P2 arrives, before P1 finishes its execution. 2 votes 2 votes `JEET commented Jan 23, 2020 reply Follow Share Ready queue explanation is so ambiguous above, though the order is correct. 2 votes 2 votes `JEET commented Jan 23, 2020 reply Follow Share This was a really nice question which indirectly says "Solve it if you understand the Ready Que concept or not." ;) 8 votes 8 votes Please log in or register to add a comment.
18 votes 18 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 :- https://en.wikipedia.org/wiki/Round-robin_scheduling https://en.wikibooks.org/wiki/Operating_System_Design/Scheduling_Processes/FCFS Akash Kanase answered Nov 7, 2015 Akash Kanase comment Share Follow See all 9 Comments See all 9 9 Comments reply Sriram Karunagaran commented Jan 17, 2016 reply Follow Share 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. 3 votes 3 votes chandan commented Jan 19, 2016 reply Follow Share i am getting the sequance p3 p1 p2 for RR 0 votes 0 votes Utsab commented Jan 21, 2016 reply Follow Share 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 7 votes 7 votes mcjoshi commented Sep 18, 2016 reply Follow Share Someone explain how $RR2: P1,P3,P2$ ? iam getting $RR2: P3,P1,P2$ 5 votes 5 votes pC commented Oct 8, 2016 i edited by pC Oct 8, 2016 reply Follow Share @mcjoshi It is P1 P3 P2 itself..! 0 votes 0 votes mcjoshi commented Oct 8, 2016 reply Follow Share See the order of completion in round robin 1 votes 1 votes pC commented Oct 11, 2016 reply Follow Share Order of computation is p1 p2 p1 p3 p2 p1 p3 p2 See my answer below for more explanation 9 votes 9 votes MohanK commented Dec 2, 2020 reply Follow Share @mcjoshi , After 2 time units, P1 would be added at the end of P2 in the Ready Queue. while P3 only arrives after 3 units Therefore, it will be queued after P1 in the Ready Queue. . So, in your Gantt chart, after P1,P2, P1 will be executed ,not P3. I too initially did the same mistake 😅 1 votes 1 votes Pranavpurkar commented Jan 21, 2022 reply Follow Share MohanK same mistake! 0 votes 0 votes Please log in or register to add a comment.
3 votes 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 Hradesh patel answered Oct 11, 2016 • edited Oct 11, 2016 by Hradesh patel Hradesh patel comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes Option C is right choice. https://s30.postimg.org/b4ux9mjbl/IMG_20161222_213043.jpg https://s30.postimg.org/4sfrzsg9d/IMG_20161222_213059.jpg vishwa ratna answered Dec 22, 2016 • edited Dec 22, 2017 by Puja Mishra vishwa ratna comment Share Follow See 1 comment See all 1 1 comment reply Danishgupta commented Sep 8, 2020 reply Follow Share Nice explaination 0 votes 0 votes Please log in or register to add a comment.