---
description: What is First Come First Serve Method? FCFS is an operating system scheduling algorithm that automatically executes queued requests and processes in order of their arrival. It is the easiest and simpl
title: FCFS Scheduling Algorithm: What is, Example Program
image: https://www.guru99.com/images/1/122319_0725_FCFSSchedul1.png
---

 

[Skip to content](#main) 

## What is First Come First Serve Method?

**First Come First Serve (FCFS)** is an operating system scheduling algorithm that automatically executes queued requests and processes in order of their arrival. It is the easiest and simplest CPU scheduling algorithm. In this type of algorithm, processes which requests the CPU first get the CPU allocation first. This is managed with a FIFO queue. The full form of FCFS is First Come First Serve. 

As the process enters the ready queue, its PCB (Process Control Block) is linked with the tail of the queue and, when the CPU becomes free, it should be assigned to the process at the beginning of the queue.

## Characteristics of FCFS method

* It supports non-preemptive and pre-emptive scheduling algorithm.
* Jobs are always executed on a first-come, first-serve basis.
* It is easy to implement and use.
* This method is poor in performance, and the general wait time is quite high.

## Example of FCFS scheduling

A real-life example of the FCFS method is buying a movie ticket on the ticket counter. In this scheduling algorithm, a person is served according to the queue manner. The person who arrives first in the queue first buys the ticket and then the next one. This will continue until the last person in the queue purchases the ticket. Using this algorithm, the CPU process works in a similar manner.

## How FCFS Works? Calculating Average Waiting Time

Here is an example of five processes arriving at different times. Each process has a different burst time.

| Process | Burst time | Arrival time |
| ------- | ---------- | ------------ |
| P1      | 6          | 2            |
| P2      | 2          | 5            |
| P3      | 8          | 1            |
| P4      | 3          | 0            |
| P5      | 4          | 4            |

### RELATED ARTICLES

* [32 Bit vs 64 Bit – Difference Between Them ](https://www.guru99.com/32-bit-vs-64-bit-operating-systems.html "32 Bit vs 64 Bit – Difference Between Them")
* [Process vs Thread – Difference Between Them ](https://www.guru99.com/difference-between-process-and-thread.html "Process vs Thread – Difference Between Them")
* [CPU Scheduling Algorithms in Operating Systems ](https://www.guru99.com/cpu-scheduling-algorithms.html "CPU Scheduling Algorithms in Operating Systems")
* [Memory Management in OS: Contiguous, Swapping, Fragmentation ](https://www.guru99.com/os-memory-management.html "Memory Management in OS: Contiguous, Swapping, Fragmentation")

Using the FCFS scheduling algorithm, these processes are handled as follows.

**Step 1)** The process begins with P4 which has arrival time 0

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul1.png)

**Step 2)** At time=1, P3 arrives. P4 is still executing. Hence, P3 is kept in a queue.

| Process | Burst time | Arrival time |
| ------- | ---------- | ------------ |
| P1      | 6          | 2            |
| P2      | 2          | 5            |
| P3      | 8          | 1            |
| P4      | 3          | 0            |
| P5      | 4          | 4            |

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul2.png)

**Step 3)** At time= 2, P1 arrives which is kept in the queue.

| Process | Burst time | Arrival time |
| ------- | ---------- | ------------ |
| P1      | 6          | 2            |
| P2      | 2          | 5            |
| P3      | 8          | 1            |
| P4      | 3          | 0            |
| P5      | 4          | 4            |

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul3.png)

**Step 4)** At time=3, P4 process completes its execution.

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul4.png)

**Step 5)** At time=4, P3, which is first in the queue, starts execution.

| Process | Burst time | Arrival time |
| ------- | ---------- | ------------ |
| P1      | 6          | 2            |
| P2      | 2          | 5            |
| P3      | 8          | 1            |
| P4      | 3          | 0            |
| P5      | 4          | 4            |

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul5.png)

**Step 6)** At time =5, P2 arrives, and it is kept in a queue.

| Process | Burst time | Arrival time |
| ------- | ---------- | ------------ |
| P1      | 6          | 2            |
| P2      | 2          | 5            |
| P3      | 8          | 1            |
| P4      | 3          | 0            |
| P5      | 4          | 4            |

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul6.png)

**Step 7)** At time 11, P3 completes its execution.

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul7.png)

**Step 8)** At time=11, P1 starts execution. It has a burst time of 6\. It completes execution at time interval 17

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul8.png)

**Step 9)** At time=17, P5 starts execution. It has a burst time of 4\. It completes execution at time=21

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul9.png)

**Step 10)** At time=21, P2 starts execution. It has a burst time of 2\. It completes execution at time interval 23

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul10.png)

**Step 11)** Let’s calculate the average waiting time for above example.

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul11.png)

Waiting time = Start time - Arrival time

P4 = 0-0 = 0

P3 = 3-1 = 2

PI = 11-2 = 9

P5= 17-4 = 13

P2= 21-5= 16

Average Waiting Time

