Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

8/11/2021 Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

Preemptive and Non-Preemptive Scheduling


Difficulty Level :
Easy ● Last Updated :
06 Aug, 2021

Prerequisite – CPU Scheduling 

1. Preemptive Scheduling : 

Preemptive scheduling is used when a process switches from running state to ready state

or from waiting state to ready state. The resources (mainly CPU cycles) are allocated to

the process for the limited amount of time and then is taken away, and the process is

again placed back in the ready queue if that process still has CPU burst time remaining.

That process stays in ready queue till it gets next chance to execute. 

Algorithms based on preemptive scheduling are: Round Robin (RR),Shor test Remaining

Time First (SRTF), Priority (preemptive version), etc. 

2. Non-Preemptive Scheduling : 

Non-preemptive Scheduling is used when a process terminates, or a process switches


We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
site, you
acknowledge that you have read and understood our
Cookie
from running to waiting state. In this scheduling, ▲ Policy &
Privacy Policy
once the resources (CPU cycles) is

https://www.geeksforgeeks.org/preemptive-and-non-preemptive-scheduling/ 1/7
8/11/2021 Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

allocated to a process, the process holds the CPU till it gets terminated or it reaches a

waiting state. In case of non-preemptive scheduling does not interrupt a process running

CPU in middle of the execution. Instead, it waits till the process complete its CPU burst

time and then it can allocate the CPU to another process. 

Ad

Jumpstart your App Development

Algorithms based on non-preemptive scheduling are: Shor test Job First (S JF basically

non preemptive) and Priority (non preemptive version), etc. 

Key Differences Between Preemptive and Non-Preemptive Scheduling :  

1. In preemptive scheduling the CPU is allocated to the processes for the limited time

whereas in Non-preemptive scheduling, the CPU is allocated to the process till it

We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
terminates or switches to waiting state. 
site, you
acknowledge that you have read and understood our
Cookie
▲ Policy &
Privacy Policy

https://www.geeksforgeeks.org/preemptive-and-non-preemptive-scheduling/ 2/7
8/11/2021 Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

2. The executing process in preemptive scheduling is interrupted in the middle of

execution when higher priority one comes whereas, the executing process in non-

preemptive scheduling is not interrupted in the middle of execution and wait till its

execution. 

3. In Preemptive Scheduling, there is the overhead of switching the process from ready

state to running state, vise-verse, and maintaining the ready queue. Whereas in case

of non-preemptive scheduling has no overhead of switching the process from running

state to ready state. 

4. In preemptive scheduling, if a high priority process frequently arrives in the ready

queue then the process with low priority has to wait for a long, and it may have to

star ve. On the other hands, in the non-preemptive scheduling, if CPU is allocated to

the process having larger burst time then the processes with small burst time may

have to star ve. 

5. Preemptive scheduling attain flexible by allowing the critical processes to access CPU

as they arrive into the ready queue, no matter what process is executing currently.

Non-preemptive scheduling is called rigid as even if a critical process enters the ready

queue the process running CPU is not disturbed. 

6. The Preemptive Scheduling has to maintain the integrity of shared data that ’s why it is

cost associative as it which is not the case with Non-preemptive Scheduling.

Comparison Char t :  

Parameter PREEMPTIVE SCHEDULING NON-PREEMPTIVE SCHEDULING

Basic In this resources(CPU Cycle) Once resources(CPU Cycle) are allocated

are allocated to a process for a to a process, the process holds it till it

limited time. completes its burst time or switches to

waiting state.

Interrupt Process can be interrupted in Process can not be interrupted until it

between. terminates itself or its time is up.

Star vation If a process having high If a process with long burst time is

Related Articles priority frequently arrives in running CPU, then later coming process

the ready queue, low priority with less CPU burst time may star ve.

We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
site, you
acknowledgeprocess may star ve.
that you have read and understood our
Cookie
▲ Policy &
Privacy Policy

https://www.geeksforgeeks.org/preemptive-and-non-preemptive-scheduling/ 3/7
8/11/2021 Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

Parameter PREEMPTIVE SCHEDULING NON-PREEMPTIVE SCHEDULING

Overhead It has overheads of scheduling It does not have overheads.

the processes.

Flexibility flexible rigid

Cost cost associated no cost associated

CPU In preemptive scheduling, CPU It is low in non preemptive scheduling.

Utilization utilization is high.

Examples Examples of preemptive Examples of non-preemptive scheduling

scheduling are Round Robin are First Come First Ser ve and Shor test

and Shor test Remaining Time Job First.

First.

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual

exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

Like 0

Previous Next

We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
RECOMMENDED ARTICLES
site, you
acknowledge that you have read and understood our
Cookie
▲ Policy &
Privacy Policy Page : 1 2 3
https://www.geeksforgeeks.org/preemptive-and-non-preemptive-scheduling/ 4/7
8/11/2021 Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

Difference between Preemptive Relation between Preemptive


01 05
Priority based and Non-preemptive Priority and Round Robin
Priority based CPU scheduling Scheduling Algorithm
algorithms 29, Sep 20

20, Apr 20

Program for Shortest Job First (or


06
Difference between Preemptive and SJF) CPU Scheduling | Set 1 (Non-
02
Non-preemptive CPU scheduling preemptive)
algorithms 24, Feb 17

01, Apr 20

Program for Preemptive Priority


07
Difference between Preemptive and CPU Scheduling
03
Non-Preemptive Kernel in OS 23, May 18

01, Feb 21

Shortest Job First (or SJF) CPU


08
Relation in FCFS and Preemptive Scheduling Non-preemptive
04
Priority Scheduling Algorithm algorithm using Segment Tree
09, Sep 20 03, Mar 20

Ar ticle Contributed By :

Ankit_Bisht
@Ankit_Bisht

Vote for difficulty

Current difficulty :
Easy

Easy Normal Medium Hard Expert

Improved By : niharika3, ashushrma378, kajalshekhawat06, anikaseth98

Article Tags : Operating Systems-CPU Scheduling, GATE CS, Operating Systems,


We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
Technical Scripter
site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy

https://www.geeksforgeeks.org/preemptive-and-non-preemptive-scheduling/ 5/7
8/11/2021 Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

Practice Tags : Operating Systems

Improve Article Report Issue

Writing code in comment?


Please use ide.geeksforgeeks.org,
generate link and share the link here.

Load Comments

5th Floor, A-118,

Sector-136, Noida, Uttar Pradesh - 201305


feedback@geeksforgeeks.org

Company Learn
About Us Algorithms
Careers Data Structures
Privacy Policy Languages
Contact Us CS
Subjects
Copyright Policy Video Tutorials

Practice Contribute
Courses Write an Article
Company-wise Write Interview
Experience
Topic-wise Internships
How to begin? Videos
We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
@geeksforgeeks
, Some rights reserved

https://www.geeksforgeeks.org/preemptive-and-non-preemptive-scheduling/ 6/7
8/11/2021 Preemptive and Non-Preemptive Scheduling - GeeksforGeeks

https://www.geeksforgeeks.org/preemptive-and-non-preemptive-scheduling/ 7/7

You might also like