0

Not sure if I understood the concept of RR correctly.

Let's say I've got three processes ready to be CPU'd:

A - 1st priority - requires 2 minutes of CPU time;

B - 3rd priority - 5 minutes;

C - 2nd priority - 10 minutes;

So in order to calculate average turnaround time 'on paper', I can presume that quantum=1 minute and process everything according to their priorities (A-C-B, etc).

But one minute is too big for a 'real' quantum, right? Should quantum=10-100 milliseconds, will everything be switched so fast that task order becomes irrelevant? Should I assume that each job will simply consume an equal amount (1/3) of CPU time and go from there? E.g. A will end in 2*3=6 minutes, B will end in (5-2)*2+6=12 minutes and C will end in 10-2-3+12=17 minutes. Thus average tat is (6+12+17)/3=11.66? Or is this just ridiculous?

lethargicwasp
  • 31
  • 1
  • 6

1 Answers1

1

If processes A, B and C requires execution times as follows,

A -  2 minutes
B -  5 minutes
C - 10 minutes

Then round robin scheduling will give you the following turn around times, If the order of priority is A followed by C followed by B.

A -  4 minutes
B - 12 minutes
C - 17 minutes

The execution of Processes takes place as follows,

Time->  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17 
        A - C - B - A - C - B - C - B - C - B - C - B - C - C - C - C - C
                    ^                               ^                   ^ 
                    |                               |                   |
                 Process A                       Process B           Process C
                 Completed                       Completed           Completed

Remember order does matter in round robin scheduling because in this case the average turn around time is just (4+12+17)/3=11.

Deepu
  • 7,592
  • 4
  • 25
  • 47
  • Thanks for the quick reply. I'm afraid I didn't get the logic behind your calculations, though. Results seem similar to what I wrote above, but A turnaround time is different, so I guess it's just a coincidence. – lethargicwasp Mar 30 '13 at 17:35
  • Would you mind expanding on how you've got these numbers if you've got a minute or two? – lethargicwasp Mar 30 '13 at 18:51
  • Thanks. But this means that quantum/slice = 1 minute, right? Is it acceptable for quantum to be this high in real life environment? – lethargicwasp Mar 30 '13 at 19:06
  • Right, but the initial question was how would we estimate turnaround time using a shorter (10-100ms) quantum? – lethargicwasp Mar 30 '13 at 19:36
  • Sure, but if quantum is so small - can I just assume that each process will use 1/3 of CPU's time? The way I described in my original post? Otherwise how the chart would look like? – lethargicwasp Mar 30 '13 at 20:32