Answer: 8.25
To find the average turnaround time, we trace the execution of the processes using the Preemptive Shortest Remaining Time First (SRTF) scheduling algorithm.
Gantt Chart Execution:
- At t=0: Only P1 is available. It runs for 3 ms.
- At t=3: P2 arrives. Remaining time of P1=7 ms, and burst time of P2=6 ms. Since 6<7, P2 preempts P1 and runs.
- At t=7: P3 arrives. Remaining time of P2=2 ms, and burst time of P3=1 ms. Since 1<2, P3 preempts P2 and runs.
- At t=8: P3 completes. P4 arrives with burst time 3 ms. The remaining times are: P1(7), P2(2), and P4(3). P2 has the shortest remaining time, so it runs and completes at t=10.
- At t=10: Remaining processes are P1(7) and P4(3). P4 runs and completes at t=13.
- At t=13: Finally, P1 runs and completes at t=20.
The Gantt chart is represented as:
P1 03 P2 37 P3 78 P2 810 P4 1013 P1 1320
Turnaround Time (TAT) Calculation:
Turnaround Time (TAT)=Completion Time (CT)−Arrival Time (AT)
| Process |
Arrival Time (AT) |
Burst Time (BT) |
Completion Time (CT) |
Turnaround Time (TAT) |
| P1 |
0 |
10 |
20 |
20−0=20 |
| P2 |
3 |
6 |
10 |
10−3=7 |
| P3 |
7 |
1 |
8 |
8−7=1 |
| P4 |
8 |
3 |
13 |
13−8=5 |
Average Turnaround Time=420+7+1+5=433=8.25 ms