Вы находитесь на странице: 1из 21

CS523

Operating Systems

Fred Kuhns
Applied Research Laboratory
Computer Science
Washington University

Washington
WASHINGTON UNIVERSITY IN ST LOUIS
Scheduling Aperiodic/Sporadic Tasks
• Assumptions:
• Preemptive, priority-driven algorithms
• Jobs independent of one another with arbitrary
interrelease times
• Periodic Jobs
– parameters and priority driven algorithm given
– on their own, periodic jobs meet all deadlines
• Aperiodic Jobs
– parameters not necessarily known on release
• Sporadic
– Parameters known on release
– variable execution time
– arbitrary deadline

Fred Kuhns (12/08/21) CS523 – Operating Systems 2


Correctness
• Aperiodic, Sporadic Algorithms and correctness:
– Sporadic jobs: on arrival, undergo acceptance test.
Must not affect periodic jobs and already accepted
sporadic jobs.
– Aperiodic jobs: Optimize response time (average or
next job) without affecting periodic and accepted
sporadic jobs

Priority
Reject
Queues
Wait Dispatch Highest
Acceptance Accept
Sporadic Jobs Priority Job to
Test
Processor
Aperiodic Jobs Dispatcher Processor

Periodic Jobs

Fred Kuhns (12/08/21) CS523 – Operating Systems 3


Periodic Servers: Terminology
• Execution budget - es, consumed while executing
• size = us = es/ps
• backlogged - jobs waiting in queue
• replenishment - execution time renewed by es
• replenishment time - time interval for
replenishment
• idle - queue is empty
• eligible - backlogged and budget available
• exhausted - budget is zero
• preserve - budget preserved when idle

Fred Kuhns (12/08/21) CS523 – Operating Systems 4


Approaches: Aperiodic
• Background: scheduled when processor is idle
• Interrupt-driven: scheduled on arrival
• Slack-Stealing: compromise approach.
• Periodic server: defined by (ps, es). Budget
replenished at ps intervals. If scheduled and queue
empty then budget set to 0.
• Bandwidth-preserving server: Improves on the
periodic server by preserving budget when
aperiodic queue is empty:
– Deferrable servers
– Sporadic Server
– Constant utilization and Total bandwidth servers
Fred Kuhns (12/08/21) CS523 – Operating Systems 5
Deferrable Servers (DS)
• Periodic task (ps, es) model with rules:
– budget consumed only when executing
– budget replenished at kps, budget = es at kps
• Determining impact on periodic tasks, fixed-
priority systems:
– fixed priority, preemptable jobs, Di <= Pi, and
deferrable server has highest priority
– Critical instant at t0, additional constraints
• DS budget is es at t0
• server remains backlogged after t0.
• DS replenished at t0 + Ps

Fred Kuhns (12/08/21) CS523 – Operating Systems 6


Schedulability - Fixed Priority
• Time demand analysis
– Deferrable server has highest priority
– Schedulable if jobs in critical zone are

i-1
t - es t
wi(t) = ei + es+ es + ek w(t)
ps k=1
ps
for 0 < t  pi t

...
Ts

...
Ti
t0 t0 + es t0 + es + ps t0 + es + 2ps t0 + pi

Fred Kuhns (12/08/21) CS523 – Operating Systems 7


Schedulability - Fixed Priority
• Schedulable Utilization - no general solution with
DS having an arbitrary period
– for special case
• ps < p1 < ... < pn < 2ps, and
• p n > ps + e s
• Rate monotonic schedule

 u  2  1( n 1) 
U RM :DS (n)  (n  1)  s   1
 u s  1  
 

• Fixed period, arbitrary priority


– perform time-demand analysis
Fred Kuhns (12/08/21) CS523 – Operating Systems 8
Schedulability - Dynamic Priority
• Independent periodic tasks and one deferrable server, a
task Ti is schedulable according to EDF if:
n
ek ps - es
+ us 1 + 1
k=1
min(Dk,pk) Di

• Prove by calculating processor time required for


the deferrable server
 t  (t 1  es )  t  (t 1  es )
wDS (t  t 1 )  es   e
 s  es  es  u s  t  t 1  es  ps 
 ps  ps

• time bound for periodic tasks is ek(t – t-1)/pk


• t-t-1 = Di, relative deadline for task Ti
Fred Kuhns (12/08/21) CS523 – Operating Systems 9
Sporadic Servers
• emulates periodic task (ps, es)
• can divide periodic server into several parts, each
replenished at a different time
• assume relative deadline is finite but arbitrary
• Sporadic server (ps, es) does not demand more
processor time than a periodic task with the same
parameters in any time interval.
– system with sporadic server may be schedulable when
same system with a deferrable server is not.

Fred Kuhns (12/08/21) CS523 – Operating Systems 10


