# FIFO

## First Come First Serve (FCFS) Algorithm

FCFS is a process of the Operating System which is responsible for assigning processes to the operating system. The method is also used as a routing management process which executes the quoted requests and process depending on the order in which they arrived to the operating system. In this algorithm, as the name suggests, processes that arrive first to the operating system are served first. Likewise, the process that stand later are processed later.

The algorithm is also known as first in first out (FIFO) and first come first choice (FCFC) method. The following section describes its stepwise process to executing processes in the priority.

FCFS algorithm can be best explained with the help of an example.

### Example

If there are n processes with their respective burst times, we need to find the average waiting time along with the average waiting and turnaround time. The algorithm to find these is the FCFS scheduling algorithm.

In this case, we are considering that the arrival time for all the processes is 0.

Some terms related to the algorithm are mentioned below:

1. Completion Time: The time at which a process completes its execution.
2. Turn Around Time: Time difference between arrival time and completion time.

Turn Around Time = Completion Time – Arrival Time

1. Waiting Time: The time difference between turnaround time and burst time.

Waiting Time = Turn Around Time – Burst Time

[table id=913 /]

Waiting time for P1= 0

Waiting time for P2= 20

Waiting time for P3= 22

Average Waiting time (0 + 20 + 22)/3

= 14