# First Come First Serve(FCFS) Scheduling

by Dinesh Thakur Category: Operating System

## Calculating average waiting time for scheduling

We use the average waiting time parameter to see its performance. We explain this with the help of an example.

Example: Consider the three processes P1, P2, and P3 which arrives at a different time and illustrated accurately in the below table and reaches for execution in the same manner as they shown with arrival time 0. Burst time is given in the chart.

 Process Burst time Arrival P1 21 1st P2 3 2nd P3 5 3rd

Below is the GANTT chart of the above process

The average waiting time or AWT= (0+21+24)/3= 15ms

Thus, for the above-given processes, firstly P1 executed in the CPU.

•   So, waiting time for P1 is 0 as the CPU processes no request.

•   P1 takes 21 ms to complete its execution. So, waiting time for process P2 is 21ms.

•   Similarly, waiting time for process P3 is formed by adding execution time for process P1 and execution time for process P2, i.e., process P3= 21+3=24 ms

•   In the same way, the waiting time for process P4= execution time of P1+P2+P3 = 21+3+5 = 29ms So, this process thoroughly explained through the Gantt chart.

## Advantages of First Come First Serve to scheduling

•   It is easy to implement.

•   It is easy to understand.

## Disadvantages of First Come First Serve to scheduling

•   In this, the priority of process for execution does not matter as it is a non-preemptive scheduling process.

Example: if a process with less priority executed first and it takes more time as per its requirement, and suddenly a procedure with high priority reaches, then the CPU does not perform this high priority process. So, this high priority process has to wait because of improper process scheduling.

•   In this, average waiting time or AWT is high, i.e., the average waiting time is not optimal.

•   In FCFS, parallel utilization of resources is not possible, which give the result to Convoy Effect. Thus, poor usage of resources takes place.

## What do you mean by convoy effect?

When some processes need to use the resource for a short interval of time but blocked by some other method which is holding the resource for a long time, this situation is known as Convoy Effect. It leads to poor utilization of resources which in result leads to poor performance.

Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles