jian-jia.chen [ ] u-dormund.de lea.schoenberger [ ] u-dormund.de Exercise for he lecure Embedded Sysems Winersemeser 17/18 Wrien Exercise Shee 5 Hins: These assignmens will be discussed a E23 OH14, from 10:15 am - 11:45 am on 20. Dez. 2017. You are no obligaed o urn in he soluions. T i indicaes he period of ask τ i, D i is relaive deadline, and C i is WCET. 1 Schedulabiliy Analysis Consider he following parameers for periodic asks wih T i = D i under rae-monoonic scheduling: T i C i τ 1 5 1 τ 2 8 3 τ 3 9 2 Assume ha he asks shall be execued on a single core sysem. Which is he hyperperiod? Examine formally, if a schedule wih he given parameers exiss, and verify your resul. Wha are your findings? Why? Hyperperiod: 360 Criical insan: schedulable. Liu/Layland: 0.7972 0.7797, possibly no schedulable. 2 Scheduling of independen periodic asks The following ask diagram is given: Task 1 Task 2 0 5 10 15 20 25 30 35 40 Indicae he parameers of he asks (C i, T i = D i ). Which scheduling policy was possibly used? Why? Draw he diagram for he case ha he asks are ordered according o a rae monoonic scheduling policy. Wha do you noice? EDF RM schedule: Task 2 misses is deadline. Task 1 Task 2 0 2 4 6 8 10 12 14
3 Harmonic Task Sysems Consider he following parameers for periodic asks wih T i = D i : C i 0.2 2 2 1.5 1 14 28.8 T i 2 6 12 24 24 72 288 D i 2 6 12 24 24 72 288 U i 0.1 1/3 1/6 0.0625 0.0417 0.195 0.1 Assume he asks shall be execued on a single core sysem. Deermine formally if he rae monoonic schedule is feasible. Deermine formally if he earlies deadline firs schedule is feasible. RM: 0.9952 < 1, feasible, cf. Theorem of Kuo and Moc, es-chen-4.3.pdf, slide 29. EDF: 0.9952 < 1, feasible. 4 Criical Insan Theorem Explain he criical insan heorem for uniprocessor fixed-prioriy scheduling in your words. As menioned in he lecure, he criical insan heorem for uniprocessor fixed-prioriy scheduling is very fragile if he assumpions are no me. To apply he criical insan heorem, quie a few condiions have o be saisfied. Please indicae which of he following condiions are correc and which of hem are incorrec. If a condiion is incorrec, please correc i. The ask se consiss of only independen asks. The ask se mus be sricly periodic. The scheduling algorihm is fixed-prioriy preempive scheduling. Early compleion of jobs is no possible. A job has o spin ill is wors-case execuion ime if i finishes earlier. No ask volunarily suspends iself. Tha is, a job canno suspend iself during is execuion. The relaive deadline of a ask can be larger han is period. Scheduling overheads (conex swich overheads) are zero. All periodic/sporadic asks have zero release jier (he ime from he ask arriving o i becoming ready o execue). Incorrec. Incorrec. Incorrec.
5 Periodic Tasks Is he following program a periodic ask wih period T? Explain your answer. while (rue) sar := ge he sysem ick; perform analog-o-digial conversion o ge y; compue conrol oupu u; oupu u and do digial-o-analog conversion; end := ge he sysem ick; imetosleep := T-(end-sar); sleep imetosleep; end while No. The ask can be preemped/inerruped beween end and sleep. 6 Prioriy Inversion We are considering a sysem wih hree jobs J 1, J 2 and J 3. The prioriy of job 1 is assumed o be highes, he prioriy of job 3 is assumed o be lowes. These jobs become available as indicaed in he following diagram. Job J 3 execues 2 ime unis afer i becomes available and afer 4 ime unis of execuion ime. (J 3 runs for 2 ime unis firs and hen eners he criical secion. Is criical secion lengh is 2 ime unis.) Is oal execuion ime is 8 unis of ime. Job J 2 has a oal execuion ime of 25 ime unis. Job J 1 execues afer 2 unis of execuion ime and afer 5 unis of execuion ime. (J 1 runs for 2 ime unis firs and hen eners he criical secion. Is criical secion lengh is 3 ime unis.) Is oal execuion ime is 6 unis of ime. Wha is he schedule of he sysem if we use pre-empive, prioriy-based scheduling? Include calls o and. Mark ime inervals of prioriy inversion. J 1 J 2 J 3 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 prioriy inversion (direc only) prioriy inversion (direc and blocking) Wha is he schedule of he sysem if we use pre-empive, prioriy-inheriance proocol (PIP)? Include calls o and. Mark ime inervals of prioriy inversion.
J 1 J 2 J 3 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 prioriy inversion (direc and blocking) 7 PCP Example Draw he curren prioriy ceiling Π () of he sysem and he curren prioriy of he jobs in he wo examples of PCP (i.e., x axis wih respec o ime and y axis wih respec o he prioriy levels) given in he lecure (i.e., Pages 19 and 20 in es-chen-4.4.pdf). 8 Disribued PCP (DPCP) (advanced**) Consider a sysem wih muliple processors. A ask is saically assigned on one processor. One addiional processor, P 0, is allocaed as a synchronizaion processor. Tha is, all he criical secions are execued on processor P 0 by using PCP under he rae-monoonic prioriy assignmen. This proocol, called Disribued PCP (DPCP), was proposed by Raj Rajkumar in 1990. In he following concree example, we have hree asks, each of hem assigned on one processor and all he criical secions are proeced by using one binary semaphore. Therefore, muli-asking only akes place on P 0. Task τ 1 is on processor P 1, ask τ 2 is on processor P 2, and ask τ 3 is on processor P 3. In Tabelle 1, for a ask τ k, C k is he wors-case execuion ime (including he criical secion lengh), T k is he period, N k is he number of criical secions per job invocaion, and L k is he wors-case criical secion lengh (per criical secion). Noe ha early compleions are possible. To analyze wheher ask τ k can mee is deadline, we need o analyze is remoe blocking ime B k on P 0. In he above simple example, since here is only one ask per processor (excep P 0 ), we can hen simply validae wheher B k +C k T k. By using he criical insan heorem, Mr. Smar argues ha he addiional delay due o PCP on P 0 for ask τ k is upper bounded by L k (max j>k L j ) + k 1 i=1 Tk T i L i N i =. The firs erm L k (max j>k L j ) is due o he fac
ha each criical secion access can be blocked by a lower-prioriy ask. The second erm k 1 Tk i=1 T i L i N i is due o he inerference from he higher-prioriy asks under he criical insan heorem. Therefore, he concludes ha B 1 is upper bounded by 4, B 2 is upper bounded by 1 + 2 2 = 5, and B 3 is upper bounded by 0 + 2 2 + 4 2 = 12. Since C k + B k T k k = 1,2,3, he concludes ha his ask se is feasible under DPCP. However, here is a concree counerexample in Abbildung 1, showing ha ask τ 3 misses he deadline. Wha wen wrong in he above analysis? job release normal execuion criical secion waiing for criical secions P 0 : A q τ 2 τ 1 τ 3 τ 1 τ 3 τ 2 τ 1 τ 3 P 1 : τ 1 P 2 : τ 2 miss deadline P 3 : τ 3 0 2 4 6 8 10 12 14 16 18 20 22 24 26 Abbildung 1: An example schedule where τ 3 misses a deadline τ k P(τ k ) C k T k (= D k ) N k L k τ 1 P 1 6 10 1 2 τ 2 P 2 11 18 1 4 τ 3 P 3 8 20 3 1 Tabelle 1: Task parameers for he counerexample. You can imagine ha τ i suspends from P 0 when i is execued on P i. Therefore, he calculaion k 1 i=1 Tk T i L i N i is purely based on he criical insan heorem which does no hold when asks suspend hemselves.