CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Scheduling Aperiodic and Sporadic J obs • Def init ions • Comparison t o t radit ional scheduling of asynchronous event s • Polling Server • Def ererable Server • Sporadic Server • Generalized Processor Sharing • Const ant Ut ilizat ion Server • Tot al Bandwidt h Server • Preempt ive Weight ed Fair Queueing Scheduling Aperiodic and Sporadic J obs • When variat ions in int er-release t imes and execut ion t imes are small: – can t reat t ask as periodic t ask T=(p s , e s ) , and schedule it accordingly. • What about sporadic j obs? can arrive at any t ime execut ion t imes vary widely deadlines are unkown a priori ? • Given: n periodic t asks T 1 , … , T i = (p i , e i ), … , T n priorit y-driven scheduling algorit hm • We want t o det ermine when t o execut e aperiodic and sporadic j obs, i.e., – sporadic j ob: accept ance t est scheduling of accept ed j ob – aperiodic j ob: schedule j ob t o complet e ASAP. 1
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Priorit y Queues f or Periodic/ Sporadic/ Aperiodic J obs reject Sporadic Acceptance Test Jobs Periodic Processor Jobs Aperiodic Jobs Scheduling Algorit hms, Overview Scheduling Aperiodic (Sporadic) Jobs: Non-Real-Time Systems Real-Time Systems Background Slack Stealing Interrupt-Driven Bandwidth Preserving Polled 2
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Background/ I nt errupt -Driven vs. Slack St ealing • Background: – Aperiodic j ob queue has always lowest priorit y among all queues. – Periodic t asks and accept ed j obs always meed deadlines. – Simple t o implement . – Execut ion of aperiodic j obs may be unduly delayed. • I nt errupt -Driven: – Response t ime as short as possible. – P eriodic t asks may miss some deadlines. • Slack St ealing: – P ost pone execut ion of periodic t asks only when it is saf e t o do so: • Well-suit ed f or clock-driven environment s. • What about priorit y-driven environment s? (quit e complicat ed) Examples = T ( 3 , 1 ) 1 A : r = 0.1 , e = 2.1 = T ( 10 , 4 ) Background: 2 Interrupt-Driven: Slack Stealing: 3
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Polled Execut ion vs. Bandwidt h Preserving Servers • Polling server (p s , e s ) : scheduled as periodic t ask. p s : Poller ready f or execut ion every p s t ime unit s. e s : Upper bound on execut ion t ime. • Terminology: – (Execut ion) budget : e s – Replenishment : set budget t o e s at beginning of period. – Poller consumes budget at rat e 1 while execut ing aperiodic j obs. – Poller exhaust s budget whenever poller f inds aperiodic queue empt y. – Whenever t he budget is exhaust ed, t he scheduler removes t he poller f rom periodic queue unt il replenished. • Bandwidt h-preserving server algorit hms: – I mprove upon polling approach – Use periodic servers – Are def ined by consumpt ion and replenishment rules. Example: Polling Server Rate-Monotonic: A : r = 2.8, e = 1.7 PS =(3, 1) T 1 =( φ =2, 3.5, 1.5) T 2 =( φ =0, 6.5, 0.5) budget 4
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Def errable Servers • Rules: – Consumpt ion: Execut ion budget consumed only when server execut es. – Replenishment : Execut ion budget of server is set t o e s at each mult iple of p s . • Preserves budget when no aperiodic j ob is ready. • Any budget held prior t o replenishment is lost (no cumulat ion). Example: Def errable Server wit h RM Rate-Monotonic: A : r = 2.8, e = 1.7 DS =(3, 1) T 1 =( φ =2, 3.5, 1.5) T 2 =( φ =0, 6.5, 0.5) budget 5
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Example: Def errable Server wit h EDF EDF: A : r = 2.8, e = 1.7 DS=(3,1) T 1 =( φ =2,3.5,1.5) T 2 =( φ =0,6.5,0.5) budget Combinat ion of Def er able Server wit h Background Server A : r = 2.8, e = 1.7 serve in background! DS=(3,1) T 1 =( φ =2,3.5,1.5) T 2 =( φ =0,6.5,0.5) budget 6
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Why not I ncrease t he Budget ? DS=(3,1) T 1 =(3.5,1.5) T 2 =(6.5,0.5) Schedulabilit y f or St at ic-Priorit y Syst ems (DS has highest priorit y) • Lemma: I n a st at ic-priorit y periodic syst em wit h D i < = p i , wit h a def erable server T DS (p s , e s ) wit h highest priorit y, a crit ical inst ant f or T i happens when: (1) r i,c = t 0 f or some j ob J i,c in T i . (2) j obs of higher-priorit y t asks are released at t ime t 0 . (3) budget of (backlogged) server is e s at t ime t 0 . (4) next replenishment t ime is t 0 +e s . • I nt uit ively: Low-priorit y t asks suf f er f rom a “back-t o-back” hit by t he def erable server. 7
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Time-Demand Analysis − − i 1 t e ∑ t = + + + s w ( t ) e e e e i i s s k p p = s k 1 k • Schedulable Ut ilizat ion: – Generally, no known schedulable ut ilizat ion. – Only except ion: • p s < p 1 < p 2 < … < p n < 2p s • p i = D i • r at e-monot onic scheduling • p n > p s + e s – For t his case, t he schedulable ut ilizat ion is 1 + − u 2 n 1 = − − s U ( n ) ( n 1 ) 1 + RM / DS u 1 s Def erable Ser ver s and Ar bit r ar y St at ic Pr ior it y • Problem: Any budget t hat is not consumed at end of server period is lost . • Maximum amount of t ime DS can consume depends on – Release t ime of all periodic j obs (wit h respect t o replenishment t imes) – Execut ion t imes of all t asks. • Upper bound on t ime demand f or lower-priorit y t asks t han DS : − − ∑ i 1 t e t ≤ + + + s w ( t ) e e e e i i s s k p p = k 1 s k • Mult iple def erable servers: – Time demand f or t ask wit h priorit y lower t han m DS ’s: − − m i 1 ∑ t e ∑ t ≤ + + + + s , q w ( t ) e e 1 e e , i i s s q k p p = = q 1 s , q k 1 k 8
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Using t he Schedulable Ut ilizat ion: • Assume t hat T i has lower priorit y t han server. • T DS (p s , e s ) behaves like a periodic t ask (p s , e s ) , except t hat it may execut e f or at most e s addit ional t ime unit s during t he int erval (r i,c , r i,c +D i ) . + e b i ∑ + + ≤ + u u U ( i 1 ) s i k s X p = k 1 i • Example: scheduling algorithm • T 1 : not affected by T DS T ( 3 , 0 . 6 ) 1 T ( 4 , 0 . 8 ) 2 e ∑ + + = ≤ = DS u u s 0 . 66 0 . 7797 U ( 3 ) • T 2 : k s p RM T ( 5 , 0 . 5 ) k = 1 2 2 no! T ( 7 , 1 . 4 ) 3 e ∑ + + = ≤ = 3 u u s 0 . 8143 0 . 757 U ( 4 ) • T 3 : k s p RM k = 1 3 Schedulabilit y f or Deadline-Driven Syst ems • Lemma: A periodic t ask T i in a syst em of n independent , preempt ive periodic t asks is schedulable wit h a DS wit h period p s , execut ion t ime e s , and ut ilizat ion u s , according t o t he EDF algorit hm if − e p e n ∑ + + ≤ u 1 1 k s s s min( D , p ) D = k 1 k k i 9
CPSC-663: Real-Time Systems Aperiodic and Sporadic Jobs Proof Proof: • Let t be the deadline of some Job J i,c . • Let t -1 be the last point in time before t where either processor idle, or was executing a lower-priority task (deadline after t ). J ic misses deadline here! ... e s e s e s e s t -1 +e s t -1 t p s If J ic misses deadline at time t , total amount of processor time consumed by Deferrable Server during interval ( t -1 , t ] is bounded by : − − t t e + e − 1 s e s s p s Proof (I I ) P roof : • Time consumed by def errable server: − − − − t t e t t e − = + ≤ + = − + − w ( t t ) e − s e e − s e u ( t t p e ) 1 1 − − DS 1 s s s s s 1 s s p p s s • Time consumed by Task T k : − t t − = ≤ − w ( t t ) e − 1 e ( t t ) / p − − k 1 k p k 1 k k • We used “f loor” inst ead of “ceiling” because last invocat ion has deadline af t er t . • We miss deadline if we don’t have enough t ime t o f inish by t ime t : e n ∑ − < − + − + − t t ( t t ) u ( t t p e ) k − − s − s s 1 p 1 1 = k 1 k • Divide by (t – t -1 ) and go f rom t here. 10
Recommend
More recommend