**Operating System**
Preemptive SJF
The newly arrived process with shorter CPU burst will preempt the currently executing process.
Process |
Arrival Time |
Burst Time |
P1 |
3 |
8 |
P2 |
2 |
4 |
P3 |
1 |
9 |
P4 |
0 |
5 |
Draw the Gantt Chart and calculate the average waiting time.
The Gantt chart is
Arrival Time: Time at which the process arrives in the ready
queue.
Completion Time: Time at which process completes its
execution.
Burst Time: Time required by a process for CPU execution.
Turn Around Time: Time Difference between completion time and
arrival time.
Turn Around Time = Completion Time - Arrival Time
Waiting Time(W.T): Time Difference between turn around time and
burst time.
Waiting Time = Turn Around Time - Burst Time
The calculations are
Process | Burst Time | Arrival Time | Completion Time | Turn around Time | Waiting Time |
P1 | 8 | 3 | 17 | 14 | 6 |
P2 | 4 | 2 | 9 | 7 | 3 |
P3 | 9 | 1 | 26 | 25 | 16 |
P4 | 5 | 0 | 5 | 5 | 0 |
Average waiting time=(6+3+16+0)/4=6.25
Get Answers For Free
Most questions answered within 1 hours.