Title: SYSC 5701 Operating System Methods for RealTime Applications
1SYSC 5701Operating System Methods for Real-Time
Applications
- Scheduling Aperiodic and Sporadic Jobs in
Priority Driven Systems - Winter 2009
2Liu Ch. 7
- Assumptions
- now allow aperiodic or sporadic tasks!!
- tasks are independent (still)
- will relax assumption later
- interdependency ? Liu Ch. 8
- uniprocessor
3Aperiodic Events
- aperiod?ic a. having no natural frequency
- stochastic inter-arrival times
- some may be critical sporadic period
- sporad?ic a. intermittent scattered single
- will consider techniques
- background
- polling
- sporadic server
4Aperiodic Service in Background
- service aperiodic tasks as background process
- lowest priority always preempt for periodic
tasks - OK for non-critical, less important activities
- may cause aperiodic deadlines to be missed
- could starve aperiodic work
5Background (cont)
- may cause poor response time for aperiodic work
- response time
- time of completed service time of request
- best case no pending periodic work
- worst case all periodic work pending
- background ? OK for some cases, but
6Integrate with Periodic?
- how to ensure aperiodic work not starved with RM
approach? - must cast aperiodic tasks into periodic framework
- must know task inter-arrival characteristics
- allocate a periodic task that does nothing but
service aperiodic work!
7Priority Queues in Kernel
add periodic server jobs to periodic queue
periodic server
periodic jobs
processor
aperiodic jobs
periodic server jobs process aperiodic jobs
8Aperiodic Service Using Polling
- goal improve response time to aperiodic
requests - schedule periodic aperiodic service as a
regular server task period ps, budget es - when aperiodic job released
- ? put it in aperiodic job queue
- when aperiodic server executes
- polls aperiodic job queue and execute requests
- wont exceed allocated budget
9Polling (cont)
- if all pending aperiodic jobs completed before
consuming budget - server exhausts remaining budget set 0
- suspends itself
- budget replenished at beginning of each period
- What if job arrives just after server suspends
self, even though budget existed for job? - What to do if aperiodic job misses deadline?
- How to schedule aperiodic jobs in aperiodic queue?
10Bandwidth-Preserving Server
- deferrable server
- server does not exhaust budget before suspending
self - budget replenished to es at start of each period
- allows late arrivals to execute without waiting
until next period - improves response time of aperiodic jobs
11Deferred Server
- different replenishment algorithm!
- has sliding window replenishment period
- replenishment period starts when server begins
execution with a full budget
not in replenishment period
full budget
release
replenishment period
12Performance ?
- Sprunt, Lehoczky, Sha
- deferred server response time improvement
- 6 times better than polling
- 10 times better than background
- o/s implementation issues
- more complex
- hybrid static dynamic scheduling
- managing server execution capacity
- ? starts to look like time-slicing !?
13Theory?
- for deferred server delaying lower priority jobs
- worst case critical instant
- server is highest priority ready job
- has almost full budget (es )
- es remaining in period
- ? will be replenished after es
14Deferred Server Critical Instant
worst case possibility!
t0
t0 t
- over time t from critical instant, server can
delay lower priority tasks by - t es
t
t es
es
es
budget from previous period
end of previous period
? ?
? ?
t es
es
es
es
1
ps
ps
15Equation 7.1 in Liu Text
delay due to higher priority periodic jobs
max. delay due to server
?
i-1
? ?
t es
ek
?i(t) ei es
es
ps
k 0
16Schedulable Utilization
for n periodic tasks
?? ? ?
1 (n1)
us 2 us 1
URM/DS(n) ( n 1)
1
es ps
where us
17Server Priority
- if server priority lt priority of task i
- ? server does not influence response time of task
i - if server priority gt priority of task i
- ? use Equation 7.1
18Multiple Servers?
- might prefer to have different priorities
associated with different aperiodic tasks - use a server for each priority level
- if m servers with priority gt priority of task i
?
i-1
( )
? ?
t es,k
ek
?i(t) ei 1
es,k
ps,k
k 0
19Sporadic Server
- worst case ? replenish server at the end of every
sporadic server period - essentially the same as deferred server
- acceptance test?
- only accept if enough slack budget to complete
job before deadline
20Fixed Priority Acceptance Test
- assume sporadic jobs placed in sporadic job queue
in EDF order - slack ? of a job server budget left over after
executing the job - influenced by other jobs accepted by server!
21Slack of a Job
- for job Si( t , ds,i , es,i )
execution of previously accepted jobs with
earlier deadlines
?
?s,i(t) ds,i t es es,i
(es,k ?s,k )
? ?
ps
ds,k lt ds,i
number of replenishments before deadline ?
conservative !
completed portion of job
server period
server budget
22Acceptance
- must have enough slack
- accepting wont make previously accepted jobs
late (wont influence jobs with earlier
deadlines!) - ? each job with a later deadline must have at
least es,i slack at t
23Priority Queues in Kernel
add periodic server jobs to periodic queue
periodic server
periodic jobs
processor
2
aperiodic jobs
1
sporadic jobs
test
periodic server jobs process aperiodic and
sporadic jobs
reject