Priority Scheduling program in C

Priority Scheduling program in C

Here you will learn priority scheduling and the example code of priority scheduling program in c programming.


Priority Scheduling Algorithm

Priority scheduling algorithm is a method of scheduling processes based on priority levels. Each process is assigned a priority, and the scheduler allocates the CPU to the process with the highest priority. First come first served (FCFS) scheduling is used when two processes have the same priority.
It is normally implemented in Operating Systems to schedule multiple process entering the CPU for execution. This code is for Priority Scheduling Non – Preemptive Algorithm in C Programming.


In Short:- Priority scheduling is a type of scheduling algorithm where each process is assigned a priority. The highest priority process is executed first. If two processes have the same priority, then they are executed based on the first come, first served principle.


 Priority Scheduling program in C


Types of Priority Scheduling?

Priority Scheduling Preemptive :- In priority scheduling preemptive , the scheduler can interrupt a running process if a higher priority process arrives. This ensures that the most important processes are always given the CPU first. 


Priority Scheduling Non-Preemptive :- In priority scheduling non-preemptive , the scheduler will only run a new process if the current process is finished. This can lead to lower priority processes never getting the CPU, which is why preemptive priority scheduling is generally preferred.


Priority Scheduling program in C


Enter the number of process : 4

Enter process : time priorities

Process no 1 : 3

Process no 2 : 4

Process no 3 : 5

Process no 4 : 6


JobBrust TimeWait TimeTurn Around TimePriority


Average Wait Time : 8

Average Turn Around Time : 12



Read Also

SJF Scheduling Program in C




Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top