Real-Time Scheduling Sysem Model Task is a schedulable eniy, i.e., a hread Time consrains of periodic ask T: - s: saring poin - e: processing ime of T - d: deadline of T - p: period of T Periodic ask T - r: rae of T (r = 1/p) e d p 0 s - 0 e d p - s: firs ime he periodic ask requires processing - a s + (k - 1) p ask T is ready for k processing - processing of T in period k mus be finished a s + (k - 1) p + d - for coninuous media asks i is assumed ha he deadline of period (k - 1) is he ready ime of period k 1 Classificaion of RT Scheduling - I Real-ime: he resul of operaions and he response ime are of imporance -> ime-dependen daa Real-Time Scheduling Sof Hard Dynamic Saic Pre-empive Non-pre-empive Pre-empive Non-pre-empive according o: S. Mullender: Disribued Sysems, Addison Wesley, 2nd Ediion, 1993, pp.491 Hard real-ime: - missing a deadline is disasrous - he deadlines of all criical asks mus be guaraneed a priori Sof real-ime: - missing a deadline is no disasrous - resul is sill of some ineres afer deadline is expired 2
Classificaion of RT Scheduling - II Dynamic scheduling - makes scheduling decisions a run-ime on he basis of curren requess - flexible o adap o an evolving ask scenario - considers only acual ask requess and execuion ime parameers - subsanial effor a run-ime o find a schedule Saic scheduling - also called pre-run-ime - makes scheduling decisions off-line - generaes a dispaching able for run-ime dispacher a compile ime - complee prior knowledge abou ask se characerisics necessary - small run-ime overhead 3 Classificaion of RT Scheduling - IV Dynamic scheduling of independen asks: - Rae Monoonic - Earlies-Deadline-Firs (EDF) - Leas Laxiy Dynamic scheduling of dependen asks: - kernelized monior - prioriy-ceiling proocol 4
Schedulabiliy Tes Service User CONNECT.reques (QoS_requiremens) Service Provider Schedulabiliy Tes Admission Conrol Nework Bandwidh CPU Time Tes o deermine wheher a schedule exiss For periodic ask ses feasible, because he fuure is known Schedulabiliy es for ask se {T i } of periodic asks: - T i has period p i, deadline d i, and processing ime e i - he ask se is only schedulable if µ = e i --- n p i 5 Rae Monoonic - I Classic scheduling algorihm for hard real-ime sysems wih one CPU Dynamic pre-empive algorihm based on saic ask prioriies Assumpions on he ask se: 1. The requess for all asks of he ask se {T i } for which hard deadline exis are periodic 2. All asks are independen of each oher. There exiss no precedence consrains or muual exclusion consrains beween any pair of asks. 3. The deadline of every ask T i is equal o is periode p i. 4. The required maximum compuaion ime of each ask e i is known a priori and is consan. 5. The ime required for conex swiches can be ignored. 6. The sum of he uilizaion facors µ of he n asks µ = c i --- n( 2 1 n 1) p i 6
Rae Monoonic - II Scheduling is done a saring ime s Assigns saic prioriies on he basis of ask periods - ask wih shores period ges highes saic prioriy - ask wih longes period ges lowes saic prioriy Run-ime dispacher always selecs ask reques wih he highes saic prioriy Task 1 Task 2 Dispaching e1 s 1 { { Task 1 has highes prioriy p 1 p 2 e 2 s 2 Task 2 has highes prioriy Pre-empion of ask 1 7 Rae Monoonic - III If all assumpions are saisfied, rae monoonic guaranees ha all asks will mee heir deadline Proof is based on criical insance: - a criical insance for a ask is he poin in ime a which he reques will have he larges response ime - for he enire sysem he criical insance occurs, when requess for all asks Task 1 Task 2 Task 3 Dispaching are made simulaneously 8
Rae Monoonic - IV Assumpion 6 can be relaxed if he ask periods are muliples of he period of he highes prioriy ask In his case, uilizaion facor µ can approach 1: µ = e i --- 1 p i 9 Earlies-Deadline-Firs (EDF) - I Opimal dynamic pre-empive algorihm based on dynamic prioriies Assumpions (1) o (5) mus hold: 1. The requess for all asks of he ask se {T i } for which hard deadlines exis are periodic 2. All asks are independen of each oher. There exiss no precedence consrains or muual exclusion consrains beween any pair of asks. 3. The deadline of every ask T i is equal o is period p i. 4. The required maximum compuaion ime of each ask e i is known a priori and is consan. 5. The ime required for conex swiches can be ignored. Processor uilizaion µ can go up o 1 independen of he ask periods 10
Earlies-Deadline-Firs (EDF) - II Afer any significan even (e.g., new ask eners sysem, ransiion from sae blocked o sae ready) he ask wih he earlies deadline is assigned he highes dynamic prioriy Wih every arriving ask, prioriies migh have o be adjused Run-ime dispacher always selecs ask reques wih he highes prioriy 11 EDF versus Rae Monoonic - I Conex swiches Task I Task II EDF Rae Monoonic 1 2 3 4 5 6 7 8 A B C D 1 A 2 3 B 4 5 C 6 7 D 8 1 A 2 3 B 4 5 C 6 7 D 8 If more han one periodic ask is processed, i is very likely ha here migh be more conex swiches in rae monoonic scheduling han in EDF 12
EDF versus Rae Monoonic - II Processor uilizaion Task I Task II EDF Rae Monoonic 1 2 3 4 5 6 7 8 A B C 1 A 2 A 3 B 4 B 5 6 C 7 C 8 1 A 2 A 3 AB 4 B 5 B 6 C 7 C 8 C Deadline Violaions - EDF: maximal uilizaion 1 - Rae-monoonic: maximal uilizaion ln2 (in special siuaions 1) 13