Here you will learn about difference between preemptive and non-preemptive scheduling in os.
Preemptive Scheduling means once a process started its execution, the currently running process can be paused for a short period of time to handle some other process of higher priority, it means we can preempt the control of CPU from one process to another if required.
A computer system implementing this supports multi-tasking as it gives the user impression that the user can work on multiple processes.
It is practical because if some process of higher priority is encountered then the current process can be paused to handle that process.
Examples:- SRTF, Priority, Round Robin, etc.
Non-Preemptive Scheduling means once a process starts its execution or the CPU is processing a specific process it cannot be halted or in other words we cannot preempt (take control) the CPU to some other process.
A computer system implementing this cannot support the execution of process in a multi task fashion. It executes all the processes in a sequential manner.
It is not practical as all processes are not of same priority and are not always known to the system in advance.
Difference between Preemptive and Non-Preemptive Scheduling in OS
|Preemptive Scheduling||Non-Preemptive Scheduling|
|Processor can be preempted to execute a different process in the middle of execution of any current process.||Once Processor starts to execute a process it must finish it before executing the other. It cannot be paused in middle.|
|CPU utilization is more compared to Non-Preemptive Scheduling.||CPU utilization is less compared to Preemptive Scheduling.|
|Waiting time and Response time is less.||Waiting time and Response time is more.|
|The preemptive scheduling is prioritized. The highest priority process should always be the process that is currently utilized.||When a process enters the state of running, the state of that process is not deleted from the scheduler until it finishes its service time.|
|If a high priority process frequently arrives in the ready queue, low priority process may starve.||If a process with long burst time is running CPU, then another process with less CPU burst time may starve.|
|Preemptive scheduling is flexible.||Non-preemptive scheduling is rigid.|
|Ex:- SRTF, Priority, Round Robin, etc.||Ex:- FCFS, SJF, Priority, etc.|
This article is submitted by Rahul Maheshwari. You can connect with him on facebook.
Comment below if you have any queries related to above tutorial for difference between preemptive and non-preemptive scheduling in os.