Javatpoint Logo
Javatpoint Logo

FCFS Program in C

What is CPU Scheduling?

Processes and activities are scheduled in order to complete the task on time. CPU Scheduling is a method that makes maximum use of the CPU by allowing one process to run while another is delayed (on standby) due to the lack of any resources, such as I/O, etc. CPU scheduling is used to improve the system's effectiveness, speed, and fairness.

The operating system must choose one of the processes in the list of ready-to-launch processes whenever the CPU gets idle. A temporary (CPU) scheduler does the selection. The Scheduler chooses one of the ready-to-start memory processes to get the CPU.

In this article we are going to talk about FCFS scheduling algorithm

The aim is to use the FCFS scheduling algorithm to determine the average waiting time and average turnaround time given n processes and their burst timings. The simplest scheduling technique is first in, first out (FIFO), commonly referred to as first come, first served (FCFS). Processes are merely queued using FIFO in the order that they enter the ready queue.

Term used:

  • When the execution is finished, it is the completion time.
  • Turnaround Time: The turnaround time is calculated by adding the burst and waiting times.
  • Waiting time: The amount of time a process must wait before receiving the CPU and beginning its execution is referred to as waiting time.

In this, the first procedure will be carried out first, and the subsequent process won't begin until the first has been carried out completely.

Here, we're assuming that all processes arrive at the same time, or zero.

How can I use software to calculate the Round Robin timings below?

  • Time when a process reaches the end of its execution.
  • Turnaround time is the interval of time between completion and arrival. Turn Around Time = Arrival Time - Completion Time
  • Waiting Time (W.T): The interval between burst and turn-around times.
  • Turnaround time minus burst time equals waiting time.


  1. Enter the processes together with their burst time in step one (bt).
  2. Calculate the waiting time (wt) for each step.
  3. Because the first process won't have to wait, the waiting time for process 1 will be zero, or wt[0] = 0.
  4. Determine all other processes' waiting times, i.e., for process I wt[i] = bt[i-1] + wt[i-1].
  5. Calculate the turnaround time for each process as waiting time + burst time.
  6. Calculate the average delay time as follows: total wait time / number of processes.
  7. Calculate the average turnaround time as follows: total turnaround time / number of procedures.

Program Code:


Processes  Burst time  Waiting time  Turn around time
 1                   10                    0                         10
 2                    5                     10                       15
 3                   8                      15                       23
Average waiting time = 8.33333
Average turn around time = 16
Process executed in 2.11 seconds
Press any key to continue.


  1. Non-preemptive
  2. Average Waiting is not a good idea.
  3. Cannot use resources concurrently: results in the Convoy effect (Take into consideration a scenario where there are several IO-bound processes and one CPU-bound one. When a CPU-bound process acquires CPU, the IO-bound processes must wait for it. Better would have been for the IO-bound activity to use the CPU for a while before switching to IO devices.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA