The Gateway to Computer Science Excellence
+6 votes

Consider the following set of processes, with arrival times and the required CPU-burst times given in milliseconds.

      Process        Arrival Time     Burst Time
        P1            0          4
        P2            2          2
        P3            3          1

What is the sequence in which the processes are completed? Assume round robin scheduling with a time quantum of $2$ milliseconds.

  1. $P1, P2, P3$
  2. $P2, P1, P3$
  3. $P3, P2, P1$
  4. $P2, P3, P1$
in Operating System by Boss (30.8k points) | 2.7k views

2 Answers

+13 votes
Best answer
0-2 2-4 4-6 6-7
p1 p2 p1 p3

answer B)- P2, P1, P3

by (301 points)
selected by
answer is d
Why was P3 not picked in 4-6 slot ?
Same question why p3 is not picked in 4-6 slot?
how b will come? i think d is correct..plz explain
After time Quantum duration 2, as P1 Quantum finished at 2 so it again came in line to process in next cycle.And P3 Arrival time is 3 so it will come after P1. once P2 finished at 4. P1 will Start Processing.
that why P3 will not picked in 4-6 slot.
+2 votes

Answer D)
by Veteran (119k points)
I think You are not looking at the arrival time of p3 .... so acc. to me after 2 ms p2 is staring and p1 is getting scheduled in ready queue and at 3ms p3 arrives so it will be scheduled in ready queue after q1 and then at 4ms p2 is over and p1 gets CPU and then at 6ms p1 is over and p3 gets CPU.

So ans should be option B.
ok u mean after 2 ms when P2 starts then P1 will come in ready queue again

 P3 comes in 3 ms

So, P1 will execute before P3
@srestha yes :)
when in doubt think of an implementation where we need to have a queue of processes and new one goes to the end of queue.

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,737 questions
57,324 answers
105,169 users