First Come First Served (FCFS)

First Come First Served (FCFS) is a non-preemptive scheduling algorithm in data structures also known as FIFO (First In, First Out) and FCFC (First Come, First Choice). This algorithm is the easiest to develop and utilize as it is based on the principle that processes/tasks are resolved in order of arrival. 

How FCFS works

A process has three states: running, ready, and blocked. While the first process runs, the second is ready and the remainder of the processes are blocked. This is because the PCB is linked to the tail of the queue and only when the operating CPU is free can it be linked to the next task at the beginning of the line. 

How it’s used

FCFS is used mostly in batch systems, where there is no need for communication between the user and the computer. Examples of FCFS usage are in payroll, generation of bills, and processing customer service requests. In deciding to use FCFS algorithms, the following calculations should be put into consideration: 

  1. Wait times = start time – arrival time/number of tasks or processes. 
  2. Turnaround time = completion time – arrival 

Pros and cons

FCFS ensures that one process does not monopolize the processor. FCFS is non-preemptive allowing it to terminate use when a process is finished and can self-regulate between running and stalling stages, Due to the easy program, it is user-friendly and can be implemented almost anywhere. It is also fair. 

However, due to the sequences’ integrity, FCFS programs often have high wait times. In addition, because it is non-preemptive, there is no sense of priority; smaller important tasks are often stalled behind larger negligible ones. This inefficiency is known as the Convoy Effect and can waste CPU resources. 

Alternatives 

A similar algorithm – Context Switching can be used in place of FCFS. Context Switching allows the CPU to tailor its queue in order of priority and wait time. However, this too can prove to be ineffective if there is a constant flow of tasks to align and adjust while the CPU is running. 

Yemisi Awobode
Yemisi Awobode
Yemisi Awobode is a contributing writer for Webopedia, covering tech topics including computer science and machine learning.

Related Articles

Human Resources Management System

A Human Resources Management System (HRMS) is a software application that supports many functions of a company's Human Resources department, including benefits administration, payroll,...

How To Defend Yourself Against Identity Theft

Almost every worldwide government agency responsible for identity theft issues will tell you the same thing: The first step to fighting identity theft is...

Infographic

An infographic is a visual representation of information or data. It combines the words information and graphic and includes a collection of imagery, charts,...

Phishing

What is phishing? Phishing is a type of cybercrime in which victims are contacted by email, telephone, or text message by an attacker posing as...

Digital Native

The term digital native describes younger generations that grew up in the technology...

Performance Tuning

Businesses are increasing their workloads in ways that can lead to performance issues...

How to Reimage a...

Reimaging is the process of performing a factory reset on a computer, deleting...