Upload
darby-dunkley
View
213
Download
0
Tags:
Embed Size (px)
Citation preview
WashingtonWASHINGTON UNIVERSITY IN ST LOUIS
Real-Time Periodic Tasks
Fred KuhnsApplied Research Laboratory
Computer ScienceWashington University
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 2
Priority-Driven Schedulers
bull Assumptions some of which will be relaxed at the end of this sectionndash Independent tasksndash No sporadic or aperiodic tasksndash Jobs ready when releasedndash Jobs may be preempted at any timendash Jobs never suspend themselvesndash Scheduling decisions made at job release and on completionndash Interrelease times may vary use the minimum for periodndash Uni-Processor environmentndash System overhead (including context switch) is negligible
compared to job execution times and periodsndash Unlimited priority levels
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 3
What is a priority-driven scheduler
bull Event-driven work-conserving schedulersndash scheduling decision made when event occurs for example a
job is released or completesndash Resources allocated to the highest priority job and only left
idle if no jobs are waiting (ready)
bull Jobs assigned explicit or implicit prioritiesndash consequently FIFO and Round Robin may be considered
priority driven Priorities are defined by the queue ordering and may be varied when job executes
bull Algorithm defined by priorities used and a set of rules (preemption priority changes etc)
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 4
Concepts
bull Algorithms that consider a jobs urgency generally perform better than those that do notndash as the deadline for a job approaches its urgency should
increase Contrast EDF with FIFO the FIFO implicit priority is a jobs position in a queue
bull Static versus Dynamic assignment of workloadsndash for now we only consider the case where a set of tasks are
statically assigned to a processor
bull Fixed versus Dynamic priority assignment ndash Fixed priority RM and DMndash Dynamic Task Fixed Job EDFndash Dynamic Job LST (Least Slack First)
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 5
Concepts Schedulable Utilization
bull A scheduling algorithm can feasibly schedule any set of periodic tasks on a processor if the total utilization of the tasks is equal to or less than the schedulable utilization of the algorithmldquo
bull Schedulable utilization is necessarily lt= 1
bull While dynamic priority algorithms have better average performance they are less predictable during overload In fact their worst case behavior is more difficult to predictndash consider how RM with fixed priorities will perform during
overload the highest priority tasks will generally complete on time which the lowest will not Contrast this with EDF which uses dynamic priorities
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 6
Example Dynamic Algorithms
bull Earliest Deadline Firstndash Assigns priorities to jobs according to absolute deadline The
sooner the deadline the higher the priorityndash Priority assigned when job released For example job arrives
and is placed in a queue using EDF algorithmndash Dynamic task priority static job priority
bull Least Slack Time First (LST)ndash Job with the least amount of slack time is scheduled nextndash Dynamic task priority Dynamic job priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 7
Schedulable Utilizations of EDF
bull A system of independent preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if the total utilization is equal to or less than 1
bull Schedulability of the EDF algorithm ndash if Dk pk then density = Δ = U utilization test
is both necessary and sufficient ndash if Dk lt pk for some k then the test is only a
sufficient condition
n
k kk
k
pD
eDensity
1
1)min(
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 2
Priority-Driven Schedulers
bull Assumptions some of which will be relaxed at the end of this sectionndash Independent tasksndash No sporadic or aperiodic tasksndash Jobs ready when releasedndash Jobs may be preempted at any timendash Jobs never suspend themselvesndash Scheduling decisions made at job release and on completionndash Interrelease times may vary use the minimum for periodndash Uni-Processor environmentndash System overhead (including context switch) is negligible
compared to job execution times and periodsndash Unlimited priority levels
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 3
What is a priority-driven scheduler
bull Event-driven work-conserving schedulersndash scheduling decision made when event occurs for example a
job is released or completesndash Resources allocated to the highest priority job and only left
idle if no jobs are waiting (ready)
bull Jobs assigned explicit or implicit prioritiesndash consequently FIFO and Round Robin may be considered
priority driven Priorities are defined by the queue ordering and may be varied when job executes
bull Algorithm defined by priorities used and a set of rules (preemption priority changes etc)
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 4
Concepts
bull Algorithms that consider a jobs urgency generally perform better than those that do notndash as the deadline for a job approaches its urgency should
increase Contrast EDF with FIFO the FIFO implicit priority is a jobs position in a queue
bull Static versus Dynamic assignment of workloadsndash for now we only consider the case where a set of tasks are
statically assigned to a processor
bull Fixed versus Dynamic priority assignment ndash Fixed priority RM and DMndash Dynamic Task Fixed Job EDFndash Dynamic Job LST (Least Slack First)
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 5
Concepts Schedulable Utilization
bull A scheduling algorithm can feasibly schedule any set of periodic tasks on a processor if the total utilization of the tasks is equal to or less than the schedulable utilization of the algorithmldquo
bull Schedulable utilization is necessarily lt= 1
bull While dynamic priority algorithms have better average performance they are less predictable during overload In fact their worst case behavior is more difficult to predictndash consider how RM with fixed priorities will perform during
overload the highest priority tasks will generally complete on time which the lowest will not Contrast this with EDF which uses dynamic priorities
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 6
Example Dynamic Algorithms
bull Earliest Deadline Firstndash Assigns priorities to jobs according to absolute deadline The
sooner the deadline the higher the priorityndash Priority assigned when job released For example job arrives
and is placed in a queue using EDF algorithmndash Dynamic task priority static job priority
bull Least Slack Time First (LST)ndash Job with the least amount of slack time is scheduled nextndash Dynamic task priority Dynamic job priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 7
Schedulable Utilizations of EDF
bull A system of independent preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if the total utilization is equal to or less than 1
bull Schedulability of the EDF algorithm ndash if Dk pk then density = Δ = U utilization test
is both necessary and sufficient ndash if Dk lt pk for some k then the test is only a
sufficient condition
n
k kk
k
pD
eDensity
1
1)min(
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 3
What is a priority-driven scheduler
bull Event-driven work-conserving schedulersndash scheduling decision made when event occurs for example a
job is released or completesndash Resources allocated to the highest priority job and only left
idle if no jobs are waiting (ready)
bull Jobs assigned explicit or implicit prioritiesndash consequently FIFO and Round Robin may be considered
priority driven Priorities are defined by the queue ordering and may be varied when job executes
bull Algorithm defined by priorities used and a set of rules (preemption priority changes etc)
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 4
Concepts
bull Algorithms that consider a jobs urgency generally perform better than those that do notndash as the deadline for a job approaches its urgency should
increase Contrast EDF with FIFO the FIFO implicit priority is a jobs position in a queue
bull Static versus Dynamic assignment of workloadsndash for now we only consider the case where a set of tasks are
statically assigned to a processor
bull Fixed versus Dynamic priority assignment ndash Fixed priority RM and DMndash Dynamic Task Fixed Job EDFndash Dynamic Job LST (Least Slack First)
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 5
Concepts Schedulable Utilization
bull A scheduling algorithm can feasibly schedule any set of periodic tasks on a processor if the total utilization of the tasks is equal to or less than the schedulable utilization of the algorithmldquo
bull Schedulable utilization is necessarily lt= 1
bull While dynamic priority algorithms have better average performance they are less predictable during overload In fact their worst case behavior is more difficult to predictndash consider how RM with fixed priorities will perform during
overload the highest priority tasks will generally complete on time which the lowest will not Contrast this with EDF which uses dynamic priorities
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 6
Example Dynamic Algorithms
bull Earliest Deadline Firstndash Assigns priorities to jobs according to absolute deadline The
sooner the deadline the higher the priorityndash Priority assigned when job released For example job arrives
and is placed in a queue using EDF algorithmndash Dynamic task priority static job priority
bull Least Slack Time First (LST)ndash Job with the least amount of slack time is scheduled nextndash Dynamic task priority Dynamic job priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 7
Schedulable Utilizations of EDF
bull A system of independent preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if the total utilization is equal to or less than 1
bull Schedulability of the EDF algorithm ndash if Dk pk then density = Δ = U utilization test
is both necessary and sufficient ndash if Dk lt pk for some k then the test is only a
sufficient condition
n
k kk
k
pD
eDensity
1
1)min(
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 4
Concepts
bull Algorithms that consider a jobs urgency generally perform better than those that do notndash as the deadline for a job approaches its urgency should
increase Contrast EDF with FIFO the FIFO implicit priority is a jobs position in a queue
bull Static versus Dynamic assignment of workloadsndash for now we only consider the case where a set of tasks are
statically assigned to a processor
bull Fixed versus Dynamic priority assignment ndash Fixed priority RM and DMndash Dynamic Task Fixed Job EDFndash Dynamic Job LST (Least Slack First)
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 5
Concepts Schedulable Utilization
bull A scheduling algorithm can feasibly schedule any set of periodic tasks on a processor if the total utilization of the tasks is equal to or less than the schedulable utilization of the algorithmldquo
bull Schedulable utilization is necessarily lt= 1
bull While dynamic priority algorithms have better average performance they are less predictable during overload In fact their worst case behavior is more difficult to predictndash consider how RM with fixed priorities will perform during
overload the highest priority tasks will generally complete on time which the lowest will not Contrast this with EDF which uses dynamic priorities
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 6
Example Dynamic Algorithms
bull Earliest Deadline Firstndash Assigns priorities to jobs according to absolute deadline The
sooner the deadline the higher the priorityndash Priority assigned when job released For example job arrives
and is placed in a queue using EDF algorithmndash Dynamic task priority static job priority
bull Least Slack Time First (LST)ndash Job with the least amount of slack time is scheduled nextndash Dynamic task priority Dynamic job priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 7
Schedulable Utilizations of EDF
bull A system of independent preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if the total utilization is equal to or less than 1
bull Schedulability of the EDF algorithm ndash if Dk pk then density = Δ = U utilization test
is both necessary and sufficient ndash if Dk lt pk for some k then the test is only a
sufficient condition
n
k kk
k
pD
eDensity
1
1)min(
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 5
Concepts Schedulable Utilization
bull A scheduling algorithm can feasibly schedule any set of periodic tasks on a processor if the total utilization of the tasks is equal to or less than the schedulable utilization of the algorithmldquo
bull Schedulable utilization is necessarily lt= 1
bull While dynamic priority algorithms have better average performance they are less predictable during overload In fact their worst case behavior is more difficult to predictndash consider how RM with fixed priorities will perform during
overload the highest priority tasks will generally complete on time which the lowest will not Contrast this with EDF which uses dynamic priorities
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 6
Example Dynamic Algorithms
bull Earliest Deadline Firstndash Assigns priorities to jobs according to absolute deadline The
sooner the deadline the higher the priorityndash Priority assigned when job released For example job arrives
and is placed in a queue using EDF algorithmndash Dynamic task priority static job priority
bull Least Slack Time First (LST)ndash Job with the least amount of slack time is scheduled nextndash Dynamic task priority Dynamic job priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 7
Schedulable Utilizations of EDF
bull A system of independent preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if the total utilization is equal to or less than 1
bull Schedulability of the EDF algorithm ndash if Dk pk then density = Δ = U utilization test
is both necessary and sufficient ndash if Dk lt pk for some k then the test is only a
sufficient condition
n
k kk
k
pD
eDensity
1
1)min(
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 6
Example Dynamic Algorithms
bull Earliest Deadline Firstndash Assigns priorities to jobs according to absolute deadline The
sooner the deadline the higher the priorityndash Priority assigned when job released For example job arrives
and is placed in a queue using EDF algorithmndash Dynamic task priority static job priority
bull Least Slack Time First (LST)ndash Job with the least amount of slack time is scheduled nextndash Dynamic task priority Dynamic job priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 7
Schedulable Utilizations of EDF
bull A system of independent preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if the total utilization is equal to or less than 1
bull Schedulability of the EDF algorithm ndash if Dk pk then density = Δ = U utilization test
is both necessary and sufficient ndash if Dk lt pk for some k then the test is only a
sufficient condition
n
k kk
k
pD
eDensity
1
1)min(
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 7
Schedulable Utilizations of EDF
bull A system of independent preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if the total utilization is equal to or less than 1
bull Schedulability of the EDF algorithm ndash if Dk pk then density = Δ = U utilization test
is both necessary and sufficient ndash if Dk lt pk for some k then the test is only a
sufficient condition
n
k kk
k
pD
eDensity
1
1)min(
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 8
Schedulable Utilization Case 1
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
We know that if the utulization is gt 1 then the tasks are not schedulable But if the tasks are not schedulable does that imply the utilization is gt 1Case 1 The Interval I is the current period of task Ti All jobs released before ric
complete by time ric + pi Solve for the total required time and compare to the total utilization Show that if a deadline is missed then the utilization is gt 1
I
ikk
k
k
i
ii ep
t
p
ett
)(
t
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 9
Schedulable Utilization Case 2
t
ric ric+pi
1
i
k
n
helliphellip
hellip
Jic misses a deadline
T1
Ti
Tk
Tn
I
Case 2Let t-1 be the last time a job runs which has a deadline after (ric+pi) Define Trsquo to be the set of tasks with jobs released before ric and with deadlines after t Then it suffices to only consider the jobs in tasks T-Trsquo Proceed as before using t-1 as the origin
TiTTj
j
j
i
ici ep
t
p
ertttI
1
)(
t-1
rsquo1
rsquoi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 10
Fixed Priority Algorithms
bull Rate Monotonic (RM)ndash Priorities based on Task period smaller periods have higher priority
ndash if pi lt pk (rate of Ti gt rate of Tk) then i gt k
bull Deadline Monotonic (DM)ndash Priority based on task deadline smaller relative deadline higher
priority
ndash if Di lt Dk then i gt k
bull No fixed priority algorithm is optimalbull Under special cases can achieve a utilization of 1
ndash a set of tasks are simply periodic if for every pair of tasks Ti and Tk with piltpk pk=mpi m an integer (They are harmonic)
ndash for simply periodic independent preemptable tasks with Di ge pi a set of tasks is schedulable on a uniprocessor system iff U 1
bull Among fixed-priority algorithms DM is optimalndash if a set of tasks can be scheduled using fixed priorities then DM will
produce a feasible schedule
ndash if Dk = xmiddotpk for all k and some constant x then RM is identical to DM
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 11
bull Sufficient utilization bounds for RM let Dk = pk
bull Utilization checkndash This is a sufficient condition that is it is possible for a set of tasks to
fail this test but still be schedulable
bull Time-demand analysis (Dk lt= pk)ndash assumes worst case task interactions evaluates computational
requirements at task critical instantsbull Simulation can be used
ndash it is sufficient to perform simulation over largest period when all tasks are in phase
Schedulability of Fixed Priority Algorithms
500for
150for 112
32for 11
)1(
)(1
1
1
n
n
RM n
n
nU
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 12
Critical Instantbull Central concept for fixed priority systemsbull A critical instant of a task is the instant in time
when a job (in Ti) has its maximum response time
bull If a task can be scheduled in its critical instant then it will not miss a deadline
bull Occurs when a job in Ti is released concurrently with all higher priority jobs ndash T = T1 T2 Tn ordered by priority (i lt j i lt j)
ndash Ti = T1 T2 Ti-1 All higher priority jobs
ndash ric = rkl for some l for every k in 1 2 i-1
bull At critical instantndash Lower priority task is preempted by higher priority tasks
delaying completionndash Maximum interference when all phases are equal
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 13
advancing release time increases interference
ei + 3ej
advancing release time increases interference
ei + 4ej
Critical Instant
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 14
Time Demand Analysis
bull Computes total demand for processor time by a job released at a critical instant of the task and all higher priority tasks
bull If this worst case response time is less than or equal to the jobs deadline then it is schedulable
w(t)
t
wi(t) = ei +k = 1
i - 1tpk
ek
for 0 lt t pi
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 15
Critical Instant for Fixed Priority Systems
Wk
1
i
k
n
helliphellip
hellip
T1
Ti
Tk
Tn
I
Response time for job Jk1 is wk1 Perform a time demand analysis Let W be the required total processor time then at time W = t = wk1 + k
kjj
j
jkkk e
p
weW
)( 1
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 16
Critical Instant Time demand analysis
t
W
kjkj
j
jkk e
p
tew
1
Decreasing the phase k shifts the graph up thus increasing the response time Likewise decreasing the phases of higher priority jobs (j) will also increase the jobrsquos response time Therefore the maximum response time of a job occurs when all jobs are in phase
wk1 = t
j
k
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 17
Practical Considerations
bull Preemptive versus Non-Preemptivebull Self Suspensionbull Context Switchesbull Limited Priority Levelsbull Tick schedulingbull Variable priority
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 18
Blocking and Nonpreemptivity bull Higher priority job is blocked by a lower priority job during a
nonpreemptive interval resulting in a priority inversionbull Must adjust schedulability tests
ndash let qi = maximum nonpreemptable execution time
ndash qi lt= ei
ndash let bi(nb) = max(qk) i+1 le k le n
bull Fixed priority systems change time demand analysis as follows
bull Change utilization equation as follows
)p(D t ep
tbetw iik
i
k kiii min0for )(
1
1
)(iUp
bU X
i
ii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 19
Nonpreemptivity
bull EDF In a system where jobs are scheduled on the EDF basis a job Jk with relative deadline Dk can block a job Ji with relative deadline Di only if Dk is larger then Di
bull In other words for a job to be blocked we need rkltri and dkgtdi
bull For deadline driven systems
1n ievey for 1)min()min(1
n
k ii
i
kk
k
pD
b
pD
e
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 20
Blocking Time Continued
bull Self-suspension or self-blockndash We can treat as another blocking factor bi(ss)
ndash If higher priority job self-suspends then its computation time may be deferred until the feasible interval for some other job
bull If a job Ji can self-suspend at most Ki times then the total possible blocking time is given by (K+1 represents the K self-suspensions and scheduling on release)
1
1i ) of SSmaxmin(T of SSmax )(
i
kkki Tessb
)()1()( npbKssbb iiii
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 21
Putting it together with system overhead
bull Context Switch assume fixed job prioritiesndash let CS = context switch time time to ldquoplacerdquo or ldquoremoverdquo
a job tofrom the processor So 2CS is the total context switch overhead for a given job
ndash we can account for this by increasing a jobs execution time by 2CS or 2(K+1)CS if self-suspend K times
bull Updating our tests (must be true for every i)
1
1
1
)( priority Fixed
1)min()min(
Deadline
)1(2)()1()(
i
kk
kiii
n
k ii
i
kk
k
iiiii
ep
tbetw
pD
b
pD
e
CSKnpbKssbb
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable
Fred Kuhns (041023) CSE522ndash Advanced Operating Systems 22
Limited Priorities and Tick schedulingbull Limited priorities
ndash N task priorities S system priorities and N = S then must provide a mapping
bull When N gt S then nondistinct priorities result (different task priorities map to same system priority)
bull worst case a job is delayed by other jobs with the same priority
ndash Uniform mappingndash Constant Ratio mapping and grid ratio
bull Tick Schedulingndash tick period = p0
ndash the tick task has period p and an execution time that is a function of the queue lengths
ndash A job may wait on scheduling queue when runnable