×

FCFS Scheduling in OS

FCFS: First Come First Serve Scheduling in OS

FCFS is a non-preemptive and preemptive scheduling algorithm that is easy to understand and use. In this, the process which reaches first is executed first, or in other words, the process which requests first for a CPU gets the CPU first.

Example of FCFS: buying tickets at the ticket counter.

FCFS is similar to the FIFO queue data structure. In FCFS, the element which is added in the queue first will leave first.

FCFS is used in Batch Operating Systems.

Characteristics of FCFS Scheduling

The characteristics of FCFS Scheduling are:

  1. FCFS is simple to use and implement.
  2. In FCFS, jobs are executed in a First-come First-serve (FCFS) manner.
  3. FCFS supports both preemptive as well as non-preemptive scheduling algorithm.
  4. FCFS is poor in performance due to high waiting times.

Advantages of FCFS

The advantages of FCFS are:

  1. Easy to program
  2. First come, first serve
  3. Simple scheduling algorithm.

Disadvantages of FCFS

  1. Because of non-preemptive nature, the problem of starvation arises.
  2. More Average waiting time.
  3. Due to its simplicity, FCFS is not effective.
  4. FCFS is not the ideal scheduling for the time-sharing system.
  5. FCFS is a Non-Preemptive Scheduling algorithm, so allocating the CPU to a process will never release the CPU until it completes its execution.
  6. In FCFS, it is not possible to use the resources in a parallel manner, which causes the convoy effect, so the resource utilization is poor in FCFS.

What is Convoy Effect

In FCFS, Convoy Effect is a condition that arises in the FCFS Scheduling algorithm when one process holds the CPU for a long time, and another process can get the CPU only when the process holding the CPU finishes its execution. Due to this, resource utilization is poor and also affects the performance of the operating system.

Example of FCFS Scheduling

In the following example, we have 4 processes with process ID P0, P1, P2, and P3. The arrival time of P0 is 0, P1 is 1, P2 is 2, and P3 is 3. The arrival time and burst time of the processes are given in the following table.

The waiting time and Turnaround time are calculated with the help of the following formula.

         Waiting Time = Turnaround time – Burst Time

          Turnaround Time = Completion time – Arrival time 

Process ID Arrival Time Burst Time Completion Time Turnaround Time Waiting Time
P0 0 6 6 6 0
P1 1 8 14 13 5
P2 2  10 24 22 12
P3 3 12 36 33 21
FCFS Scheduling in OS

Average Waiting Time = 0+5+12+21/4

                                         = 38/4

                                          = 9.5 ms

Average Turnaround Time = 6+13+22+33/4

                                              =74/4

                                               = 18.5 ms


Related Topics

N-Step-SCAN Disk Scheduling

Before you study about N-Step-SCAN Disk Scheduling, it requires prerequisite of what is Disk Scheduling Algorithms: Operating systems use disc scheduling to schedule I/O requests that arrive at the disc....

4 minutes read.

5 Goals of Operating System

An Operating System (OS) is system software that acts as an interface or bridge between the hardware of a computer and the end user. Operating System reduces the communication barrier between the...

4 minutes read.

Types of Operating System

There are various types of operating system: Simple Batch Operating SystemMultiprogramming batch Operating SystemTime-sharing Operating SystemMultiprocessor Operating SystemDistributed Operating SystemNetwork Operating SystemReal-time Operating SystemMobile Operating System Simple Batch operating system In the simple batch operating system, there is no direct communication between...

6 minutes read.

Process Synchronization | Operating System

Process Synchronization Process Synchronization means managing the process in such a manner so that no two processes have access to share similar data and resources. We can use Process Synchronization in a Multi-Process System...

4 minutes read.

File in Operating System

What is File in Operating System?  A file is defined as a collection of the interrelated information that is stored in the secondary memory or the non-volatile memory such as optical...

4 minutes read.

Banker’s Algorithm in Operating System

What is Banker’s Algorithm? Bankers algorithm is an algorithm which is used for deadlock avoidance and resource allocation. It was established by Edsger Dijkstra. The reason behind the name ‘banker’s algorithm’...

8 minutes read.

Turn Variable or Strict Alternative Approach

Turn Variable or Strict Alternative Approach Turn Variable Approach is used for process synchronization mechanism, which offers synchronization between two processes. Turn variable is implemented on user mode, and it is a software mechanism. We...

3 minutes read.

Swapping in Operating System

Swapping in operating systems refers to temporarily transferring a program or process from main memory to a secondary storage device, such as a hard drive or solid-state drive when there...

4 minutes read.

Contiguous Memory Allocation in Operating System

Memory is a place where data, facts, figures, and information are stored for temporary or permanent access the data in future, which is also considered as the storage place. Allocation of...

4 minutes read.

Segmentation in Operating System

The term segmentation in operating system refers to the division of computer memory into segments. Segmentation is a technique used by many modern operating systems to provide better memory management....

4 minutes read.

Lock Variable Mechanism | Operating System

Lock Variable Mechanism The Lock variable mechanism is a synchronization mechanism that is implemented in a user mode. It is a software procedure. Lock variable is a solution for busy waiting that can be...

3 minutes read.

Virtual Memory in Operating System

What is Virtual Memory Virtual Memory is a storage scheme in which the users have an illusion that users have a significant amount of Main Memory. We can perform this by taking a...

3 minutes read.

Why is it critical for the Scheduler to distinguish between I/O-bound and CPU-bound programs

A CPU-bound process is one that spends most of its time executing instructions on the processor. A process that is I/O-bound spends most of its time waiting for input and...

2 minutes read.

Two Phase Locking Protocol

What is two phase locking? Two-phase locking is a concurrency control method in a database and transaction processing system. It ensures that transactions are executed in a serializable manner by requiring...

4 minutes read.

Resource Allocation Graph in Operating System

Resource Allocation Graph in OS We use the resource allocation graph for the pictographic representation of the state of a system. The resource allocation graph contains all the information related to the processes that...

5 minutes read.

Round-Robin Scheduling Algorithm in OS

Round-Robin is a Preemptive Scheduling Algorithm and is the most commonly used algorithm in CPU Scheduling.In this, each Process is assigned with a fix time interval to execute, which is...

5 minutes read.

Batch Operating System

Computers were once quite huge devices that operated from a console. Tape drives, punch cards, line printers were often utilized for the output, and tape drivers or card readers for...

4 minutes read.

Process Scheduling in Operating System

Process Scheduling is an essential component of a Multiprogramming Operating System. So now let’s understand how it works by taking a real-life example. Suppose that you want to call someone...

6 minutes read.

Multi-user Operating Systems

Introduction Since only one user may interact with the computer at any given time, the operating system we use on our personal computers, laptops, tablets, and phones is sometimes referred to...

8 minutes read.

What is Thread and Types of Thread

What is Thread A thread means a lightweight process. Thread is the basic unit of CPU execution, which consists of thread ID, Program counter, set of registers to hold the information of current...

7 minutes read.