AADL : about schedulng analyss Schedulng analyss, what s t? Embedded real-tme crtcal systems have temporal constrants to meet (e.g. deadlne). Many systems are bult wth operatng systems provdng multtaskng facltes Tasks may have deadlne. But, tasks make temporal constrants analyss dffcult to do : We must take the task schedulng nto account n order to check task temporal constrants. Schedulng (or schedulablty) analyss. page 2
Summary 1. Issues about real-tme schedulng analyss : AADL to the rescue 2. Bascs on schedulng analyss : fxed-prorty schedulng for unprocessor archtectures 3. AADL components/propertes to schedulng analyss page 3 Real-Tme schedulng theory 1. A set of smplfed tasks models (to model functons of the system) 2. A set of analytcal methods (called feasblty tests) Example: R Deadlne = C + hp( ) R C P 3. A set of schedulng algorthms: buld the full schedulng/gantt dagram R page 4
Real-Tme schedulng theory s hard to apply Real-Tme schedulng theory Theoretcal results defned from 1974 to 1994: feasblty tests exst for unprocessor archtectures Now supported at a decent level by POSIX 1003 real-tme operatng systems, ARINC653, Industry demandng Yet, hard to use page 5 Real-Tme schedulng theory s hard to apply Requres strong theoretcal knowledge/sklls Numerous theoretcal results: how to choose the rght one? Numerous assumptons for each result. How to abstract/model a system to verfy deadlnes? How to ntegrate schedulng analyss n the engneerng process? When to apply t? What about tools? It s the role of an ADL to hde those detals page 6
AADL to the rescue? AADL helps modelng a full system, ncludng hardware, task sets, connectons, operatng system features, All of these elements are mandatory to apply real-tme schedulng theory Examples: an AADL model can nclude Task executon tme or task deadlne or task release tmes Schedulng parameters However, n many cases, the models stay too complex Multprocessor archtectures, shared buffers or buses, page 7 Summary 1. Issues about real-tme schedulng analyss : AADL to the rescue 2. Bascs on schedulng analyss : fxed-prorty schedulng for unprocessor archtectures 3. AADL components/propertes to schedulng analyss page 8
Real-tme schedulng theory : models of task Task smplfed model: sequence of statements + data. page 9 Usual knd of tasks: Independent tasks or dependent tasks. Perodc and sporadc tasks (crtcal functons) : have several obs and release tmes Aperodc tasks (non crtcal functons) : only one ob and one release tme Real-tme schedulng theory : models of task Usual parameters of a perodc task : Perod: P (duraton between two release tmes). A task starts a ob for each release tme. Deadlne to meet: D, tmng constrant to meet. Frst task release tme (frst ob): S. Worst case executon tme of each ob: C (or capacty or WCET). Prorty: allows the scheduler to choose the task to run page 10
Real-tme schedulng theory : models of task page 11 Unprocessor fxed prorty schedulng Fxed prorty schedulng : Schedulng based on fxed prorty => prortes do not change durng executon tme. Prortes are assgned at desgn tme (off-lne). Effcent and smple feasblty tests. Scheduler easy to mplement nto real-tme operatng systems. Rate Monotonc prorty assgnment : Optmal assgnment n the case of fxed prorty schedulng and unprocessor. Perodc tasks only. page 12
Unprocessor fxed prorty schedulng Two steps: 1. Rate monotonc prorty assgnment: the hghest prorty tasks have the smallest perods. Prortes are assgned off-lne (e.g. at desgn tme, before executon). 2. Fxed prorty schedulng: at any tme, run the ready task whch has the hghest prorty level. page 13 Unprocessor fxed prorty schedulng Rate Monotonc assgnment and preemptve fxed prorty schedulng: Assumng VxWorks prorty levels (hgh=0 ; low=255) T1 : C1=6, P1=10, Pro1=0 T2 : C2=9, P2=30, Pro2=1 page 14
Unprocessor fxed prorty schedulng Feasblty/Schedulablty tests to predct on desgn-tme f deadlne wll be met: page 15 1. Run smulatons on hyperperod = [0,LCM(P)]. Suffcent and necessary condton. 2. Processor utlzaton factor test: = /.(2-1) (about 69%) Rate Monotonc assgnment and preemptve schedulng. Suffcent but not necessary condton. 3. Task worst case response tme, noted R : delay between task release tme and task completon tme. Any prorty assgnment but preemptve schedulng. Unprocessor fxed prorty schedulng Compute R, task worst case response tme: Task response tme = task capacty + delay the task has to wat for hgher prorty task. Or: R = C + hp() watng tme due to or R = C + hp( ) R C P hp() s the set of tasks whch have a hgher prorty than task. returns the smallest nteger not smaller than x. page 16
Unprocessor fxed prorty schedulng page 17 Unprocessor fxed prorty schedulng Example: T1(P1=7, C1=3), T2 (P2=12, C2=2), T3 (P3=20, C3=5) 1 =1=3 "1=3 2 =2=2 2 =C2+ 2 1.1=2+ 2 7.3=5 2 =C2+ 2 1.1=2+ 5 7.3=5 "2=5 3 =3=5 3 =C3+ 3 1 3 =C3+ 3 1 3 =C3+ 3 1 3 =C3+ 3 1 3 =C3+ 3 1 page 18.1+ 3 2.2 =10.1+ 3 2.2=13.1+ 3 2.2=15.1+ 3 2.2=18.1+ 3 2.2=18 "3=18
Unprocessor fxed prorty schedulng Example wth the AADL case study: dsplay_panel thread whch dsplays data. P=100, C=20. recever thread whch sends data. P=250, C=50. analyser thread whch analyzes data. P=500, C=150. Processor utlzaton factor test: U=20/100+150/500+50/250=0.7 Bound=3.(2 $ 1)=0.779 U Bound => deadlnes wll be met. Task response tme: & '(')*+,- =330, &./+0)'*_0'(,) =20, & -,2,/3,- =70. Run smulatons on hyperperod: [0,LCM(P)] = [0,500]. page 19 Unprocessor fxed prorty schedulng page 20
Fxed prorty and shared resources Prevous tasks were ndependent does not really exst n true lfe. Task dependences : Shared resources. E.g. wth AADL: threads may wat for AADL protected data component access. Precedences between tasks. E.g wth AADL: threads exchange data by data port connectons. page 21 Fxed prorty and shared resources Shared resources are modeled by semaphores for schedulng analyss. We use specfc semaphores mplementng nhertance protocols: To take care of prorty nverson. To compute worst case task watng tme for the access to a shared resource. Blockng tme B. Inhertance protocols: PIP (Prorty nhertance protocol), can not be used wth more than one shared resource due to deadlock. PCP (Prorty Celng Protocol), mplemented n most of real-tme operatng systems (e.g. VxWorks). Several mplementatons of PCP exsts: OPCP, ICPP, page 22
Fxed prorty and shared resources What s Prorty nverson: a low prorty task blocks a hgh prorty task 5 = worst case on the shared resource watng tme. page 23 Fxed prorty and shared resources ICPP (Immedate Celng Prorty Protocol): Celng prorty of a resource = maxmum fxed prorty of the tasks whch use t. Dynamc task prorty = maxmum of ts own fxed prorty and the celng prortes of any resources t has locked. 5 =longest crtcal secton ; prevent deadlocks page 24
Fxed prorty and shared resources How to take nto account the watng tme B: Processor utlzaton factor test :,1 > 9: :;: +9 <= ;.(2? 1) Worst case response tme : R = B + C + hp( ) R C P page 25 To conclude on schedulng analyss Many feasblty tests: dependng on task, processor, scheduler, shared resource, dependences, multprocessor, herarchcal, dstrbuted, R = B + C + hp( ) R C P R R = C + C + max( Ck k hp( )) hp ( ) P R = C + hp( ) R C P R = w + J Many assumptons : requre preemptve, fxed prorty schedulng, synchronous perodc, ndependent tasks, deadlnes on requests w = C + hp( ) R + J C P Many feasblty tests. Many assumptons How to choose them? page 26
Summary 1. Issues about real-tme schedulng analyss : AADL to the rescue 2. Bascs on schedulng analyss : fxed-prorty schedulng for unprocessor archtectures 3. AADL components/propertes to schedulng analyss page 27 AADL to the rescue? Issues: Ensure all requred model elements are gven for the analyss Ensure model elements are complant wth analyss requrements/assumptons AADL helps for the frst ssue: page 28 AADL as a pvot language between tools. Internatonal standard. Close to the real-tme schedulng theory: real-tme schedulng analyss concepts can be found. Ex: Component categores: thread, data, processor Property: Deadlne, Fxed Prorty, ICPP, Celng Prorty,
Property sets for schedulng analyss Propertes related to processor component: Preemptve_Scheduler : aadlboolean apples to (processor); Schedulng_Protocol: nhert lst of Supported_Schedulng_Protocols apples to (vrtual processor, processor); -- RATE_MONOTONIC_PROTOCOL, -- POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL,.. page 29 Property sets for schedulng analyss Propertes related to the threads/data components: Compute_Executon_Tme: Tme_Range apples to (thread, subprogram, ); Deadlne: nhert Tme => Perod apples to (thread, ); Perod: nhert Tme apples to (thread, ); Dspatch_Protocol: Supported_Dspatch_Protocols apples to (thread); -- Perodc, Sporadc, Tmed, Hybrd, Aperodc, Backgr... Prorty: nhert aadlnteger apples to (thread,, dat page 30 Concurrency_Control_Protocol: Supported_Concurrency_Control_Protocols apples to (dat -- None, PCP, ICPP,
Property sets for schedulng analyss Example: thread mplementaton recever.mpl propertes Dspatch_Protocol => Perodc; Compute_Executon_Tme => 31 ms.. 50 ms; Deadlne => 250 ms; Perod => 250 ms; end recever.mpl; data mplementaton target_poston.mpl propertes Concurrency_Control_Protocol => PRIORITY_CEILING_PROTOCOL; end target_poston.mpl; page 31 process mplementaton processng.others subcomponents recever : thread recever.mpl; analyzer : thread analyzer.mpl; target : data target_poston.mpl;... processor mplementaton leon2 propertes Schedulng_Protocol => RATE_MONOTONIC_PROTOCOL; end leon2; Preemptve_Scheduler => true; system mplementaton radar.smple subcomponents man : process processng.others; cpu : processor leon2;... Cheddar : a framework to access schedulablty of AADL models Cheddar tool = analyss framework (queueng system theory & real-tme schedulng theory) + nternal ADL (archtecture descrpton language) + varous standard ADL parsers (AADL, MARTE UML) + smple model edtor + Two versons : Open source (Cheddar) : educatonal and research. Commercal product (AADLInspector) : Elldss Tech product. Supports : Elldss Tech., Consel régonal de Bretagne, BMO, EGIDE/Campus France, Thales Communcaton, BPI France page 32
Cheddar : a framework to access schedulablty of AADL models Demos: Schedulng analyss of the radar example wth Cheddar.. And wth AADLInspector also page 33