Download presentation
1
Uniprocessor Scheduling II
Chapter 9
2
Shortest Process Next Nonpreemptive policy
5 10 15 20 1 2 3 4 Nonpreemptive policy Process with shortest expected processing time is selected next Short process jumps ahead of longer processes P3: 4 time units P4: 5 time units P5 2 time units
3
Shortest Process Next Predictability of longer processes is reduced
If estimated time for process not correct, the operating system may abort it Possibility of starvation for longer processes
4
Shortest Remaining Time
5 10 15 20 1 2 3 4 SRT is a preemptive version of shortest process next (SPN) policy Must estimate processing time P2 Remaining 5 time units P4 Remaining 5 time units P5 Remaining 2 time units P2 Remaining 5 time units P3 Remaining 4 time units
5
Highest Response Ratio Next (HRRN)
5 10 15 20 Choose next process with the greatest value of RR No Preemptive P5 RR =3.5 1 P4 RR = 2.4 2 3 P3 RR=2.25 P4 RR = 1.6 P5 RR = 1.5 4 5 RR =(w+s)/s =time spent waiting+expected service time expected service time P5 RR=( (13-8) + 2)/2 = 3.5 // P5 has been chosen at 13 P4 RR=( (13-6) + 5)/5 = 2.4
6
Feedback Scheduling is done on a preemptive basis, and a dynamic priority mechanisms is used. When s process first enters the system, it is placed in RQ0. After its first execution, when it returns to the Ready state, it is placed in RQ1.
7
Feedback (q = 1) 5 10 15 20 1 2 3 4 Penalize jobs that have been running longer. Focus on the time spent in execution so far. Don’t know remaining time process needs to execute 1 RQ5 3 4 5 2 1 3 2 1 3 4 2 RQ4 1 1 RQ2 RQ3 RQ0 RQ1
8
Feedback q=2i 5 10 15 20 When a process first enters the system, it is placed in RQ0. After its first execution, when it returns to the Ready state, it is placed in RQ1 …… In general, a process scheduled from RQi is allowed to execute 2 i time units (1, 2, 4, 8, …...) before preemption. RQ2, 4 time units 1 RQ1,2 time units 1 1(2) 2 2(4) 1(2) 3 2 1(2) 4 2 1 5
9
Question - Case Study (1)
Consider the following set of processes: Process Name Arrival Time Processing Time Perform the analysis of a comparison of scheduling policies(FCFS, RR(q=1), RR(q=4), SPN, SRT, HRRN, Feedback(q=1), and Feedback(q=2 i) )
10
Solution of Question (2)
FCFS RR q=1 RR q=4 SPN SRT HRRN FB FB q=2i * Each square represents one time unit. The number refers to the running process
11
Solution of Question - FCFS (3)
FCFS * Each square represents one time unit. The number refers to the running process First Come First Served (FCFS) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time
12
Solution of Question Round Robin q=1
P1 P2 P3 P4 P5 Ready Time 1 3 2 4 7 1 9 3 5 10 12 14 9 16 13 15 12 17
13
Solution of Question - RR (q=1) (4)
RR q=1 * Each square represents one time unit. The number refers to the running process Round Robin (RR q=1) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time
14
Solution of Question Round Robin q=4
P1 P2 P3 P4 P5 Ready Time 1 7 3 9 14 12 18
15
Solution of Question - RR (q=4) (5)
RR q=4 * Each square represents one time unit. The number refers to the running process Round Robin (RR q=4) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time
16
Solution of Question - SPN (6)
SPN * Each square represents one time unit. The number refers to the running process Shortest Process Next (SPN) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time
17
Solution of Question - SRT (7)
SRT * Each square represents one time unit. The number refers to the running process Shortest Remaining Time (SRT) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time
18
Solution of Question - HRRN (8)
HRRN * Each square represents one time unit. The number refers to the running process Highest Response Ratio Next (HRRN) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time * At time 3: P2 RR (2+5)/5 = 1.4; P3 RR= (0+2)/2 = 1. So Choose P2
19
Solution of Question Feedback q=1
P1 P2 P3 P4 P5 RQ1 RQ2 1 2 1 2 3 RQ3 1 3 4 1 2 RQ4 RQ0 4 1 2 3
20
Solution of Question - FB q=1 (9)
FB q=1 * Each square represents one time unit. The number refers to the running process Feedback (FB q=1) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time
21
Solution of Question Feedback q= 2i
P1 P2 P3 P4 P5 RQ1 1 RQ2 1 2 1 1 2 RQ0 1 2
22
Solution of Question - FB q= 2i (10)
FB q=2i * Each square represents one time unit. The number refers to the running process Feedback (FB q = 2i) Process Pi Average Arrival Time Ta Service Time Ts Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time
23
Question 1 - Exercise/Home Work (1)
Consider the following set of processes: Process Name Arrival Time Processing Time Perform the analysis of a comparison of scheduling policies(FCFS, RR(q=1), RR(q=4), SPN, SRT, HRRN, Feedback(q=1), and Feedback(q=2 i) )
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.