##### GATE-2012 15. Consider the 3 processes, P1, P2 a

GATE-2012

15.  Consider the 3 processes, P1, P2 and P3 shown in the table

----------------------------------------------

Process     Arrival time    Time unit required

----------------------------------------------

P1              0                    5

P2              1                    7

P3              3                    4

----------------------------------------------

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

(a) FCFS: P1, P2, P3 RR2: P1, P2, P3

(b) FCFS: P1, P3, P2 RR2: P1, P3, P2

(c) FCFS: P1, P2, P3 RR2: P1, P3, P2

(d) FCFS: P1, P3, P2 RR2: P1, P2, P3

The answer was mentioned as C . How is it the answer in case of RR scheduling? I thought the order should be P3 P1 P2 in case of RR scheduling. Can anybody explain.?

Vivek Vikram Singh
2 Oct 2014 10:53 am

Yes, the given ans is correct . The correct Finishing order will be P1,P3,P2. I think you are doing some mistake while creating Ready Queue or Gantt Chart. Please do it carefully. I will tell you finish time of the processes P1=11,P3=13 P2=16.

Aparajita Mehta
2 Oct 2014 10:22 pm

I am still not able to understand. Please clear..

p1       p2      p3      p1       p2         p3      p1        p2       p2

0        2         4          6        8        10         12         13         15        16

Vivek Vikram Singh
3 Oct 2014 03:10 am

I will create an example to show you RR scheduling and explain this question also in the Example section of OS.Please do check ,because it is very imp for GATE. Just for now, please check the attached file with this comment and try to understand.

Vikash
7 Oct 2014 03:26 pm

p1     p2     p1     p3     p2     p1     p3     p2

0    2      4        6        8       10    11       13        16

you are taking p3 after first p2 but before p3 already p1 is waiting in ready queue so.....first p2 there must p1 execute before p3 .

Aparajita Mehta
9 Oct 2014 08:04 am

What if the arrival time of P3 would have been 2 instead of 3??

Vivek Vikram Singh
10 Oct 2014 09:24 pm

See this doc file attached

Aparajita Mehta
11 Oct 2014 02:19 pm

Ok ! Now I got it :)

Vivek Vikram Singh
11 Oct 2014 02:22 pm

great. All the best.

Vivek Vikram Singh
26 Oct 2014 01:23 am

http://www.techtud.com/computer-science/operating-system#overlay=example/example-explaining-concept-round-robin-scheduling-algorit

Please see this link. I tried explaining the concept of RR with an example in easy words. Might be helpful Aprajita.