Priority Process Scheduling Algorithm
Dr. Shashi Kant Gupta
Professor, Department of CSA
Outlines
• Prerequisite of topic
• Problem Objective
• Basics
• Types
• When AT is not Given
• When AT is given
• Examples
• Assignment
• Learning Outcomes
1
Prerequisite of Topic
• Basic Concept of Operating System
• Services of operating System
• Process Concept
• Schedulers
• Process Scheduling Criteria
• SJF Preemptive scheduling
• FCFS Scheduling
Problem Objective
• Understand about the Process Scheduling
• PriorityAlgorithm
• Examples of PriorityAlgorithm
Basics
• In case of priority scheduling the priority is not always set as the inverse
of the CPU burst time, rather it can be internally or externally set.
• Processes with same priority are executed in FCFS manner.
• The priority of process, when internally defined, can be decided based
on memory requirements, time limits ,number of open files, ratio of
I/O burst to CPU burst etc.
• External priorities are set based on criteria outside the operating system,
like the importance of the process, funds paid for the computer resource
use etc.
SELO: 5,8,9 Reference No.: R1, R2
Types
• Priority scheduling can be of two types:
• Preemptive Priority Scheduling:
• Non-Preemptive Priority Scheduling:
SELO: 5,8,9 Reference No.: R1, R2
Problem with Priority Scheduling Algorithm
• the chances of indefinite blocking or starvation.
• Aprocess is considered blocked when it is ready to run but has to
wait for the CPU as some other process is running currently.
• To prevent starvation of any process, we can use the concept
of aging where we keep on increasing the priority of low-priority
process based on the its waiting time.
SELO: 5,8,9 Reference No.: R1, R2
Advantages
• The priority of a process can be selected based on
• memory requirement,
• time requirement or
• user preference.
SELO: 5,8,9 Reference No.: R1, R2
Disadvantages
• A second scheduling algorithm is required to schedule the processes
which have same priority.
• In preemptive priority scheduling, a higher priority process can
execute ahead of an already executing lower priority process.
• If lower priority process keeps waiting for higher priority processes,
starvation occurs.
SELO: 5,8,9 Reference No.: R1, R2
Learning Outcomes
After this Lecture students are able to:
• Process Scheduling
• PriorityAlgorithm working
• Difference between Priority and SJF
SELO: 5,8,9 Reference No.: R1, R2
Assignment
• Given 4 Processes
Process Arrival Time Burst Time Priority
(msec) (msec)
P1 0 15 2
P2 1 7 1
P3 2 12 2
P4 3 5 3
• Apply Priority algorithm and Find the AWT and ATT
References
1. A. Silberschatz, P. B. Galvin, G. Gagne; Operating System
Concepts; Wiley Publishing.
2. A. S. Tanenbaum; Modern Operating System; PHI Publication.
SELO
5. Design Thinking ability
8. Ability to understand subject related concepts clearly along
with contemporary issues.
9. Application of concepts of topic and its technological
applications