In: Computer Science
For the following processes, given the description, draw the Gantt chart and paste the picture in the answer doc. What is the waiting time and turnaround time of each process and what is the average waiting time and turnaround time.
Preemptive SJF |
||
Process |
AT |
BT(millisecs) |
P1 |
1 |
1 |
P2 |
0 |
2 |
P3 |
5 |
3 |
P4 |
4 |
4 |
P5 |
3 |
5 |
Answer:
Formula's we use in this question:
1.Completion Time: Time at which process completes its execution.
2.Turn Around Time (TAT):Time Difference between completion time and arrival time.
Turn Around Time = Completion Time – Arrival Time
3.Waiting Time (WAT): Time Difference between
turn around time and burst time.
Waiting Time = Turn Around Time – Burst Time
Gantt Chart:
The waiting time and turnaround time of each process and average waiting time and turnaround time:
//Explanation:
Process P1: arrived at 1 ms service time:1 priority: 0 completed at 2: TATp1= 1 ms and WATA= 0 ms
Process p2: arrived at 0 ms, service time:2 priority: 0 completed at 4: TATp2= 4 ms and WATB= 2 ms
Process p3: arrived at 5 ms, service time:3 priority: 0 completed at 8: TATp3= 3 ms and WATC= 0 ms
Process p4: arrived at 4 ms, service time:4 priority: 0 completed at 12: TATp4= 8 ms and WATD= 4 ms
Process p5: arrived at 3 ms, service time:5 priority: 0 completed at 17: TATp5= 14 ms and WATE= 9 ms
First request arrived at: 0 ms
Last request completed at: 17 ms
Total service time for all processes = 15 ms
Average turnaround time (ATAT) = 6 ms
Average waiting time (AWAT) = 3 ms
// if you have any doubt please comment in the comment box ....