FCFS scheduling program in C

FCFS scheduling program in C

Here you will learn FCFS scheduling and the example code of FCFS scheduling program in C language.

 

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 program in C

FCFS advantages and disadvantages

 

AdvantagesDisadvantages
FCFS 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.

FCFS does not require any complex data structures or algorithms, making it a good choice for real-time systems.

FCFS can cause long processes to suffer from starvation, meaning that they may not get enough time to execute.

FCFS does not take into account the priority of processes, so processes with higher priority might not be executed.

 

FCFS scheduling example

 

ProcessOrder of arrivalExecution time in msec
P1315
P213
P323

fcfs scheduling

 

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 scheduling program in C

Output

FCFS scheduling program in C output

 

 

Read Also

Priority Scheduling program in C

 

 

 

Leave a Comment

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

Scroll to Top