Search code examples
scheduled-tasksscheduling

Round robin algorithm scheduling


enter image description here

We want to calculate the average waiting time using RR and quantum 8.

| p1 | p2 | p3 | p4 | p5 | p6 | p7 | p1 | p3 | p5 | p3 | p5 |

0 8 13 21 24 32 35 43 48 56 64 71 86

p5 = 86 - 31 = 55

p3 = 71 - 23 = 48

p1 = 48 - 13 = 35

p7 = 43 - 14 = 29

p6 = 35 - 3 = 32

p4 = 24 - 3 = 21

p2 = 13 - 5 = 8

Adding all and dividing by 7 gives me 32.5, but the answer given is different. I did this a couple of times so I am not sure what the issue is?

enter image description here


Solution

  • Your giant chart is not right seem like you forget to add p7 it must be like:

     | p1 | p2 | p3 | p4 | p5 | p6 | p7 | p1 | p3 | p5 | p7 | p3 | p5 |
     0    8    13   21   24   32   35   43   48   56   64   70  77   92
    

    And then perform your calculation according to this chart.