Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems. Each process is assigned a priority. Process with the highest priority is to be executed first and so on.
Processes with the same priority are executed on first come first served basis. Priority can be decided based on memory requirements, time requirements or any other resource requirement.
1- First input the processes with their burst time and priority. 2- Sort the processes, burst time and priority according to the priority. 3- Now simply apply FCFS algorithm.
Note: A major problem with priority scheduling is indefinite blocking or starvation. A solution to the problem of indefinite blockage of the low-priority process is aging. Aging is a technique of gradually increasing the priority of processes that wait in the system for a long period of time.
Order in which processes gets executed 1 3 2 Processes Burst time Waiting time Turn around time 1 10 0 10 3 8 10 18 2 5 18 23 Average waiting time = 9.33333 Average turn around time = 17
In this post, the processes with arrival time 0 are discussed. In next set, we will be considering different arrival times to evaluate waiting times.
This article is contributed by Sahil Chhabra (akku). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Program for Preemptive Priority CPU Scheduling
- Operating System | Priority Scheduling with different arrival time - Set 2
- What’s difference between Priority Inversion and Priority Inheritance ?
- Program for FCFS Scheduling | Set 1
- Program for Round Robin scheduling | Set 1
- Program for Shortest Job First (SJF) scheduling | Set 2 (Preemptive)
- Program for Shortest Job First (or SJF) scheduling | Set 1 (Non- preemptive)
- Program for SSTF disk scheduling algorithm
- Program for FCFS Scheduling | Set 2 (Processes with different arrival times)
- CPU Scheduling | Longest Remaining Time First (LRTF) Program
- Priority Inversion : What the heck !
- Disk Scheduling Algorithms
- Operating Systems | CPU Scheduling | Question 1
- Operating Systems | CPU Scheduling | Question 2
- Operating Systems | CPU Scheduling | Question 5
Improved By : SHUBHAMSINGH10