order of computation is actually this

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

**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$

+37 votes

Best answer

**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

+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 :-

https://en.wikipedia.org/wiki/Round-robin_scheduling

https://en.wikibooks.org/wiki/Operating_System_Design/Scheduling_Processes/FCFS

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

+3

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.

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

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

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

+1 vote

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.6k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,833 questions

57,725 answers

199,451 comments

107,835 users