0% found this document useful (0 votes)
495 views

Priority Non-Preemptive CPU Scheduling Algorithm

This document describes a non-preemptive priority CPU scheduling algorithm. It defines key terms like priority, arrival time, burst time, completion time, turnaround time, and waiting time. It provides an example of implementing non-preemptive priority scheduling on 7 processes with varying priorities, arrival times, and burst times. The example calculates values like completion time, turnaround time, and waiting time for each process and determines the average turnaround time and waiting time.

Uploaded by

Uday Sah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
495 views

Priority Non-Preemptive CPU Scheduling Algorithm

This document describes a non-preemptive priority CPU scheduling algorithm. It defines key terms like priority, arrival time, burst time, completion time, turnaround time, and waiting time. It provides an example of implementing non-preemptive priority scheduling on 7 processes with varying priorities, arrival times, and burst times. The example calculates values like completion time, turnaround time, and waiting time for each process and determines the average turnaround time and waiting time.

Uploaded by

Uday Sah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Project 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).

❖ Process Id: It is a unique number for each process.


❖ Arrival Time: Time at which the process arrives in the ready queue.
❖ Burst Time: Time required by a process for CPU execution.
❖ Completion Time: Time at which process completes its execution.
❖ Turnaround Time: The amount of time taken to complete a process.
▪ TAT= Completion Time - Arrival Time

❖ 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: -

Process Number 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 10 7 10
Sol:
We can prepare the Gantt chart according to the Non Preemptive priority scheduling.

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.

i. Turn Around Time = Completion Time - Arrival Time


ii. Waiting Time = Turn Around Time - Burst Time

Process Priority Arrival Burst Completion Turnaround Waiting


Number Time Time Time Time Time
P1 2 0 3 3 3 0
P2 6 2 5 18 16 11
P3 3 1 4 7 6 2
P4 5 4 2 13 9 7
P5 7 6 9 27 21 12
P6 4 5 4 11 6 2
P7 10 7 10 37 30 18

Average TAT= (3+16+6+9+21+6+30)/7=91/7 units

Avg Waiting Time = (0+11+2+7+12+2+18)/7 = 52/7 units

Thank You !

3 |Page

You might also like