by Dinesh Thakur Category: Operating System

It termed as First Come First Serve (FCFS) Scheduling. As its name implies, the process which arrives first in front of CPU for processing, then that process executed first. It is a non-preemptive scheduling algorithm which means in this priority of processing does not matter, i.e., whatever the priority may be the process executed in the manner they arrived.

It is also known as FIFO, i.e. first in first out. We can also write C/C++ program for first come first serve scheduling algorithm.

Example: real-life example of FCFS is buying a ticket on the ticket counter. In this, a person is served according to queue manner. The man who arrives first in the queue first buys the ticket and the process goes on. Similarly, for CPU the process works.

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

GANTT chart

                                      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.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, 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