Question 14: Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
Process | Arrival Time | Burst Time |
---|---|---|
P1 | 0 | 9 |
P2 | 1 | 5 |
P3 | 2 | 3 |
P4 | 3 | 6 |
P5 | 3 | 8 |
P6 | 4 | 1 |
Draw gantt charts illustrating the execution of these processes using RR or round robin(quantum = 1) scheduling. What is turn around time and waiting time of each process.
Solution:
Given Time Quantum: 1.0
Formulas:
- Turnaround Time (TAT) = Completion Time - Arrival Time
- Waiting Time (WT) = Turnaround Time - Burst Time
Gantt Chart
Calculation:
Process | Completion Time | Turnaround Time | Waiting Time |
---|---|---|---|
P1 | 31 | 31 - 0 = 31 | 31 - 9 = 22 |
P2 | 20 | 20 - 1 = 19 | 19 - 5 = 14 |
P3 | 15 | 15 - 2 = 13 | 13 - 3 = 10 |
P4 | 27 | 27 - 3 = 24 | 24 - 6 = 18 |
P5 | 32 | 32 - 3 = 29 | 29 - 8 = 21 |
P6 | 9 | 9 - 4 = 5 | 5 - 1 = 4 |
Average Turnaround Time = (31 + 19 + 13 + 24 + 29 + 5 ) / 6 = 20.16
Average Waiting Time = (22 + 14 + 10 + 18 + 21 + 4 ) / 6 = 14.833