Priority Non-Preemptive CPU Scheduling Algorithm
Priority Non-Preemptive CPU Scheduling Algorithm
Priority Scheduling:
The SJF is a special case of general priority scheduling algorithm. A Priority
(an integer) is associated with each process.The CPU is allocated to the process with the
highest priority.Generally smallest integer is considered as the highest priority.Equal
priority processes are scheduled in First Come First serve order.It can be preemptive or
Non-preemptive.
Non-Preemptive:
The scheduling in which a running process cannot be interrupted by any
other process is called non-preemptive scheduling. Any other process which enters the
queue has to wait until the current process finishes its CPU cycle.
➢ In each types of CPU scheduling we have given Process Id (PID), ArrivalTime (AT),
Burst Time (BT) & Priority (P).
We have to find Completion Time (CT), Turnaround Time (TAT)& WaitingTime(WT).
❖ Waiting Time: The amount of time spent ready to run but not running.
▪ WT= Turnaround Time – Burst Time
Advantages Of Non-Preemptive:
• Good response for the highest priority processes.
Disadvantages Of Non-Preemptive:
• Starvation may be possible for the lowest priority processes
1 |Page
Example: -
The Process P1 arrives at time 0 with the burst time of 3 units and the priority number 2. Since No
other process has arrived till now hence the OS will schedule it immediately.
Meanwhile the execution of P1, two more Processes P2 and P3 are arrived. Since the priority of
P3 is 3 hence the CPU will execute P3 over P2.
Meanwhile the execution of P3, All the processes get available in the ready queue. The Process
with the lowest priority number will be given the priority. Since P6 has priority number assigned
as 4 hence it will be executed just after P3.
After P6, P4 has the least priority number among the available processes; it will get executed for
the whole burst time.
Since all the jobs are available in the ready queue hence All the Jobs will get executed according
to their priorities. If two jobs have similar priority number assigned to them, the one with the least
arrival time will be executed.
Gantt Chart:
P1 P3 P6 P4 P2 P5 P7
0 3 7 11 13 18 27 37
2 |Page
From the GANTT Chart prepared, we can determine the completion time of every process.
The turnaround time, waiting time and response time will be determined.
Thank You !
3 |Page