Professional Documents
Culture Documents
Scheduling Algorithms: 1. Fcfs
Scheduling Algorithms: 1. Fcfs
Scheduling Algorithms: 1. Fcfs
Waiting time = how much time it waited to for CPU (depend on algo)
Turnaround time=waiting time + burst time
Departure time= Arrival time + turnaround time
1. FCFS
P1 0 24 24 24 0
P2 0 3 27 27 24
P3 0 3 30 30 27
Average waiting time (0+24+27)/3=17ms
P1- p2 –p3
Gantt Chart
P1 P2 P3
0 24 27 30
2.SJF
Proces Arriva Burst Depar Turnaroun Waiting time
s l Time time ture d time
Time
P1 0 6 9 9 3
P2 0 8 24 24 16
P3 0 7 16 16 9
P4 0 3 3 3 0
Average waiting time (3+16+9+0)/4=7ms
Gantt Chart
P4 P1 P3 P2
0 3 9 16 24
FCF= 10.25ms
3. Shortest Remaining Time next
P1 P2 P4 P1 P3
0 1 5 10 17 26
Process Arrival time Burst time(CPU) Turnaround time Waiting time
P1 0 24 30 6(10-4)
P2 0 3 7 4
P3 0 3 10 7
4+7+6=17/3
Round Robin (Quantum- 4 Units)
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
Priority scheduling
P2 0 1 1 0
P3 0 2 4 16
P4 0 1 5 18
P5 0 5 2 1
Av waiting Time =(6+ 16+ 18+1)/5=8.2
P2 P5 P1 P3 P4
0 1 6 16 18 19
Assignment1
Exercise:
1. Calculate the Departure time, Turnaround time, waiting time &average
waiting time for FCFS. SJR. . Shortest Remaining time next, & round
Robin ( 2 units ) .
Draw the Gantt chart also.
Process Arrival Burst
time time(CPU)
P1 2 4
P2 4 6
P3 5 3
2. Find the calculate the Departure time, Turnaround time waiting time
&average waiting, for FCFS. SJF. Shortest Remaining time next, & round Robin (
2 units ) Scheduling Algorithms for the following example
P1 0 5
P2 2 8
P3 3 1
P4 11 4
P5 12 2