Priority-Based Non-Preemptive and Priority-Based Preemptive Scheduling

1. Priority-Based Non-Preemptive Scheduling

Definition:

In Priority Non-Preemptive Scheduling, each process is assigned a priority.
The CPU is allocated to the process with the highest priority (smallest number = highest priority).
Once the CPU is given to a process, it cannot be taken away until the process finishes, even if a higher-priority process arrives.


Key Features:

  • Type: Non-preemptive
  • Basis: Process priority
  • Higher priority → executed first
  • If priorities are same → FCFS is used
  • CPU is not interrupted once assigned

Example:

ProcessBurst Time (ms)Priority
P1103
P211
P322

Execution Order:
→ P2 (Priority 1) → P3 (Priority 2) → P1 (Priority 3)

Gantt Chart:

|  P2  |  P3  |  P1  |
0      1      3     13

Advantages:

✅ Simple to implement
✅ Lower-priority tasks do not preempt higher-priority ones
✅ Good for batch systems

Disadvantages:

Starvation (low-priority processes may never execute)
❌ No preemption — less responsive


2. Priority-Based Preemptive Scheduling

Definition:

In Priority Preemptive Scheduling, the CPU is also assigned to the highest-priority process,
but if a new process arrives with a higher priority than the currently running one, the CPU is preempted and given to the new process.


Key Features:

  • Type: Preemptive
  • CPU can be taken away if a higher-priority process arrives
  • Higher responsiveness than non-preemptive version

Example:

ProcessArrival TimeBurst TimePriority
P1052
P2131

Execution Order:

  • At time 0 → P1 starts (priority 2)
  • At time 1 → P2 arrives (priority 1, higher) → P1 is preempted
  • CPU switches to P2 → completes
  • Then P1 resumes

Gantt Chart:

| P1 | P2 | P1 |
0    1    4    9

Advantages:

✅ Better response time for high-priority processes
✅ More efficient CPU utilization

Disadvantages:

Starvation for low-priority processes
More context switches (less efficient)


Difference Summary:

FeaturePriority Non-PreemptivePriority Preemptive
CPU controlProcess keeps CPU until completionCPU can be taken by higher-priority process
Response timeSlowerFaster
Context switchingLessMore
StarvationPossibleMore likely
TypeNon-preemptivePreemptive

By admin

Leave a Reply

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