Real-Tme Systems Multprocessor schedulng Specfcaton Implementaton Verfcaton Multprocessor schedulng -- -- Global schedulng How are tasks assgned to processors? Statc assgnment The processor(s) used for executng a task are determned before system s put n msson ( off-lne ) Approach: Dynamc assgnment The processor(s) used for executng a task are determned durng system operaton on-lne Approach: Global schedulng Multprocessor schedulng Multprocessor schedulng How are tasks allowed to mgrate? No mgraton! Each nstance of a task must execute on the same processor Equvalent to multple unprocessor systems! Global schedulng Full mgraton! A task s allowed to execute on an arbtrary processor Mgraton can occur even durng executon of an nstance of a task (for example, after beng preempted) A fundamental lmt: (Andersson, Baruah & Jonsson, 00) The utlzaton guarantee bound for multprocessor schedulng (parttoned or global) usng statc task prortes cannot be hgher than / of the capacty of the processors. Hence, we should not expect to utlze more than half the processng capacty f hard real-tme constrants exst. A way to crcumvent ths lmt s to use p-far (prortes + tme quanta) schedulng and dynamc task prortes.
General characterstcs: Each processor has ts own queue for ready tasks Tasks are organzed n groups, and each task group s assgned to a specfc processor For example, usng a bn-packng algorthm When selected for executon, a task can only be dspatched to ts assgned processor Advantages: Mature schedulng framework Most unprocessor schedulng theory also applcable here Unprocessor resource-management protocols can be used Supported by automotve ndustry AUTOSAR prescrbes parttoned schedulng Dsadvantages: Cannot explot all unused executon tme Surplus capacty cannot be shared among processors Wll suffer from overly-pessmstc WCET dervaton Bn-packng algorthms: Basc dea: The problem concerns packng objects of varyng szes n boxes ( bns ) wth the objectve of mnmzng number of used boxes. Applcaton to multprocessor systems: Bns are represented by processors and objects by tasks. The decson whether a processor s full or not s derved from a utlzaton-based feasblty test. Assumptons: Independent, perodc tasks Preemptve, unprocessor schedulng (RM) Bn-packng algorthms: Rate-Monotonc-Frst-Ft (RMFF): (Dhall and Lu, 978) Let the processors be ndexed as μ,μ, Assgn the tasks n the order of ncreasng perods (that s, RM order). For each task, choose the lowest prevously-used j such that, together wth all tasks that have already been assgned to processor μ j, can be feasbly scheduled accordng to the utlzaton-based RM-feasblty test. Processors are added f needed for RM-schedulablty.
(ths page delberately left blank) Bn-packng algorthms: U RMFF The utlzaton guarantee bound for a system wth m processors usng RMFF schedulng s m( / ) U RMFF (Oh & Baker, 998) Note: ( / ) 0.4 Thus: task sets whose utlzaton do not exceed 4% of the total processor capacty s always RMFF-schedulable. Global schedulng General characterstcs: All ready tasks are kept n a common (global) queue that s shared among the processors Whenever a processor becomes dle, a task from the global queue s selected for executon on that processor. After beng preempted, a task may be dspatched to a processor other than the one that started executng the task. Global schedulng Advantages: Supported by most multprocessor operatng systems Wndows 7, Mac OS X, Lnux,... Effectve utlzaton of processng resources Unused processor tme can easly be reclamed, for example when a task does not execute ts full WCET. Dsadvantages: Few results from the unprocessor case can be used 3
The root of all evl n global schedulng: (Lu, 969) Few of the results obtaned for a sngle processor generalze drectly to the multple processor case; brngng n addtonal processors adds a new dmenson to the schedulng problem. The smple fact that a task can use only one processor even when several processors are free at the same tme adds a surprsng amount of dffculty to the schedulng of multple processors. Underlyng causes: Dhall s effect: Wth RM, DM and EDF, some low-utlzaton task sets can be unschedulable regardless of how many processors are used. Thus, any utlzaton guarantee bound would become so low that t would be useless n practce. Ths s n contrast to the unprocessor case where we have utlzaton guarantee bounds of 69.3% (RM) and 00% (EDF). Hard-to-fnd crtcal nstant: A crtcal nstant does not always occur when a task arrves at the same tme as all ts hgher-prorty tasks. Ths s n stark contrast to the unprocessor case! Dhall s effect: (Dhall & Lu, 978) (RM schedulng) { C, ε T } { C, ε T } { C3, ε T3 } { C, T + ε} 4 4 4 Dhall s effect: Apples for RM, DM and EDF schedulng Least utlzaton of unschedulable task sets can be arbtrarly close to no matter how many processors are used. μ 4 4 msses ts deadlne U global m ε + ε + when ε 0 μ μ 3 0 ε + ε Consequence: New multprocessor prorty-assgnment schemes are needed! 4
Hard-to-fnd crtcal nstant: 3 μ μ (RM schedulng) response tme of 3 s maxmzed for second nstance, 3,,,3,4 3,,5 3,3,6,7 3,4,8,,,,,3,3,4,5,4 { C, T } { C, T 3} { C, T 4} 3 3 3 0 4 8 6 Hard-to-fnd crtcal nstant: A crtcal nstant does not always occur when a task arrves at the same tme as all ts hgher-prorty tasks. Fndng the crtcal nstant s a very (NP-?) hard problem Note: recall that knowledge about the crtcal nstant s a fundamental property n unprocessor feasblty tests. Consequence: New methods for constructng effectve multprocessor feasblty tests are needed! New prorty-assgnment scheme Dhall s effect: (Dhall & Lu, 978) (RM schedulng) 4 { C, ε T } { C, ε T } { C3, ε T3 } { C, T + ε} 4 4 4 4 msses ts deadlne How to avod Dhall s effect: Problem: RM, DM & EDF only account for task deadlnes! Actual computaton demands are not accounted for. Soluton: Dhall s effect can easly be avoded by lettng tasks wth hgh utlzaton receve hgher prorty: μ μ 4 4 μ μ μ 3 0 ε + ε μ 3 0 ε + ε 5
New prorty-assgnment scheme Example: RM-US[m/(3m-)] RM-US[m/(3m-)]: (Andersson, Baruah & Jonsson, 00) RM-US[m/(3m-)] assgns (statc) prortes to tasks accordng to the followng rule: If U > m/(3m ) then has the hghest prorty (tes broken arbtrarly) If U m/(3m ) then has RM prorty Clearly, tasks wth hgher utlzaton, U C / T, get hgher prorty. Problem: Assgn prortes accordng to RM-US[m/(3m-)], assumng the followng task set to be scheduled on a system wth m 3 processors: { C, T 7} { C, T 0} 3 { C3 9, T3 0} 4 { C4, T4 } { C, T 5} 5 5 5 We solve ths on the blackboard! New feasblty tests New feasblty tests Processor utlzaton analyss for RM-US[m/(3m-)]: A suffcent condton for RM-US[m/(3m-)] schedulng on m dentcal processors s n C m U T 3m Queston: does RM-US[m/(3m-)] avod Dhall s effect? Processor utlzaton analyss for RM-US[m/(3m-)]: We observe that, regardless of the number of processors, the task set wll always meet ts deadlnes as long as no more than one thrd of the processng capacty s used: U RM US m m m [ /(3m )] lm m 3 m 3 RM-US[m/(3m-)] thus avods Dhall s effect snce we can always add more processors f deadlnes were mssed. Note that ths remedy was not possble wth tradtonal RM. 6
New feasblty tests Response-tme analyss for multprocessors: Uses the same prncple as the unprocessor case, where the response tme for a task conssts of: C I The task s unnterrupted executon tme (WCET) Interference from hgher-prorty tasks R C + I The dfference s that the calculaton of nterference now has to account for the fact that hgher-prorty tasks can execute n parallel on the processors. New feasblty tests Response-tme analyss for multprocessors: For the multprocessor case, wth n tasks and m processors, we observe two thngs:. Interference can only occur when n> m. { }. Interference can only affect tasks k : k > m snce the m hghest-prorty tasks wll always execute n parallel wthout contenton on the m processors. Consequently, nterference of a task s a functon of the executon overlap of ts hgher-prorty tasks. New feasblty tests New feasblty tests Response-tme analyss for multprocessors: The followng two observatons gve us the secret to analyzng the nterference of a task: Wth respect to the executon overlap t can be shown that the nterference s maxmzed when the hgher-prorty tasks completely overlap ther executon. Compared to the unprocessor case, one extra nstance of each hgher-prorty task must be accounted for n the nterference analyss. Response-tme analyss for multprocessors: The worst-case nterference term s R I Cj + Cj m j hp() T j where hp() s the set of tasks wth hgher prorty than. The worst-case response tme for a task s thus: R R C + Cj + Cj m j hp() T j 7
New feasblty tests Global schedulng Response-tme analyss for multprocessors: As before, an teratve approach can be used for fndng the worst-case response tme: n n R + R C + Cj + Cj m j hp() T j We now have a suffcent condton for statc-prorty schedulng on multprocessors: : R D State-of-the-art n global schedulng: Statc prortes: RM-US[m/(3m-)] crcumvents Dhall s effect and has a non-zero resource utlzaton guarantee bound of m/(3m-) 33.3%. In 003, Baker generalzed the RM-US results to DM. Dynamc prortes: In 00, Srnvasan & Baruah proposed the EDF-US[m/(m-)] scheme wth a correspondng non-zero resource utlzaton guarantee bound of m/(m-) 50%. Optmal multprocessor schedulng: Usng p-far (prortes + tme quanta) schedulng and dynamc prortes t s possble to acheve 00% resource utlzaton on a multprocessor. 8