Let us learn how to implement first come first serve algorithm in C programming with its explanation, output, advantages, disadvantages and much more.
What is First Come First Serve Disk Scheduling Algorithm?
The first come first serve algorithm is commonly abbreviated as FCFS algorithm. It primarily works on the First In First Out (FIFO) principle.
The incoming requests or jobs in the system queue are executed based on first come first served basis. This is a non-preemptive scheduling algorithm.
Therefore, once the CPU is allocated to a particular job, the job keeps on executing till it gets completed. The CPU cannot leave the current job before it gets completed. So, the CPU cannot move to another job in the queue.
The FCFS algorithm is usually represented using Gantt’s Chart on paper. However, the FCFS scheduling algorithm is not so efficient when it comes to performance optimization.
It is not optimized for time-sharing systems. The average waiting time for the first come first serve scheduling algorithm is highly dependent on the burst time of the jobs.
- Simple and easy to implement
- Every process/job gets executed completely
- Lower possibilities of starvation
- Poor performance due to high average waiting time
- There is no option for pre-emption of a job.
- Higher average turnaround time
- In-efficient for time-sharing systems
Note: This FCFS Algorithm C program is compiled with GNU GCC compiler using Linux terminal on Linux Ubuntu operating system.
First Come First Serve CPU Scheduling Algorithm C Program
If you have any doubts about the implementation of FCFS program in C language, let us know about it in the comment section. Find more about it here.