Skip to main content

Round robin scheduling (53, 17, 68, 24 ms)

Short answer

Round-robin with quantum 4 ms yields waiting times: P1 93, P2 52, P3 94, P4 65 ms; average waiting time = 76 ms, average turnaround time = 116.5 ms.

Consider three processes with process IDs P1, P2, P3 and P4 with estimated completion time 53, 17, 68, 24 ms respectively, enters the ready queue together in order P1, P2, P3, P4. Calculate waiting time and turn around time for each process and average waiting times and average turn around time in Round Robin algorithm with time slice 4 ms. Assume there is no I/O waiting for the process.

Round robin with a time slice of 4 ms; all four processes arrive at 0 in the order P1, P2, P3, P4. The Gantt chart is long, so the rounds are summarised below it.

Gantt chart

| P1 | P2 | P3 | P4 | P1 | P2 | P3 | P4 | P1 | P2 | P3 |
0    4    8    12   16   20   24   28   32   36   40   44

| P4 | P1 | P2 | P3 | P4 | P1 | P2 | P3 | P4 | P1 | P3 |
44   48   52   56   60   64   68   69   73   77   81   85

| P4 | P1 | P3 | P1 | P3 | P1 | P3 | P1 | P3 | P1 | P3 |
85   89   93   97   101  105  109  113  117  121  125  129

| P1 | P3 | P1 | P3 | P1 | P3 | P3 | P3 | P3 |
129  133  137  141  145  146  150  154  158  162

Rounds

  • Rounds 1-4 (0-64): P1, P2, P3, P4 run 4 ms each per round (16 ms per round). Remaining after round 4: P1 37, P2 1, P3 52, P4 8.
  • Round 5 (64-77): P1 64-68, P2 68-69 (needs only 1 ms, so it finishes at 69), P3 69-73, P4 73-77.
  • Round 6 (77-89): P1 77-81, P3 81-85, P4 85-89 (P4 finishes at 89).
  • From 89 only P1 (29 ms left) and P3 (44 ms left) remain and alternate in 4 ms slices: P1 89-93, P3 93-97, and so on.
  • P1 finishes at 146 (its last slice is 1 ms, 145-146). P3 then runs alone from 146 to 162.

Calculation

TAT = completion time - arrival time; WT = TAT - burst time.

ProcessATBTCTTAT = CT - ATWT = TAT - BT
P105314614693
P2017696952
P306816216294
P4024898965

AWT = (93 + 52 + 94 + 65) / 4 = 304/4 = 76 ms

ATAT = (146 + 69 + 162 + 89) / 4 = 466/4 = 116.5 ms

Answer: AWT = 76 ms, ATAT = 116.5 ms.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Embedded System chapter 6 questions →