Operating System : Non-Preemptive Shortest Job First(SJF)
CORRECTION FOR LAST SESSION:
Example of Non-Preemptive SJF
Process Arrival Time Burst Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
COMPUTATION FOR:
Average waiting time = (0 + 6 + 3 + 7)/4 = 4
Note:
1) Waiting Time P1 = 0 —— means it did not wait
2) Waiting Time P2 = 6 ——- because it total waiting time based on the Gant Chart is 8 ms. But remember, it arrived 2 ms from the start of the CPU catering all processes, so 2 ms should be deducted from 8 ms, making it 6 ms only its waiting time.
3) Waiting Time P3 = 3 —— based on the Gant Chart, it would appear 7 ms its waiting time, but remember it arrives 4 ms from the start of the CPU catering all processes, so 4 ms should be deducted from 7 ms, making it 3 ms only its waiting time.
4) Waiting Time P4 = 7 —— based on the Gant Chart, it would appear 12 ms its waiting time, but remember it arrives 5 ms from the start of the CPU catering all processes, so 5 ms should be deducted from 12 ms, making it 7 ms only its waiting time.
Therefore,
AWT = P1 + P2 +P3 + P4 = (0 + 6 + 3 + 7)/4 = 4 ms
- All about me, IT related | Time: 12:32 am (UTC+8) No Comments »

