Lab
CPU scheduling lab
Six algorithms on your own processes: a Gantt chart, waiting, turnaround and response time, with a predict-first mode.
Processes
Change anything: the chart follows
| Process | Arrival | Burst | Remove |
|---|---|---|---|
| P1 | |||
| P2 | |||
| P3 | |||
| P4 |
Try
Gantt chart
First come, first served
P1
P2
P3
P4
0581622
| Process | Arrival | Burst | Completion | Turnaround | Waiting | Response |
|---|---|---|---|---|---|---|
| P1 | 0 | 5 | 5 | 5 | 0 | 0 |
| P2 | 1 | 3 | 8 | 7 | 4 | 4 |
| P3 | 2 | 8 | 16 | 14 | 6 | 6 |
| P4 | 3 | 6 | 22 | 19 | 13 | 13 |
| Average | 11.25 | 5.75 | 5.75 |
Waiting = turnaround − burst. Response = first time on the CPU − arrival. The CPU was busy 100% of the 22 time units, with 3 switches from one process straight to another.
The same processes under every algorithm
Average waiting time
| Algorithm | Average waiting time | Compared with the best |
|---|---|---|
| First come, first servedselected | 5.75 | 0.75 more |
| Shortest job first | 5.25 | 0.25 more |
| Shortest remaining time first | 5 | The lowest |
| Round robin | 9.75 | 4.75 more |
| Priority (not preemptive) | 5.25 | 0.25 more |
| Priority (preemptive) | 5 | The lowest |