PS-663: Real-Te Systes Handlng Overloads Handlng Overload (G Buttazzo, Hard Real-Te Systes, h 9) auses for Overload Bad syste desgn eg poor estaton of worst-case executon tes Sultaneous arrval of unexpected events Malfunctonng of nput devces babblng dot proble Unpredcted varatons of envronental condtons Operatng syste exceptons aused by anoalous cobnaton of data exceptons handlers ay starve real-te worload
PS-663: Real-Te Systes Handlng Overloads Defntons of Load In standard queueng ory: λ average arrval rate μ ean servce te ρ λμ average load For perodc tass: ρ: syste load U : utlzaton factor ρ U Σ /T For generc set of obs: g(t,t 2 ) ρ(t a,t b ) ax t,t 2 [t a,t b ] t 2 t g(t, t2) : processor deand durng nterval [t, t2] Instantaneous Load Defnton (Instantaneous Load): d ρ (t) d c (t), (d t) ρ partal load for ob J at te t c (t) reanng executon te of J a te t Total load at te t: ρ(t) ax ρ (t) 2
PS-663: Real-Te Systes Handlng Overloads Instantaneous Load: Exaple J ρ (t) 2/3 J 2 ρ 2(t) 3/4 J 3 ρ 3(t) 4/6 0 2 3 4 5 6 7 8 9 0 t ρ(t) 3/4 Instantaneous Load at te t 3 ρ (t) 0 08 06 04 02 00 0 2 3 4 5 6 7 8 9 0 t Instantaneous Load Functon Overload vs Overrun Defnton (Overload): A coputng syste experences Overload when coputaton te deanded by tas set n an nterval exceeds avalable processng te Defnton (Overrun): A tas (ob) experences Overrun when t exceeds ts expected utlzaton Overruns ay occur because of: Actvaton Overrun: ob s actvated before expected arrval te Executon Overrun: ob coputaton te exceeds expected 3
PS-663: Real-Te Systes Handlng Overloads Transent vs Peranent Overload Defnton (Transent Overload): Overload condton occurs for a lted duraton n a syste wth average load less than schedulable utlzaton (*), eg, ρ avg < ρ ax > Defnton (Peranent Overload): Overload condton occurs for a unpredctable duraton n a syste wth average load hgher than schedulable utlzaton, (*), eg, ρ avg > Types of Overload ondtons Transent overloads due to aperodc obs: happen n event-trggered systes Transent overloads due to tas overruns: tass execute (or are actved) ore than expected happen n event-trggered and te-trggered systes Peranent overloads due n perodc tas systes: total utlzaton factor s larger than schedulable utlzaton (*) 4
PS-663: Real-Te Systes Handlng Overloads Perforance Metrc V(f ) Value of tas as functon of fnsh te f reflects portance of tas uulatve Value of Algorth A: Γ A Σ v(f ) Maxu achevable cuulatve Γ*: Γ* : ax A (Γ A ) Dynac (On-Lne) vs layrvoyant Schedulers Exaple: J 0 J 2 2 6 3 6 J 3 0 2 4 6 8 Γ ax 0 (a) 0 2 4 6 J 0 J 2 J 3 2 2 6 3 6 Γ ax 2 0 4 6 8 0 2 4 6 (b) J 0 J 2 2 6 Γ ax 4 3 6 J 3 0 2 4 6 8 (c) 0 2 4 6 5
PS-663: Real-Te Systes Handlng Overloads opettve Factor Queston: What s nu cuulatve be acheved by an algorth on any tas set? Defnton (opettve Factor): A schedulng algorth A has a copettve factor φ A ff t guarantee a cuulatve Γ A > φ A Γ*, where Γ* s cuulatve acheved by optal clarvoyant scheduler EDF has opettve Factor Zero (φ EDF 0) J J 2 v K v 2 εk Fgure 98 Stuaton n whch EDF has an arbtrarly sall copettve factor 6
PS-663: Real-Te Systes Handlng Overloads What s ost of no larvoyance? Theore (Baruah et al): In a syste where loadng factor s than 2 (ρ>2) and tass are proportonal to r coputaton tes (V ), no on-lne algorth guarantee a copettve factor than 25% Proof by adversaral arguent: Scheduler s, clarvoyant scheduler s adversary Adversary generates sequence of tass to nze Γ A /Γ* At end of gae, copare Γ A and Γ* Adversaral Arguent: Tas Generaton Maor tass, of length, and assocated tass, of length ε arbtrarly sall All tass have zero laxty After releasng a aor tass J, adversary releases next aor tas J at te before deadlne of J, s, r d -ε For each aor tas J, adversary ay also create a sequence of assocated tass, [r,d ], such each subsequent assocated tas s released at deadlne of prevous one n sequence Resultng load s ρ 2 Any algorth schedules an assoc tass not schedule J wthn ts deadlne If schedules assoc tas, adversary stops sequence of assoc tass If schedules J, sequence of tass stops wth release of J Sequence has fnte length, e, untl J for soe for 7
PS-663: Real-Te Systes Handlng Overloads Tas Generaton Strategy (II) Maor Tass Assocated Tass ε ε ε ε ε ε ε Player wll never abandon aor tas for assocated tas ( would be neglgble) However, of aor tass are chosen by adversary Let J 0, J,, J,, J be worst-case sequence of tass, WLOG 0 Three ases ase : Player decdes to schedule J 0 : sequence ternates wth J cuulatve obtaned by s 0 cuulatve obtaned by adversary s 0 ε rato s 0 0 0 (We let -) 8
PS-663: Real-Te Systes Handlng Overloads Three ases (II) ase 2: Player decdes to schedule J : sequence ternates wth J 2 cuulatve obtaned by s cuulatve obtaned by adversary s 0 2 rato s (reeber: -) Observaton : φ < φ 0, orwse adversary would have stopped earler : (-)/( 2 ) < / Observaton 2: φ > φ 0, orwse would stuc wth J 0 : (-)/( 2 ) > / Therefore: φ φ 0 > (-)/( 2 ) / And: 2 2 2 0 2 2 Three ases (III) ase : Player decdes to schedule J : sequence ternates wth J cuulatve obtaned by s cuulatve obtaned by adversary s 0 rato s Observaton: φ φ - φ 0 / Thus, and, Worst-case coputaton tes: { 0 9
30 Handlng Overload ondtons Handlng Overload ondtons Handlng Overload ondtons Handlng Overload ondtons Handlng Overload ondtons PS-663: Real-Te Systes PROOF OF THE BOUND 30 30 30 30 Handlng Overloads PROOF OF THE BOUND PROOF OF THE BOUND Handlng Overload ondtons 30 to schedule a tas J, sequence stops wth J and to schedule a tas J, sequence stops wth J and rato cuulatve s PROOF OF THE BOUND rato of THE ofof cuulatve s PROOF OF BOUND to schedule a tas J, sequence stops wth J and PROOF THE BOUND rato of cuulatve s a tasstops about to J, sequence schedule So, what Bound? to Jschedule, sequence wth J wth andstops a tas schedule to sequence stops J wth and J and a tasj, of cuulatve PROOF rato of rato cuulatve s s s OF THE ofrato BOUND cuulatve fp to schedule last tas J, rato of cuulatve rato of cuulatve However, Recall: when tas f However, last, J, J,to schedule to schedule atas J sequence stops wth J and s n: s rato of cuulatve s However, f last tas J, rato of cuulatve toschedule X s, rato of cuulatve also However, f to schedule last J () However: However, f to tas schedule tas J, rato of cuulatve However, f to schedule last Jlast tas f and be chosen such /; s,, rato of cuulatve s choose last ob J ; n: s s f and chosen such /; s, Xbe cuulatve, However, to schedule last J, rato tas () f of f and such /; s, Adversary and be chosen s f and be /; s, such φ < / ; s,, f and such s,a cuulatve f, chosen and such be chosen s, /; /; n we conclude n be worst case, a not acheve chosen such :, than / tes adversary s,, we conclude, such n case,,not acheve a cuulatve n be chosen a worst f and /; s, than / tes adversary s n we conclude, n worst case, a not acheve a cuulatve n worst a a cuulatve n we conclude, case, not acheve, than / tes adversary s n we conclude, n worst case, a not acheve a cuulatve n we conclude, n worst case,a not acheve a cuulatve than Hence, Therefore: / tes adversary s exsts an than satsfes Equaton, t also satsfes followng than / tes adversary s fre / tes adversary s P () case, a not equaton: n we conclude, n worst acheve a cuulatve (95) / adversary s than tes, satsfes t also satsfes Hence, re Equaton followng exsts f R Bettat Thus, (95) sf satsfed and an only s satsfed f an, t also satsfes followng equaton: f re satsfes, Equaton Hence, freexsts an exsts satsfes Equaton t also satsfes followng Hence, followng Hence, f re exsts anexsts Equaton, t also Hence, satsfes Fro we also wrte satsfes equaton: re ansatsfes Equaton, t also satsfes (95) followng equaton: f equaton: equaton: (95) (95) Thus, (95) s satsfed f satsfes andonlyequaton f s satsfed, t also satsfes followng (95) Hence, f re exsts an (95) s 2 Thus, (95) s satsfed f and only Thus, (95) s satsfed f fand onlysatsfed f s satsfed equaton: Thus, (95) s satsfedthe f and only f (II) s satsfed Bound Fro salso wrte Thus,we(95) satsfed f only (95) and f s satsfed Fro we also wrte we also wrte wrte, Thus,Fro (95) s satsfed f and only s satsfed f Fro we also also we wrte Fro Recall: P () 2 Fro we also wrte 2 fro frst obtan and subtractng secondequaton one, we 2 2 2 ) ( ; 2 We rewrte: 2,,, s,,, 2 ( ), and subtractng equaton second equaton we one, we obtan fro fro frst and302 subtractng second frst one, obtan hapter 9 and subtractng subtractng second equaton fro frstfrst one,one, we obtan and equaton fro we obtan second second P andsubtractng equaton fro one, we obtan 2 ( ( ;frst 2 ) ; ) and second equaton fro frst one, we obtan subtractng Or dfferently: ( ) 2 ; ( 2 ) ; ( ) ; 2 X s, s, 2 ( ) ; s, () 2 to ( Or: Hence, ) Equaton s, s equvalent ( ) 2 2 ( ) s, 2 ( ) s, ( ) 0 X 2 (2 ) Therefore: (96) () 2 ( ) Fro ths result, we say tghtest bound on copettve factor of an onlne algorth s gven by sallest rato / (equvalently, largest ) such (96) satsfes (95) Equaton (96) s a recurrence relaton be solved by standard technques [Sha85] The characterstc equaton of (96) s x2 x 0, 0 whch has roots 2 4 2 4
PS-663: Real-Te Systes Handlng Overloads The Bound (III) Recurrence Relaton: 0 2 ( ) The tghtest bound on copettve factor s gven by sallest rato / such recurrence relaton satsfes < - All we need to do s solve recurrence relaton (Standard Dscrete Math) We get 3 cases ( > 4; 4; < 4) Only ase < 4 has soluton