Open In App

Relation in FCFS and Preemptive Priority Scheduling Algorithm

Last Updated : 15 Sep, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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. 

PROCESS ARRIVAL TIME BURST TIME
P1 
 

 
10 
 
P2 
 

 

 
P3 
 

 

 
P4 
 

 

 
P5 
 

 

 

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. 

PROCESS ARRIVAL TIME BURST TIME PRIORITY
TOTAL REMAINING
P1 
 

 

 

 

 
P2 
 

 

 

 

 
P3 
 

 

 

 

 
P4 
 

 

 

 

 
P5 
 

 

 

 

 

 

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 : 

S.NO. FIRST COME FIRST SERVE PREEMPTIVE PRIORITY
1. It executes processes in the same sequence as they enter the ready queue. It executes those processes first that have the highest priority.
2. It is a non preemptive process. It is a preemptive process.
3. It is the simple most process of all. It is more complicated to implement.
4. The response and waiting time of the processes that come later increase a lot. It is more effective as the response time and waiting time of the processes decrease significantly.
5. The processes that enter the ready queue last have to wait the most. If the processes at the beginning have a large burst time then the whole system gets delayed. The processes with the lowest priority have to wait the most. They are executed very late even though their burst times may be very small.
6. FCFS acts as a Preemptive Priority Scheduling Algorithm where earlier arrival time has higher priority. Preemptive Priority Scheduling Algorithm acts like FCFS when there are equal priority processes.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads