FCFS ALGORITHM
FCFS ALGORITHM
P1 2 2
P2 5 6
P3 0 4
P4 0 7
P5 7 4
Solution
Gantt chart
For this problem CT, TAT, WT, RT is shown in the given table
P1 2 2 13 13-2= 11 11-2= 9 9
P2 5 6 19 19-5= 14 14-6= 8 8
P3 0 4 4 4-0= 4 4-4= 0 0
P4 0 7 11 11-0= 11 11-7= 4 4
P5 7 4 23 23-7= 16 16-4= 12 12
P1 2 2
P2 0 1
P3 2 3
P4 3 5
P5 4 5
Solution
Gantt chart
For this problem CT, TAT, WT, RT is shown in the given table
P1 2 2 4 4-2= 2 2-2= 0 0
P2 0 1 1 1-0= 1 1-1= 0 0
P3 2 3 7 7-2= 5 5-3= 2 2
P4 3 5 12 12-3= 9 9-5= 4 4
P5 4 5 17 17-4= 13 13-5= 8 8
Average Waiting time = (0+0+2+4+8)/5 = 14/5 = 2.8 time unit (time unit
can be considered as milliseconds)
Average Turn-around time = (2+1+5+9+13)/5 = 30/5 = 6 time unit (time
unit can be considered as milliseconds)
*In idle (not-active) CPU period, no process is scheduled to be
terminated so in this time it remains void for a little time.
Advantages Of FCFS Scheduling
It is an easy algorithm to implement since it does not include any
complex way.
Every task should be executed simultaneously as it follows FIFO
queue.
FCFS does not give priority to any random important tasks first so
its a fair scheduling.
Disadvantages Of FCFS Scheduling
FCFS results in convoy effect which means if a process with higher burst
time comes first in the ready queue then the processes with lower burst
time may get blocked and that processes with lower burst time may not be
able to get the CPU if the higher burst time task takes time forever.
If a process with long burst time comes in the line first then the other short
burst time process have to wait for a long time, so it is not much good as
time-sharing systems.
Since it is non-preemptive, it does not release the CPU before it completes
its task execution completely.