Get the best out of our app
GeeksforGeeks App
Open App
Browser
Continue

# Relation in FCFS and Preemptive Priority Scheduling Algorithm

In this article, we will see how FCFS is a special kind of Priority Preemptive Scheduling Algorithm. Also, we will cover the relation with each other. Let us discuss one by one.

1. First Come First Serve (FCFS) Scheduling Algorithm :
FCFS is the simplest of CPU Scheduling Algorithm which executes the process that comes first. It is a non-preemptive algorithm. The process that arrives first in the ready queue gets to be executed by the CPU first, then the second one, then the third one, and so on. The arrival time of processes is the deciding factor here. Ready queue acts like FIFO (First In First Out) queue.

Example –
Here is a list of processes, their arrival time, and burst time. The Gantt Chart shows how they are executed.

As the processes approach in the ready queue, they are sent one by one to the CPU to be executed. Until and unless the first arriving process completes its execution, the next one does not get a chance.

2. Preemptive Priority Scheduling Algorithm :
In Preemptive Priority Scheduling Algorithm, the processes come with a priority attached to them. The lower the priority number, the higher is the priority attached to the process. A process with higher priority on its arrival preempts an ongoing process. It gets the CPU. The process with priority 1 always gets the CPU whenever it arrives and is never preempted. It has a response time of 0. Equal priority processes are scheduled in the FCFS order.

Example –
Here is a list of processes, their arrival time, and burst time. The Gantt Chart shows how they are executed.

FCFS is a special kind of Preemptive Priority Scheduling Algorithm :
FCFS executes the process that appears first in the ready queue. That means it attaches priority to the arrival time of the process. The process that comes first gets higher priority over the other processes and hence gets the CPU first. So, we say FCFS is a special kind of Preemptive Priority Scheduling Algorithm where earlier arrival time has a higher priority.

Preemptive Priority is a special kind of FCFS Scheduling Algorithm :
Preemptive Priority Scheduling Algorithm acts like FCFS when there are equal priority processes. If two processes have the same priority, the process with the earlier arrival time will be executed first. So, we say Preemptive Priority is a special kind of FCFS Scheduling Algorithm.

Difference between FCFS and Preemptive Priority Scheduling Algorithm :

My Personal Notes arrow_drop_up