What is a non-preemptive priority scheduling algorithm?

Operating Systems use various scheduling algorithms to schedule the execution of different processes on the CPU, and priority schedulingPriority Scheduling is a method of scheduling processes that is based on priority. In this algorithm, the scheduler selects the tasks to work as per the priority. is one of them.

The priority scheduling algorithm is further divided into two following types:

  • Preemptive priority scheduling

  • Non-preemptive priority scheduling

Note: Learn more about preemptive priority scheduling, click here.

In this answer, we'll discuss the non-preemptive priority scheduling algorithm.

Methodology

In non-preemptive priority scheduling, the CPU gets allocated to a specific process based on the priority numbers assigned. After the CPU allocation, it will only be released by context switching or terminating the process. This scheduling is widely used for various hardware platforms because it doesn't require any special hardware (timer etc.) like preemptive scheduling.

Note: Process with less priority number will get CPU allocation first.

Process priority numbers are of two types:

Types of priority numbers
  • Static priority: The priority number is static if the assigned priority number doesn't change itself throughout the process.

  • Dynamic priority: The priority number is dynamic if the assigned priority number change itself throughout the process.

Example

Suppose we've got seven following processes with their priority number and arrival time given; let's schedule them using a non-preemptive priority scheduling:

Numerical Example

Process

Arrival Time

Burst Time

Priority No

P1

0

3

2

P2

2

5

6

P3

1

4

3

P4

4

2

5

P5

6

9

7

P6

5

4

4

P7

7

10

10

Solution

Let's handle this process scheduling using non-preemptive priority scheduling. Here’s a step-by-step execution:

  1. P1 arrives at the time == 0 with the burst time 3 units and priority 2. Since the process queue is empty at that time because no other process arrives yet, OS will schedule this process immediately.

  2. While the execution of P1, two new processes P2 and P3 arrived, the priority of P3 is 3 hence it will get CPU allocation over P3 and P2.

  3. While the execution of P3, all other processes get ready in the ready queue.Ready queue is the queue in which processes wait for CPU time. Now, the process with the lowest priority number among all processes will get allocated that is P6 has priority number 4 , and it will get executed after P3.

  4. When P6 gets executed, P4 has the lowest priority among all remaining processes, it will get executed till complete execution.

The same process (step1 - step4) continue until the completion of all processes execution, according to their priorities number. If two processes have the same priority numbers, then the process with a smaller arrival time will get executed first.

Gantt chart

Have a look at the Gantt chart of our example:

Advantages

The advantages of non-preemptive priority scheduling are the following:

  • It's easy to implement and use this scheduling.

  • Processes get executed based on their priority, so processes with higher priority get executed first, which saves time.

  • It's suitable for applications with resource requirements and fluctuating time.

Disadvantages

The disadvantages of non-preemptive priority scheduling are the following:

  • It has computing overhead, when the system crashes, almost all the processes with low priorities get lost.

  • Larger processes take a lot of time, then the lower priority processes may starve and get postponed.

  • Based on priority, it may leave some low-priority processes for a longer time.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved