Non-Preemptive Priority Scheduling Algorithm: Process Scheduling Based on Priority

Learn about the non-preemptive priority scheduling algorithm, a CPU scheduling method that prioritizes processes based on their assigned priority levels. This guide explains its operation, compares it to preemptive priority scheduling, and analyzes its impact on process waiting times.



Non-Preemptive Priority Scheduling Algorithm

Understanding Non-Preemptive Priority Scheduling

Non-preemptive priority scheduling is a CPU scheduling algorithm that prioritizes processes based on their assigned priority levels. Once a process begins execution, it continues until it completes its CPU burst (completes its execution) or blocks (e.g., waits for I/O). Unlike preemptive priority scheduling, a higher-priority process cannot interrupt a currently running process. This simplicity reduces scheduling overhead but can lead to longer waiting times for lower-priority processes.

Priority Assignment

Each process is assigned a priority number. The meaning of the priority number (lower number = higher priority or higher number = higher priority) is defined by the system. Priority can be:

  • Static: The priority remains the same throughout the process's lifetime.
  • Dynamic: The priority changes during the process's lifetime (e.g., based on waiting time).

Example: Non-Preemptive Priority Scheduling

Let's consider seven processes (P1-P7) with their priorities, arrival times, and burst times:

Process ID Priority Arrival Time Burst Time
P1 2 0 3
P2 6 2 5
P3 3 1 4
P4 5 4 2
P5 7 6 9
P6 4 5 4
P7 1 10 7

(A Gantt chart illustrating the scheduling sequence would be added here.)

The processes are scheduled according to their priority (lower number = higher priority). If processes have the same priority, the one with the earliest arrival time is scheduled first.

Process ID Priority Arrival Time Burst Time Completion Time Turnaround Time Waiting Time Response Time
P1 2 0 3 3 3 0 0
P3 3 1 4 7 6 2 1
P6 4 5 4 13 9 5 10
P4 5 4 2 13 11 11 9
P2 6 2 5 18 13 8 11
P5 7 6 9 27 18 9 22
P7 1 10 7 37 30 23 27

Average Waiting Time = (0+2+5+11+18+9+23)/7 = 70/7 = 10