×

Operating System Tutorial

Operating System Practice

FCFS: First Come First Serve Scheduling Algorithm

In this tutorial, we will learn about the FCFS, i.e. First Come First Serve Scheduling Algorithm with the help of example. By Monika Sharma Last updated : May 06, 2023

What is First Come First Serve Scheduling (FCFS) Algorithm?

The FCFS, which stands for First Come First Serve Scheduling Algorithm, is a non-preemptive scheduling algorithm, which means that if a process once starts executing in the processor, then it cannot be preempted in between the processing. Thus, the concept of priority and urgency is not implemented by this type of algorithm. In the FCFS algorithm, the process gets executed in the same sequence in which they enter the Ready state. It simply follows the strategy of "First come First serve with special services provided to none."

FCFS Algorithm Example

Now let us try to understand this further with the help of an example.

Suppose there are four processes with process ID's P1, P2, P3, and P4 and they enter into the CPU as follows:

Process ID Arrival Time
(milliseconds)
Burst Time
(milliseconds)
P105
P223
P362
P473

So, if the OS follows the FCFS algorithm for scheduling these processes, then they will be executed in the following manner:

Gant Chart

FCFS algorithm FCFS algorithm
Total Turn around Time = 5 + 6 + 4 + 6
        = 21 milliseconds
Average Turn Around Time= Total Turn Around Time / Total No. of Processes
        = 21 / 4
        = 5.25 milliseconds

Total Waiting Time = 0 + 3 + 2 + 3
        = 8 milliseconds
Average Waiting Time = Total Waiting Time / Total No. of Processes
        = 8 / 4
        = 2 milliseconds



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.