First Come First Served Algorithm





First come first served scheduling algorithm (FCFS)

FCFS also termed as First-In-First-Out i.e. allocate the CPU in order in which the process arrive. When the CPU is free, it is allowed to process, which is occupying the front of the queue. Once this process goes into running state, its PCB is removed from the queue. This algorithm is non-preemptive.

Advantage

  • Suitable for batch system.
  • It is simple to understand and code.

Disadvantage

  • Waiting time can be large if short request wait behind the long process.
  • It is not suitable for time sharing system where it is important that each user should get the CPU for equal amount of time interval.

Examples
Consider the following set of processes having their CPU-burst time. CPU burst time indicates that for how much time, the process needs the CPU.

process Time for which cpu is required
CPU burst time
p1 10
p2 5
p3 5

If the processes have arrived in order P1, P2, P3 then the average waiting time for process will be obtained from Gantt chart.

first come first out

first come first out

Waiting Time for P1 = 0 Millisecond
Waiting Time for P2 = 10 Millisecond
Waiting Time for P2 = 15 Millisecond
Average Waiting Time = (0+10+15)/2 = 8.33 Millisecond

If the process arrive in order P2, P3, P1 then

first come first out

first come first out

Average Waiting Time = (0+5+10) / 3 = 5 Millisecond
Thus average waiting time will always depends upon the order in which the processes arrive. And vary depending upon whether the processes having less CPU-burst arrive first in the ready queue. Therefore this algorithm is never recommended whenever performance is major issue.



Related posts:

  1. Process States As the program executes, it generally changes state. A state...
  2. Processes Scheduling queue As processes enter the system they put in job queue....
  3. Dekker’s Algorithm Dekker’s Algorithm Dijktra reported on algorithm for mutual exclusion for...
  4. processes creation A process can create several new processes. The creating process...
  5. process model The software and large program is organized into a number...