Turn Around Time = Process Completion Time – Process Arrival Time
Waiting time = Turn Around time – Burst time
First Come First Serve (FCFS) Scheduling
Process |
Arrival Time |
Burst Time |
Completion Time |
Turn Around Time |
Waiting Time |
P1 |
0 |
8 |
8 |
8 – 0 = 8 |
8 – 8 = 0 |
P2 |
1 |
1 |
9 |
9 – 1 = 8 |
8 – 1 = 7 |
P3 |
2 |
3 |
12 |
12 – 2 = 10 |
10 – 3 =7 |
P4 |
3 |
2 |
14 |
14 – 3 = 11 |
11 – 2 = 9 |
P5 |
4 |
6 |
20 |
20 – 4 = 16 |
16 – 6 = 10 |
Average Turn Around Time = (8 + 8 + 10 + 11 + 16)/5 = 10.6 ms
Average Waiting time = (0 + 7 + 7 + 9 +10)/5 = 6.6 ms
Shortest Job First (SJF) Scheduling
Process |
Arrival Time |
Burst Time |
Completion Time |
Turn Around Time |
Waiting Time |
P1 |
0 |
8 |
20 |
20 – 0 = 20 |
20 – 8 = 12 |
P2 |
1 |
1 |
2 |
2 – 1 = 1 |
1 – 1 = 0 |
P3 |
2 |
3 |
5 |
5 – 2 = 3 |
3 – 3 = 0 |
P4 |
3 |
2 |
7 |
7 – 3 = 4 |
4 – 2 = 2 |
P5 |
4 |
6 |
13 |
13 – 4 = 9 |
9 – 6 = 3 |
Average Turn Around Time = (20 + 1 + 3 + 4 + 9)/5 = 7.4 ms
Average Waiting time = (12 + 0 + 0 + 2 + 3)/5 = 3.6 ms
Preemptive Priority Based Scheduling
Process |
Arrival Time |
Burst Time |
Priority |
Completion Time |
Turn Around Time |
Waiting Time |
P1 |
0 |
8 |
3 |
12 |
12 – 0 = 12 |
12 – 8 = 4 |
P2 |
1 |
1 |
1 |
2 |
2 – 1 = 1 |
1 – 1 = 0 |
P3 |
2 |
3 |
2 |
5 |
5 – 2 = 3 |
3 – 3 = 0 |
P4 |
3 |
2 |
3 |
14 |
14 – 3 = 11 |
11 – 2 = 9 |
P5 |
4 |
6 |
4 |
20 |
20 – 4 = 16 |
16 – 6 = 10 |
Average Turn Around Time = (12 + 1 + 3 + 11 + 16)/5 = 8.6 ms
Average Waiting time = (4 + 0 + 0 + 9 + 10)/5 = 4.6 ms
Round Robin Scheduling
Quantum = 2 ms
Process |
Arrival Time |
Burst Time |
Completion Time |
Turn Around Time |
Waiting Time |
P1 |
0 |
8 |
20 |
20 – 0 = 20 |
20 – 8 = 12 |
P2 |
1 |
1 |
3 |
3 – 1 =2 |
2 – 1 = 1 |
P3 |
2 |
3 |
12 |
12 – 2 = 10 |
10 – 3 = 7 |
P4 |
3 |
2 |
7 |
7 – 3 = 4 |
4 – 2 = 2 |
P5 |
4 |
6 |
18 |
18 – 4 = 14 |
14 – 6 = 8 |
Average Turn Around Time = (20 + 2 + 10 + 4 + 14)/5 = 10 ms
Average Waiting time = (12 + 1 + 7 + 2 + 8)/5 = 6 ms
Shortest Job First (SJF) Results in minimum Average Waiting time from all other schedulings