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. 

Web Websterhttp://www.webopedia.com
Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and healthcare, as well as Dotdash’s Lifewire.com. In addition to editing webopedia.com, he edits and writes for a portfolio of tech industry news and analysis websites including LinuxToday.com, and DatabaseJournal.com.

Top Articles

List of Windows Operating System Versions & History [In Order]

The Windows operating system (Windows OS) refers to a family of operating systems developed by Microsoft Corporation. We look at the history of Windows...

How to Create a Website Shortcut on Your Desktop

Website Shortcut on Your Desktop reviewed by Web Webster   This Webopedia guide will show you how to create a website shortcut on your desktop using...

What are the Five Generations of Computers? (1st to 5th)

Reviewed by Web Webster Each generation of computer has brought significant advances in speed and power to computing tasks. Learn about each of the...

Hotmail [Outlook] Email Accounts

Launched in 1996, Hotmail was one of the first public webmail services that could be accessed from any web browser. At its...

How to Reimage a...

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

LED

A light emitting diode (LED) is an electronic component that emits (gives off)...

How to Clean a...

The hard disk drive within a computer stores all of the device's persistent,...