FCFS scheduling program in C

FCFS scheduling program in C

In this example, you will learn FCFS scheduling and you will get the program code of FCFS scheduling program in C programming.

FCFS Scheduling

FCFS (First Come First Served) is a scheduling algorithm that processes requests in the order in which they are received. This algorithm does not prioritize any requests, but rather processes them in the order in which they arrive. This is the simplest scheduling algorithm and is widely used in operating systems.

FCFS Scheduling

fcfs advantages and disadvantages

Advantages Disadvantages
FCFS is that it is simple and easy to implement. It is also beneficial in a situation where short processes need to be completed quickly since the shorter processes will be completed first. Additionally, FCFS does not require any complex data structures or algorithms, making it a good choice for real-time systems. FCFS is that it can cause long processes to suffer from starvation, meaning that they may not get enough time to execute. Additionally, FCFS does not take into account the priority of processes, so processes with higher priority might not be executed.

FCFS scheduling example

Process Order of arrival Execution time in msec
P1 3 15
P2 1 3
P3 2 3

fcfs scheduling chart

As shown above,

The waiting time of process P2 is 0

The waiting time of process P3 is 3

The waiting time of process P1 is 6

Average time = (0 + 3 + 6) / 3 = 3 m. sec.

FCFS program in c

Output :

fcfs

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top