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

ScalaHosting

ScalaHosting is a leading managed hosting provider that offers secure, scalable, and affordable cloud VPS solutions for businesses. It claims to change the status...

Data Lake

A data lake is a storage space for all forms of data in an organization, whether raw or processed, structured or unstructured.

Resume

A resume is a formal document created and used by a person to show their career background and skills. Resumes are used for a...

Web Hosting

Web hosting makes a web server available to businesses with varying degrees of provider management. Customers host their websites on the internet through the...

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