Relation in FCFS and Preemptive Priority Scheduling Algorithm
Last Updated :
15 Sep, 2021
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 | 0 | 10 |
---|
P2 | 3 | 5 |
---|
P3 | 5 | 2 |
---|
P4 | 6 | 6 |
---|
P5 | 8 | 4 |
---|
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 | 0 | 4 | 4 | 4 |
---|
P2 | 1 | 3 | 3 | 3 |
---|
P3 | 3 | 4 | 4 | 1 |
---|
P4 | 6 | 2 | 2 | 5 |
---|
P5 | 8 | 4 | 4 | 2 |
---|
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. |
---|
Similar Reads
Relation between Preemptive Priority and Round Robin Scheduling Algorithm In this article, we'll try to establish the relation between Round Robin and Preemptive Priority Scheduling Algorithm. Let's discuss the algorithms one by one first and then establish how Round Robin is a special kind of Preemptive Priority Scheduling Algorithm. Prerequisite - CPU Scheduling | Diffe
2 min read
Relation in FCFS and Round Robin Scheduling Algorithm In this article, we'll see how FCFS is special kind of Round Robin Algorithm and Round Robin is special kind of FCFS Algorithm. Also, we will cover the relation with each other. Let's discuss one by one. First Come First Serve (FCFS) Scheduling Algorithm : FCFS is simplest of CPU Scheduling Algorith
3 min read
Difference Between Preemptive and Non-Preemptive CPU Scheduling Algorithms Preemptive scheduling permits a high-priority task to interrupt a running process, When a process transitions from the running to the ready or from the waiting to the ready states, preemptive scheduling is used. Whereas in non-preemptive scheduling, any new process must wait until the running proces
6 min read
Program for Preemptive Priority CPU Scheduling Implementing priority CPU scheduling. In this problem, we are using Min Heap as the data structure for implementing priority scheduling. In this problem smaller numbers denote higher priority. The following functions are used in the given code below: struct process { processID, burst time, response
15+ min read
Preemptive and Non-Preemptive Scheduling In operating systems, scheduling is the method by which processes are given access the CPU. Efficient scheduling is essential for optimal system performance and user experience. There are two primary types of CPU scheduling: preemptive and non-preemptive. Understanding the differences between preemp
5 min read