Definitions
• T = set of n independent, preemptable periodic
tasks.
• TH = subset of T with higher priorities than the
sporadic server
• tr = latest replenishment time.
• tf = first instant after tr server begins to execute
• te = latest effective replenishment time
• BEGIN = at any time t, instant of earliest busy
interval of tasks in TH
• END = end of the latest busy interval if ends
before time t, otherwise infinity.
Fred Kuhns (12/08/21) CS523 – Operating Systems 11
Simple Sporadic Servers - Fixed Priority
• Replenishment time: Effective = te, actual = tr
• Consumption rule at time t>tr: when either
– C1: server is executing
– C2: server has executed since tr and END < t (i.e. this is not a busy
interval)
• Replenishment rule at time t
– R1: Initially when system begins execution and when replenished,
budget = es and tr = t (current time).
– R2: if at time t = tf, END = tf then te = max(tr, BEGIN). If END<tf
then te = tf. tnext=te+ps.
• if no busy interval, then te = t, next replenishment time = te + ps
– R3: Replenish at tnext except when:
(a) If tnext (te+ps) < tf, then replenish when exhausted
(b) Else if T becomes idle before tnext (te + ps), and becomes busy at
tb, budget replenished at tnext = min(te + ps, tb)

Fred Kuhns (12/08/21) CS523 – Operating Systems 12


Simple Sporadic Servers: Dynamic
• Consumption rule at time t: when either
– server is executing
– server deadline d defined, server is idle, and there is no job with
deadline before d ready for execution.
• Replenishment rule at time t
– R1: Initially and at each replenishment, budget = es, tr = current.
Initially te and d undefined.
– R2: if te defined, d = te + ps and tnext = te + ps. Else d undefined;
te defined as:
(a) If aperiodic arrives at t (queue empty):
If only jobs with di<(tr+ps) have executed in (tr,t) then te = tr.
Else if some job with di> (tr+ps) has executed in (tr,t) then te=t.
(b) Else at replenishment time tr
If server backlogged then te = tr ,
else server idle, te and d are undefined.
– R3: Replenish at tnext except when
(a) tnext = te+ps is < t when server becomes backlogged budget is
replenished as soon as it is exhausted
Fred (b)
Kuhnsreplenish
(12/08/21) at end ofCS523
each idle interval
– Operating Systems of T 13
Providing GPS Like service
• emulates sporadic task (ps, es)
• Scheduling aperiodic tasks in deadline driven
systems
• Emulate Generalized Processor Sharing (GPS)
Algorithm
– provides server an infinitesimally small time slice of
length proportional to server size.
• Timing isolation

Fred Kuhns (12/08/21) CS523 – Operating Systems 14


Constant Utilization Servers
• Defined by size and instantaneous utilization ũs,
– d is always defined
– emulates sporadic task with constant ũs
• scheduled with periodic tasks on EDF basis
• Consumption rules: consume when executing
• Replenishment rules:
– initially es = 0, d = 0
– aperiodic job (e) arrives at t to empty queue,
• if t < d, do nothin
• else, d = t + e/ ũs, es = e
– At deadline (d) of server
• if backlogged, set d = d + e/ ũs, es = e
• if idle, do nothing

Fred Kuhns (12/08/21) CS523 – Operating Systems 15


Total Bandwidth Servers
• Improve responsiveness of constant utilization
server by using background time
• Consumption rules:
– consume only when executing.
• Replenishment rules:
– Initially, es = 0, d = 0
– when aperiodic (e at time t) arrives to empty queue set
d = max(d, t) + e/us and es = e.
– Remove aperiodic job when done and
• server backlogged: d = e/us and es = e
• server idle: do nothing.

Fred Kuhns (12/08/21) CS523 – Operating Systems 16


Weighted Fair Queuing Servers
• Goal is to provide fair access to processor
• total bandwidth server is not fair
(starvation)
• same worst case response time as total
bandwidth server
• non-preemptive version used for network
packet scheduling

Fred Kuhns (12/08/21) CS523 – Operating Systems 17


Slack Stealing Algorithms

• aperiodic jobs scheduled using available slack


• requires slack computation at each
scheduling decision point
– using precomputed or dynamically calculated
values
• assumes release time jitters are negligible
• offers better performance than bandwidth
preserving approaches when assumptions are
valid

Fred Kuhns (12/08/21) CS523 – Operating Systems 18


Scheduling sporadic jobs

• On release sporadic jobs must undergo an


acceptance test
• accepted jobs are scheduled in EDF order
• Acceptance test:
– EDF: check utilization bounds - accept S(t,d,e) if
total density of accepted sporadic jobs is <= 1 -
(total density of periodic tasks) - e/(d-t). Also
may include available slack in calculation.
– fixed priority: use bandwidth preserving server

Fred Kuhns (12/08/21) CS523 – Operating Systems 19


Sporadic, Soft Real-Time

• Three common approaches


– FeVe model
– (, ) model
– leaky bucket model
• Acceptance test uses traffic parameters
and if accepts then uses bandwidth
preserving for each accepted task ,
thereafter all jobs in task are accepted by
server.

Fred Kuhns (12/08/21) CS523 – Operating Systems 20


Integrated Scheduling
• Two-level, priority driven scheme
• Emulates infitesimally small time slices

Fred Kuhns (12/08/21) CS523 – Operating Systems 21

Вам также может понравиться