[](https://www.guru99.com/images/1/122319%5F0725%5FFCFSSchedul12.png)  
\= 40/5= 8

## Advantages of FCFS

Here, are pros/benefits of using FCFS scheduling algorithm:

* The simplest form of a [CPU scheduling algorithm](https://www.guru99.com/cpu-scheduling-algorithms.html)
* Easy to program
* First come first served

## Disadvantages of FCFS

Here, are cons/ drawbacks of using FCFS scheduling algorithm:

* It is a Non-Preemptive CPU scheduling algorithm, so after the process has been allocated to the CPU, it will never release the CPU until it finishes executing.
* The Average Waiting Time is high.
* Short processes that are at the back of the queue have to wait for the long process at the front to finish.
* Not an ideal technique for time-sharing systems.
* Because of its simplicity, FCFS is not very efficient.

## Summary

* Definition: FCFS is an operating system scheduling algorithm that automatically executes queued requests and processes by order of their arrival
* It supports non-preemptive and pre-emptive scheduling
* algorithm.
* FCFS stands for First Come First Serve
* A real-life example of the FCFS method is buying a movie ticket on the ticket counter.
* It is the simplest form of a CPU scheduling algorithm
* It is a Non-Preemptive CPU scheduling algorithm, so after the process has been allocated to the CPU, it will never release the CPU until it finishes executing.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/fcfs-scheduling.png","url":"https://www.guru99.com/images/fcfs-scheduling.png","width":"551","height":"150","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/fcfs-scheduling.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/operating-system","name":"Operating System"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/fcfs-scheduling.html","name":"FCFS Scheduling Algorithm: What is, Example Program"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/fcfs-scheduling.html#webpage","url":"https://www.guru99.com/fcfs-scheduling.html","name":"FCFS Scheduling Algorithm: What is, Example Program","dateModified":"2024-08-12T16:58:31+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/fcfs-scheduling.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/fcfs-scheduling.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/nathaniel","name":"Nathaniel Brooks","description":"I'm Nathaniel Brooks, a seasoned professional in OS tutorials, specializing in creating comprehensive guides to help you master your operating system skills.","url":"https://www.guru99.com/author/nathaniel","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/nathaniel-brooks-author.png","url":"https://www.guru99.com/images/nathaniel-brooks-author.png","caption":"Nathaniel Brooks","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"@type":"Article","headline":"FCFS Scheduling Algorithm: What is, Example Program","description":"What is First Come First Serve Method? FCFS is an operating system scheduling algorithm that automatically executes queued requests and processes in order of their arrival. It is the easiest and simpl","author":{"@id":"https://www.guru99.com/author/nathaniel","name":"Nathaniel Brooks"},"copyrightYear":"2024","name":"FCFS Scheduling Algorithm: What is, Example Program","articleSection":"Operating System","subjectOf":[{"@type":"HowTo","name":"How FCFS Works? ","description":"Here is an example of five processes arriving at different times. Each process has a different burst time.","step":[{"@type":"HowToStep","name":"The process begins with P4","text":"which has arrival time 0","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul1.png","url":"https://www.guru99.com/fcfs-scheduling.html#step1"},{"@type":"HowToStep","name":"At time=1, P3 arrives. P4 is still executing.","text":"Hence, P3 is kept in a queue.","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul2.png","url":"https://www.guru99.com/fcfs-scheduling.html#step2"},{"@type":"HowToStep","name":"At time= 2,","text":"P1 arrives which is kept in the queue.","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul3.png","url":"https://www.guru99.com/fcfs-scheduling.html#step3"},{"@type":"HowToStep","name":"At time=3,","text":"P4 process completes its execution.","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul4.png","url":"https://www.guru99.com/fcfs-scheduling.html#step4"},{"@type":"HowToStep","name":"At time=4, P3, ","text":"which is first in the queue, starts execution.","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul5.png","url":"https://www.guru99.com/fcfs-scheduling.html#step5"},{"@type":"HowToStep","name":"At time =5,","text":"P2 arrives, and it is kept in a queue.","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul6.png","url":"https://www.guru99.com/fcfs-scheduling.html#step6"},{"@type":"HowToStep","name":"At time 11,","text":"P3 completes its execution.","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul7.png","url":"https://www.guru99.com/fcfs-scheduling.html#step7"},{"@type":"HowToStep","name":"At time=11, P1 starts execution.","text":"It has a burst time of 6. It completes execution at time interval 17","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul8.png","url":"https://www.guru99.com/fcfs-scheduling.html#step8"},{"@type":"HowToStep","name":"At time=17, P5 starts execution.","text":"It has a burst time of 4. It completes execution at time=21","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul9.png","url":"https://www.guru99.com/fcfs-scheduling.html#step9"},{"@type":"HowToStep","name":"At time=21, P2 starts execution.","text":"It has a burst time of 2. It completes execution at time interval 23","image":"https://www.guru99.com/images/1/122319_0725_FCFSSchedul10.png","url":"https://www.guru99.com/fcfs-scheduling.html#step10"}]}],"@id":"https://www.guru99.com/fcfs-scheduling.html#schema-522674","isPartOf":{"@id":"https://www.guru99.com/fcfs-scheduling.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"image":{"@id":"https://www.guru99.com/images/fcfs-scheduling.png"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/fcfs-scheduling.html#webpage"}}]}
```
