Preemptive SJF Process Arrival Time Burst Time P1 0 8 P2 1 5
Preemptive SJF
Process Arrival Time Burst Time
P1 0 8
P2 1 5
P3 2 3
P4 3 1
Preemptive SJF Gantt Chart ?
Average waiting time ?
Solution
Shortest Job First(SJF) Scheduling
Process
Arrival Time
Burst Time
P1
0
8
P2
1
5
P3
2
3
P4
3
1
Preemptive SJF Gantt Chart is-
P1
P2
P3
P4
P3
P2
P1
0 1 2 3 4 6 10 17 (time)
Average waiting time
Here we have to found average waiting time for each process
waiting time for process P1=9
waiting time for process P2=4
waiting time for process P3=1
waiting time for process P4=0
sum of all process waiting time= 9+4+1+0
Number of Process=4
Average waiting time= (sum of all process waiting time)/ Number of Process
Average waiting time= (9+4+1+0)/4
Average waiting time= 3.75
Additional Info:-
(P1 stop just after 1 second and again start on 10 second so waiting time is 10-1=9)
(P2 arrive at 1 sec, stop just after 2 second and again start on 6 second so waiting time is 6-2=4)
(P3 arrive at 2 sec, stop just after 3 second and again start on 4 second so waiting time is 4-3=1)
---------------------------------------------------------------------------------------------
If you have any query, please feel free to ask
Thanks a lot
| Process | Arrival Time | Burst Time |
| P1 | 0 | 8 |
| P2 | 1 | 5 |
| P3 | 2 | 3 |
| P4 | 3 | 1 |

