0% found this document useful (0 votes)
8 views26 pages

8 Priority (Non-Preemptive) Algorithm

Uploaded by

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

8 Priority (Non-Preemptive) Algorithm

Uploaded by

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

Priority

Scheduli
(Non-
Preemptive)
ng
Algorithm
Key
Points

• Inpriority scheduling a number is assigned


to
each process which indicates its priority level.
• Lower the number, higher is the priority.
Exampl
e1
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Which is having higher


Timer priority P1 or P2 ?

0 P1 P2 Both P1 and P2 arrive at time ZERO

0
Process Priority Burst Time Arrival Time
P1 1 4/3 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

1 P2

P1
0
Process Priority Burst Time Arrival Time
P1 1 4/2 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

2 P2

P1
0
Process Priority Burst Time Arrival Time
P1 1 4/1 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

3 P2

P1
0
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer At time 4, P1 has finished

4
its processing, so processor
is assigned to P2 now.
P2

P1
0 4
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3/2 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer
At time 5, no new process

5
arrives so we continue with
P2

P1 P2
0 4
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3/1 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

6
At time 6, P3 arrives
P3

P1 P2
0 4
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

7
At time 7, P2 finishes
P3

P1 P2

0 4 7
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

8
P1 P2 P3

0 4 7
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

9
P1 P2 P3

0 4 7
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

10
P1 P2 P3

0 4 7
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

11 P4

P1 P2 P3

0 4 7
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

12 P4 P5

P1 P2 P3

0 4 7
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

13 P4 P5

P1 P2 P3

0 4 7
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

14
WBhuircsht
P4 P5 priority: P4 or P5?
P r o ce s s h as h ig
t i m e o f P 3 is o v
heer r
P1 P2 P3

0 4 7 14
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

15 P4

P1 P2 P3 P5

0 4 7 14
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

16 P4

P1 P2 P3 P5

0 4 7 14 16
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

17
P1 P2 P3 P5 P4

0 4 7 14 16
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

Timer

20
P1 P2 P3 P5 P4

0 4 7 14 16 20
Process Priority Burst Time Arrival Time
P1 1 4 0
P2 2 3 0
P3 1 7 6
P4 3 4 11
p5 2 2 12

P1 P2 P3 P5 P4

0 4 7 14 16 20

Waiting Time: start – arrival


P1 : 0 – 0 = 0
P2: 4 – 0 = 4
P3: 7 – 6 = 1
P4: 16 – 11 = 5
P5: 14 – 12 = 2
It suffers from Starvation

Remem
ber
Solution - Aging
Questio
n?
process Burst time Arrival time Priority
P1 6 0 2
P2 2 5 3
P3 8 3 2
P4 3 0 1
P5 4 8 1

You might also like