First Come First Served Process Scheduling FCFS in operating systems

In this tutorial, we will learn about First Come First Served Scheduling (FCFS).

FCFS is a non-preemptive scheduling algorithm so processes priority does not matter.

Disadvantages of FCFS

  • FCFS is a Non-Preemptive CPU scheduling algorithm, so the winner process will not release the CPU and other resources by itself until it finishes its complete execution.
  • Not an ideal technique for time-sharing systems.
  • FCFS is not very efficient as compared to the other scheduling algorithms.
  • If the process first arrived is a big process with a high burst time, then other processes with less burst time need to wait.
  • The average wait time is high.

Advantages of FCFS

  • Easy to implement.
  • Easy to understand.
  • FCFS algorithm is the simplest than all other CPU scheduling algorithms.
  • Very Easy to program.
Process Burst Time Arrival
P1 4 2nd
P2 2 3rd
P3 8 1st
P4 3 4th

Gantt Chart of First Come, First Served (FCFS) Scheduling

FCFS Algo in os
Figure: FCFS.
Process Waiting Time
P1 8
P2 12
P3 0
P4 14

Average Wait Time: (0+8+12+14) / 4 = 8.5

How to calculate turn around time?

TurnAroundTime=BurstTime+WaitingTime.

First Come First Served (FCFS) Program in C++

FCFS Process Scheduling Implementation in C++ by using Virtual Function

Let’s see the FCFS Process Scheduling Implementation in C++ by using Virtual Function.

 

Output

FCFS Process Scheduling Implementation in C++ by using Virtual Function
Figure: FCFS Process Scheduling Implementation in C++ by using Virtual Function

FCFS Code using Inheritance of Classes

FCFS Program Using Virtual Function

Let’s see the FCFS Program Using Virtual Function.

FCFS using JAVA

This is the code of FCFS using JAVA.

Video Lecture

Frequently Asked Questions (FAQ)

The first-come, first-served (FCFS) algorithm is fine for most ____ systems.
A). batch
B). user initiated
C). interactive
D). multiuser
Best Answer: A. Batch

Explain why ssds often use an fcfs disk-scheduling algorithm?
ssds do not have any any moveable part or rotating disk. This makes the ssds to use the algorithm of fcfs (first come first serve).

What is the average turnaround time for these processes with the FCFS scheduling algorithm?

Gantt Chart for FCFS

Process:   1               2       3

|—————|——-|–|

Time:      0               8       12 13

Average Turnaround Time: ( (8-0)+(12-0.4)+(13-1.0) ) / 3 = 10.53

Is starvation possible in FCFS?
It is possible that starvation may occur in the fcfs disk-scheduling discipline.
First-come, first-served (FCFS) scheduling can cause short processes to wait for a very long time due to big processes. So, we can consider that SJF and priority scheduling may leads to a condition of resources starvation.

What does FCFS mean on Facebook?
FCFS means the buyer who request first to show interest to pay and pick up and to get the item. The seller of the product won’t hold the item at all.