Escovidal, Joseph Armand D. Preemptive SJF
Escovidal, Joseph Armand D. Preemptive SJF
Escovidal, Joseph Armand D. Preemptive SJF
PREEMPTIVE SJF
1.
Process Arrival Time Burst Time Completion Waiting Turnaround
P1 0 5 10 5 10
P2 1 2 3 0 2
P3 2 3 6 1 4
0 1 2 3 4 5 6 7 8 9 10
P1 P2 P3 P1
P1 P2 P3
Waiting Time:
P1 = 0 – 0 + 5 = 5
P2 = 1 – 1 = 0
P3 = 3 – 2 = 1
AverageWaitingTime = 5 + 0 + 1 = 6/3 = 2
Turnaround Time:
P1 = 10 – 0 = 10
P2 = 3 – 1 = 2
P3 = 6 – 2 = 4
2.
Process Arrival Time Burst Time Completion Waiting Turnaround
P1 0 3 3 0 3
P2 3 4 8 1 5
P3 4 5 13 4 9
P4 5 1 6 0 1
0 1 2 3 4 5 6 7 8 9 10 11 12 13
P1 P2 P4 P2 P3
P1 P2 P3 P4
Waiting Time:
P1 = 0 – 0 = 0
P2 = 3 – 3 + 1 = 1
P3 = 8 – 4 = 4
P4 = 5 – 5 = 0
Turaround Time:
P1 = 3 – 0 = 3
P2 = 8 – 3 = 5
P3 = 13 – 4 = 9
P4 = 6 – 5 = 1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
P3 P1 P3 P2 P4
P3 P1 P4 P2
Waiting Time:
P1 = 1 – 1 = 0
P2 = 6 – 4 = 2
P3 = 0 – 0 + 2 = 2
P4 = 11 – 3 = 8
AverageWaitingTime = 0 + 2 + 2 + 8 = 12/4 = 3
Turnaround Time:
P1 = 3 – 1 = 2
P2 = 11 – 4 = 7
P3 = 6 – 0 = 6
P4 = 17 – 3 = 14
NON-PREEMPTIVE SJF
1.
Process Arrival Time Burst Time Completion Waiting Turnaround
P1 0 2 3 1 3
P2 0 1 1 0 1
P3 0 3 6 3 6
0 1 2 3 4 5 6
P2 P1 P3
P1
P2
P3
Waiting Time:
P1 = 1 – 0 = 1
P2 = 0 – 0 = 0
P3 = 3 – 0 = 3
Turnaround Time:
P1 = 3 – 0 = 3
P2 = 1 – 0 = 1
P3 = 6 – 0 = 6
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
P2 P3 P1 P4
P2 P4 P3 P1
Waiting Time:
P1 = 6 – 3 = 3
P2 = 0 – 0 = 0
P3 = 2 – 2 = 0
P4 = 9 – 1 = 8
Turnaround Time:
P1 = 9 – 3 = 6
P2 = 2 – 0 = 2
P3 = 6 – 2 = 4
P4 = 14 – 1 = 13
3.
Process Arrival Time Burst Time Completion Waiting Turnaround
P1 6 2 9 1 3
P2 2 3 5 0 3
P3 4 2 7 1 3
P4 1 4 13 12 12
P5 0 2 2 0 2
0 1 2 3 4 5 6 7 8 9 10 11 12 13
P5 P2 P3 P1 P4
P5 P4 P2 P3 P1
Waiting Time:
P1 = 7 – 6 = 1
P2 = 2 – 2 = 0
P3 = 5 – 4 = 1
P4 = 13 – 1 = 12
P5 = 0 – 0 = 0
Turnaround Time:
P1 = 9 – 6 = 3
P2 = 5 – 2 = 3
P3 = 7 – 4 = 3
P4 = 13 – 1 = 12
P5 = 2 – 0 = 2