Priority Scheduling Algorithm C Program

By | September 6, 2016

Let us learn how to implement priority scheduling algorithm in C programming with its explanation, output, advantages, disadvantages and much more.

What is Non-Preemptive Priority Scheduling Algorithm?

The priority scheduling algorithm is one of the most common algorithms for scheduling jobs in batch systems.

Every process is assigned a number which denotes the priority, and based on this priority the processes are executed. Therefore, the process having the highest priority (1) is executed first and then the priority 2, 3 and so on.

There can be some scenarios where more two or more processes may have the same priority. In this case, the processes are executed based on First In First Out order or in other words, First Come First Serve.

We do not consider the arrival time of the jobs in this non-preemptive priority scheduling algorithm. This means that unless a job gets completely executed, the CPU won’t leave the current job before it completes its execution.

Only once the process gets out of the job queue after successful execution, the CPU is allowed to process another job from the queue.


  • This algorithm is very simple to implement.
  • The aging technique is implemented to reduce the starvation of lower priority processes.


  • Starvation or indefinite blockage of the lower priority processes.
  • Since this is a non-preemptive implementation, the waiting time is comparatively higher.
  • The average turnaround time is higher as compared to the preemptive priority scheduling algorithm.
  • If a system failure occurs, all the unfinished lower priority jobs get vanished from the system.

Note: This implementation of non-preemptive priority scheduling program in C without arrival time is compiled with GNU GCC compiler using Linux terminal on Linux Ubuntu operating system.

C Program To Implement Non-Preemptive Priority Scheduling Algorithm


C Program For Priority Scheduling Algorithm with Non - Preemptive Algorithm and Explanation

If you have any doubts about the implementation of non-preemptive priority scheduling in C programming, let us know about it in the comment section. For more details, check Wikipedia.

CPU Scheduling Algorithms
Preemptive Shortest Job First Algorithm
Circular SCAN Scheduling Algorithm
FCFS Scheduling Algorithm
Round Robin Algorithm
Multi-Level Feedback Queue Algorithm
SCAN Disk Scheduling Algorithm
Shortest Job First Algorithm
Shortest Seek Time First Algorithm
Preemptive Priority Algorithm

7 thoughts on “Priority Scheduling Algorithm C Program

  1. Javed Ali

    This is just a fantastic and so self – explanatory code for Priority Scheduling! Thanks a lot.

  2. Raju Saigal

    The priority scheduling concept truly relates to real life task scheduling.

  3. Vineeth Daniel

    The main issue with Priority Scheduling algorithm is Starvation, also called as Indefinite Blocking. It is overcome by Aging method where priorities are automatically decreased or increased based on the situation.

  4. Amit Singh

    Do you have a program relating to the concept of Aging in C language . If yes , then mail it to me .


Let's Discuss