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.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.

Related Articles

Virtual Private Network (VPN)

A virtual private network (VPN) encrypts a device's Internet access through a secure server. It is most frequently used for remote employees accessing a...

Gantt Chart

A Gantt chart is a type of bar chart that illustrates a project schedule and shows the dependency between tasks and the current schedule...

Input Sanitization

Input sanitization is a cybersecurity measure of checking, cleaning, and filtering data inputs from users, APIs, and web services of any unwanted characters and...

IT Asset Management Software

IT asset management software (ITAM software) is an application for organizing, recording, and tracking all of an organization s hardware and software assets throughout...

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