8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
1/75
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
2/75
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
3/75
Solution Manual for Real Time System by Jane W. S. LiuReal Time System by Jane W. S. Liu (Pearson), the book builds on the student's bak!round inOperating System, Embedded System. "t o#ers tehni$ues for shedulin!, resoure aessontrol, and #alidation that are, or are likely to be, %idely used in real time om&utin! and
ommuniation systems. ah al!orithm, &rotool, or mehanism is defined by &seudo ode or
sim&le rules that an ser#e as a startin! &oint of im&lementation. With fe% ee&tions, eahshedulin! al!orithm is aom&anied that your a&&liation %ill meet its real time re$uirement
%hen shedulin! aordin! to the al!orithm.
ere, in net suessi#e &osts, " am !oin! to &ost solutions for the same Tet*book (Real TimeSystem by Jane W. S. Liu). "f you find any diffiulty or %ants to su!!est anythin!, feel free to
omment...+)
Link: http://targetiesnow.blogspot.in/p/solution-manual-for.html
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_12.html
Real Time System by Jane W. S. Liu ha&ter -. Solution/. -.+ 0eause s&oradi 1obs may ha#e #aryin! release times and eeution times, the&eriodi task model may be too inaurate and an lead to undue under utili2ation of the&roessor e#en %hen the inter release times of 1obs are bounded from belo% and their eeutionsare bounded from abo#e. 3s an eam&le, su&&ose %e ha#e a stream of s&oradi 1obs %hose interrelease times are uniformly distributed from 4 to . Their eeution times are uniformlydistributed from to -.
a. What are the &arameters of the &eriodi task if %e %ere to use suh a task to model the stream5
a.
What are the &arameters of the &eriodi task if %e %ere to use suh a task to model the stream5
http://var/www/apps/conversion/tmp/scratch_1/%20http://targetiesnow.blogspot.in/p/solution-manual-for.htmhttp://var/www/apps/conversion/tmp/scratch_1/%20http://targetiesnow.blogspot.in/p/solution-manual-for.htm
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
4/75
Sol+ For the periodic task model we model a task using the lower bound on its period and theupper bound on its execution time (the worst case). n this case! the period! p " #! andthe exeuction time! e " $.
b. om&are the utili2ation of the &eriodi task in &art (a) %ith the a#era!e utili2ation of the
s&oradi 1ob stream.
Sol+ The utili%ation o& a periodic task is its execution time di'ided by its period. n this case periodic " eperiodic*pperiodic " $*# " +.$$$$
,odeling the -ob as a stream o& periodic -obs! the execution time is a random 'ariable Euni&ormly distributed &rom to $ time units! and the period is a random 'ariable / uni&ormlydistributed &rom # to . tili%ation is a random 'ariable that is a &unction o& E and /. nparticular! sporadic " E*/. n general we can &ind the a'erage 'alue o& ! E01! we need tointegrate u ⋅ & u(u)! the probability density &unction o& &rom 2in&inity to in&inity.
3ou can use the rules o& probability to determine & u(u) &rom & e(e) and & p(p). n this case! a&ter abit more math than anticipated we &ind
a.
+! u 4 *
5*6 2 *(6u5)! * 7 u 4 *#
& u(u) " 8! *# 7 u 4 $*
#*(6u5) 2 6*6! $* 7 u 4 *$
+! *$ 7 u
9&ter integrating we &ind sporadic " E01 : +.5+.
The utili%ation with the periodic task model is about $ ; more than i& we use the
a'erage utili%ation.
Solution: http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s -liu.htm l
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
5/75
Real Time System by Jane W. S. Liu ha&ter -.6 Solution
/.-.6+ onsider the real*time &ro!ram desribed by the &suedo ode belo%. 7ames of 1obs are initali.
3t 4 3M, start+ ha#e breakfast and !o to offie83t 9 3M,
if there is lass,teach8lse, help students8
When teach or help is done,eat_lunch8 :ntil 6 PM, sleep8"f there is a seminar,
"f to&i is interestin!,listen8
lse, read 8lse
write in offie8When seminar is o#er, attend soial hour8discuss8
jog8
a) ;ra% a task !ra&h to a&ture the de&endenies amon! 1obs.
Sol+The book was a bit 'ague on some points! so there will be much &lexibility in grading here.
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
6/75
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_2.htm l
Real Time System by Jane W. S. Liu ha&ter -.- Solution
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_29.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_29.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_29.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_29.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
7/75
/.-.-+ job_1
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
8/75
Sol+
/roducers and consumers do not synchroni%e! so there are no precedence constraints between
producers and consumers. 3ou may ha'e drawn arrows to show precedence constraints
between each -ob with the same release time! implied by the program listing. The whole
schedule repeats e'ery A*6+ths " *$+th o& a second.
b) Re&eat &art (a), assumin! that &roduers and onsumers do synhroni2e.
Sol+ The text says inner loops depend on outer loops and a'ionics tasks! output depends on
inner loops. & you drew the constraints based on program order! only a &ew additional arcs
need to be drawn because the program order causes the dependencies to be satis&ied.
http://4.bp.blogspot.com/-scP4vlYjYb8/Um9lxYwoh6I/AAAAAAAAABc/-qCMqN1S9aE/s1600/neerajblognow7.jpg
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
9/75
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_30&&.html
Real Time System by Jane W. S. Liu ha&ter =. Solution
/.=.+ The feasible inter#al of eah 1ob in the &reedene !ra&h in fi!ure =P* is !i#en net to itsname. The eeution time of all 1obs are e$ual to .
a) >ind the effeti#e release times and deadlines of the 1obs in the &reendene !ra&h in >i!ure =P*.
Real Time System by Jane W. S. Liu Chapter 4.1 Solution
/.=.+ The feasible inter#al of eah 1ob in the &reedene !ra&h in fi!ure =P* is !i#en net toits name. The eeution time of all 1obs are e$ual to .
a) >ind the effeti#e release times and deadlines of the 1obs in the &reendene !ra&h in >i!ure =P*
.
Sol+
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3066.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3066.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3066.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3066.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
10/75
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
11/75
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_1'#.htm l
Real Time System by Jane W. S. Liu ha&ter =.6 Solution/.=.6+ The eeution times of the 1obs in the &reedene !ra&h in fi!ure =P*6 are all e$ual to, and their release times are idential. Bi#e a non &reem&ti#e o&timal shedule that minimi2esthe om&letion time of all 1obs on three &roessors. ;esribe briefly the al!orithm you used tofind the shedule.
Sol+ Execution time o& all -obs eual to . Release times are identical! non preempti'e optimal
solution
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_"0!2.htm l
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4082.htmlhttp://4.bp.blogspot.com/-h-At2riolpo/Um-0lCk_o5I/AAAAAAAAACk/lyQeIpj7zuI/s1600/neerajblognow11.jpghttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_9175.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4082.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4082.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4082.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
12/75
Real Time System by Jane W. S. Liu ha&ter =.= Solution
/.=.=+ onsider a system that has fi#e &eriodi tasks, 3, 0, , ;, and , and three &roessorsP, P6, P-. The &eriods of 3, 0, and are 6 and their eeution times are e$ual to . The &eriodsof ; and are A and their eeution times are ?. The &hase of e#ery task is 9, that is, the first 1obof the task is released at time 9. The relati#e deadline of e#ery task is e$ual to its &eriod.
a) Sho% that if the tasks are sheduled dynamially on three &roessors aordin! to theLST al!orithm, some 1obs in the system annot meet their deadlines.
a)Sho% that if the tasks are sheduled dynamially on three &roessors aordin! to the LSTal!orithm, some 1obs in the system annot meet their deadlines.
Sol+
9t t"+! 9! ! and ? ha'e time unit o& slack. G and E each ha'e a slack o& 5! so 9! ! and ? run&irst.
9t t"! 9! ! and ? are done running and the slack o& G and E is 5! so G and E both get to run.9t t"5! 9! ! and ? are released again. Their slack is ! as are the slacks o& G and E. 9ssuming
that once a -ob starts running on a processor! it cannot change processors! G and E will run
round2robin on two processors with two o& 9! ! and ? with the third running alone.
y time t"$! 9! ! and ? will ha'e completed! and G and E will ha'e completed one time unit
o& work.
9t t"C! new -obs in 9! ! and ? are released with a slack o& ! but G and E ha'e + slack. G and
E run on two processors and 9! ! and ? run round2robin on the third.
9t t"8.8 the 9! ! and ?
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
13/75
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_1!&2.html
Real Time System by Jane W. S. Liu ha&ter =.@ Solution/.=.@+ 3 system ontains nine non*&reem&table 1obs named Ji, for i C , 6, ..., 4. Theireeution times are -, 6, 6, 6, =, =, =, =, and 4, res&eti#ely, their release times are e$ual to 9,and their deadlines are 6. J is the immediate &redeessor of J 4, and J= is the immediate&redeessor of J@, J ?, JD, and JA. There are no other &reedene onstraints. >or all the 1obs, J i has a hi!her &riority than Jk if i E k.
a) ;ra% the &reedene !ra&h of the 1obs.
Sol+
b) an the 1obs meet their deadlines if they are sheduled on three &roessors5 &lain your
ans%er.
Sol+ 9ll -obs meet their deadline.
) an the 1obs meet their deadlines if %e make them &reem&table and shedule them&reem&ti#ely5 &lain your ans%er.
Sol+ Bob B# does not meet its deadline.
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_1862.htmlhttp://4.bp.blogspot.com/-5FIYwNVGV7U/Um_uIawH14I/AAAAAAAAADE/DjXikuw_n0U/s1600/neerajblognow13+(1).jpghttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_1862.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_1862.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_1862.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
14/75
d) an the 1obs meet their deadlines if they are sheduled non&reem&ti#ely on four &roessors5&lain your ans%er.
Sol+ Bob B# does not meet its deadline.
e) Su&&ose that due to an im&ro#ement of the three &roessors, the eeution time of e#ery 1ob isredued by . an the 1obs meet their deadlines5 &lain your ans%er.
Sol+ Bob B# does not meet its deadline.
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_&""'.htm l
Real Time System by Jane W. S. Liu ha&ter =.D Solution
/.=.D+ onsider the set of 1obs in >i!ure =*-. Su&&ose that the 1obs ha#e idential eeutiontime. What maimum eeution time an the 1obs ha#e and still an be feasible shedulin! on
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_6447.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_6447.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_6447.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_6447.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
15/75
one &roessor5 &lain your ans%er.
Sol+ Bobs with their e&&ecti'e release time and deadline are
B (5!6) B5 (+!D) B$ (5!6) BC (C!#) B8 (5!6) BA (C!5+) BD (A!5)
etween 5 to #! &our -obs need to be &it.Hence! maximum execution time o& each -ob is .D8
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_3'1.htm l
Real Time System by Jane W. S. Liu ha&ter @.(a)(b)Solution
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3971.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3971.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3971.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3971.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
16/75
/.@.+ ah of the follo%in! systems of &eriodi tasks is sheduled and eeuted aordin! toa yli shedule. >or eah system, hoose an a&&ro&riate frame si2e. Preem&tions are allo%ed,but the number of &reem&tion should be ke&t small.
a) (?, ), (9, 6), and (A, 6)
Sol+
The &rame si%e has to meet all three criteria discussed in the chapter.
1. & I max(ei)! 7 i 7 n
& I 5
2. & di'ides at least one o& the periods e'enly
& ∈ J5! $! 8! A! #! +! 6K
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " 55 L 5 2 gcd(5! A) " 5 2 5 " + 7 5
5 L 5 2 gcd(5! +) " 5 2 5 " + 7 8
5 L 5 2 gcd(5! 6) " 5 2 5 " + 7 8
& " $
5 L $ 2 gcd($! A) " A 2 $ " $ M 5
& " 8
5 L 8 2 gcd(8! A) " + 2 " # M 5
& " A
5 L A 2 gcd(A! A) " 5 2 A " A M 5
& " #
5 L # 2 gcd(#! A) " 6 2 $ " 8 M 5
& " 6
5 L + 2 gcd(+! A) " 5+ 2 5 " 6 M 5
& " 6
5 L 6 2 gcd(6! A) " $A 2 A " $+ M 5
The only &rame si%e that works &or this set o& tasks is & " 5.
b) (A, ), (@, -), (69, =), and (66, ?)
Sol+ The &rame si%e has to meet all three criteria discussed in the chapter.
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
17/75
1. & I max(ei)! 7 i 7 n
& I A
2. & di'ides at least one o& the periods e'enly
& ∈ J! 5! $! C! 8! 6! +! ! 8! 5+! 55K
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " 6
5 L 6 2 gcd(6! 6) " A 2 6 " 6 7 6
5 L 6 2 gcd(6! 8) " A 2 " 8 7 8
5 L 6 2 gcd(6! 5+) " A 2 C " 5 7 5+
5 L 6 2 gcd(6! 55) " A 2 5 " C 7 55
& " +
5 L + 2 gcd(+! 6) " 5+ 2 5 " 6 M 6
& "
5 L 2 gcd(! 6) " 55 2 " 5 M 6
& " 8
5 L 8 2 gcd(8! 6) " $+ 2 " 5# M 6
& " 5+
5 L 5+ 2 gcd(5+! 6) " C+ 2 C " $A M 5
& " 55
5 L 55 2 gcd(55! 6) " CC 2 5 " C5 M 5
The only &rame si%e that works &or this set o& tasks is & " 6.
Clock-driven Cyclic Scheduler Since the parameters o! all "obs #ith hard deadlines are kno#n can construct a static cyclic schedule
in advance $ %rocessor time allocated to a "ob e&uals its ma'imum e'ecution time $ Scheduler
dispatches "obs accordin( to the static schedule) repeatin( each hyperperiod $ Static schedule
(uarantees that each "ob completes by its deadline
*o "ob overruns ⇒ all deadlines are met
Schedule calculated o!!-line ⇒ can use comple' al(orithms $ Run-time o!
the schedulin( al(orithm irrelevant $ Can search !or a schedule that optimi+es some characteristic o!
the system
e.(. a schedule #here the idle periods are nearly periodic, accommodatin( aperiodic "obs
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
18/75
Structured Cyclic Schedules rbitrary table-driven cyclic schedules !le'ible) but ine!!icient $ Relies on accurate timer interrupts)
based on e'ecution times o! tasks $ i(h schedulin( overhead
/asier to implement i! structure imposed0 $ ake schedulin( decisions at periodic intervals 2!rames3
o! len(th ! $ /'ecute a !i'ed list o! "obs #ith each !rame) disallo#in( pre-emption e'cept at !rame
boundaries $ Re&uire phase o! each periodic task to be a non-ne(ative inte(er multiple o! the !rame
si+e
The !irst "ob o! every task is released at the be(innin( o! a !rame 5 k ⋅! #here k is a non-ne(ative
inte(er
6ives t#o bene!its0 $ Scheduler can easily check !or overruns and missed deadlines at the end o!
each !rame $ Can use a periodic clock interrupt) rather than pro(rammable timer
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s - liu_#!##.htm l
Real Time System by Jane W. S. Liu ha&ter @.()(d)Solution/@.+ ah of the follo%in! systems of &eriodi tasks is sheduled and eeuted aordin! to ayli shedule. >or eah system, hoose an a&&ro&riate frame si2e. Preem&tions are allo%ed, butthe number of &reem&tions should be ke&t small.
) (=, 9.@), (@, .9), (9, 6), and (6=, 4)
) (=, 9.@), (@, .9), (9, 6), and (6=, 4)
Sol+ The &rame si%e has to meet all three criteria discussed in the chapter.1. & I max(ei)! 7 i 7 n& I #
2. & di'ides at least one o& the periods e'enly& ∈ J5! $! C! 8! A! 6! +! 5! 5CK
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " +5 L + 2 gcd(+! C) " 5+ 2 5 " 6 M C& " 5
5 L 5 2 gcd(5! C) " 5C 2 C " 5+ M C& " 5C5 L 5C 2 gcd(5C! C) " C6 2 C " CC M C
=one o& the possible &rame si%es becuase eC " # is too long. Ne ha'e to splitTC into two smaller tasks. First try eC! " C! and eC!5 " 8.
1. & I max(ei)! 7 i 7 n& I 8
2. & di'ides at least one o& the periods e'enly& ∈ J5! $! C! 8! A! 6! +! 5! 5CK
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " 85 L 8 2 gcd(8! C) " + 2 " # M C
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_5855.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
19/75
9 &rame si%e o& 8 is still too big! as is a &rame si%e o& C.8. Ne cannot make the&rame si%e any smaller unless we break up the taks into smaller pieces. Trydi'iding TC into three eual si%ed pieces with eC " $.
1. & I max(ei)! 7 i 7 n& I $
2. & di'ides at least one o& the periods e'enly& ∈ J5! $! C! 8! A! 6! +! 5! 5CK
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " $5 L $ 2 gcd($! C) " A 2 " 8 M C
E'en three is too big. Ne need to break up TC &urther! try &our tasks withexecution time 5 and one with execution time .
1. & I max(ei)! 7 i 7 n& I 5
2. & di'ides at least one o& the periods e'enly
& ∈ J5! $! C! 8! A! 6! +! 5! 5CK3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " 55 L 5 2 gcd(5! C) " C 2 5 " 5 7 C5 L 5 2 gcd(5! 8) " C 2 " $ 7 C5 L 5 2 gcd(5! +) " C 2 5 " 5 7 C5 L 5 2 gcd(5! 5C) " C 2 5 " 5 7 C
Nith this set o& tasks & " 5 works.
d) (@, 9.), (D, .9), (6, ?), and (=@, 4)
Sol+ The &rame si%e has to meet all three criteria discussed in the chapter.1. & I max(ei)! 7 i 7 n
& I #
The smallest period is 8! which is less than the longest execution time. Ne cannot ha'e
a &rame si%e larger than the period! so at this point we know we ha'e to split the (C8!
#) task and the (5! A) task. Splitting (C8! #) into two tasks does not lea'e many &rame
si%e choices. Try (C8! #) "M (C8! $)! (C8! $)! (C8! $) and (5! A) "M (5! $)! (5! $)
&I $
2. & di'ides at least one o& the periods e'enly
& ∈ J! 5! $! C! 8! A! D! #! 5! 8! C8K
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " $
5 L $ 2 gcd($! 8) " A 2 " 8 7 8
5 L $ 2 gcd($! D) " A 2 " 8 7 D
5 L $ 2 gcd($! 5) " A 2 $ " $ 7 5
5 L $ 2 gcd($! C8) " A 2 $ " $ 7 C8
& " C
5 L C 2 gcd(C! 8) " 6 2 " D M 8
& " 85 L 8 2 gcd(8! 8) " + 2 8 " 8 7 8
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
20/75
5 L 8 2 gcd(8! D) " + 2 " # M DThe only &rame si%e that works &or this set o& tasks is & " $ (assuming the last two tasks are splitas described abo'e.)
Scheduling 9periodic BobsF 3&eriodi 1obs are sheduled in the bak!round after all 1obs %ith hard deadlines sheduled in
eah frame ha#e om&leted
G ;elays eeution of a&eriodi 1obs in &referene to &eriodi 1obs G o%e#er, note that there is
often no ad#anta!e to om&letin! a hard real*time 1ob early, and sine an a&eriodi 1ob is released
due to an e#ent, the sooner suh a 1ob om&letes, the more res&onsi#e the system
F ene, minimi2in! res&onse times for a&eriodi 1obs is ty&ially a desi!n !oal of real*time
shedulers
Slack StealingF Periodi 1obs sheduled in frames that end before their deadline8 there may be some slak time
in the frame after the &eriodi 1ob om&letes
F Sine %e kno% the eeution time of &eriodi 1obs, an mo#e the slak time to the start of the
frame, runnin! the &eriodi 1obs 1ust in time to meet their deadline
F eute a&eriodi 1obs in the slak time, ahead of &eriodi 1obs G The yli eeuti#e kee&s
trak of the slak left in eah frame as the a&eriodi 1obs eeute, &reem&ts them to start the
&eriodi 1obs %hen there is no more slak G 3s lon! as there is slak remainin! in a frame, the ylieeuti#e returns to eamine the a&eriodi 1ob $ueue after eah slie om&letes
F Redues res&onse time for a&eriodi 1obs, but re$uires aurate timers
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s- liu_30&.html
Real Time System by Jane W. S. Liu ha&ter @.(e)(f)
Solution/.@.+ ah of the follo%in! systems of &eriodi tasks is sheduled and eeuted aordin! toa yli shedule. >or eah system, hoose an a&&ro&riate frame si2e. Preem&tions are allo%ed,but the number of &reem&tions should be ke&t small.
e) (@, 9.), (D, .9), (6, ?), and (=@, 4)
e) (@, 9.), (D, .9), (6, ?), and (=@, 4)
Sol+ The &rame si%e has to meet all three criteria discussed in the chapter.
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3069.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3069.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3069.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3069.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3069.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_3069.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
21/75
1. & I max(ei)! 7 i 7 n& I #The smallest period is 8! which is less than the longest execution time.Ne cannot ha'e a &rame si%e larger than the period! so at this point weknow we ha'e to split the (C8! #) task and the (5! A) task. Splitting (C8!
#) into two tasks does not lea'e many &rame si%e choices. Try (C8! #) "M(C8! $)! (C8! $)! (C8! $) and (5! A) "M (5! $)! (5! $)&I $
2. & di'ides at least one o& the periods e'enly& ∈ J! 5! $! C! 8! A! D! #! 5! 8! C8K
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " $5 L $ 2 gcd($! 8) " A 2 " 8 7 85 L $ 2 gcd($! D) " A 2 " 8 7 D5 L $ 2 gcd($! 5) " A 2 $ " $ 7 5
5 L $ 2 gcd($! C8) " A 2 $ " $ 7 C8& " C5 L C 2 gcd(C! 8) " 6 2 " D M 8& " 85 L 8 2 gcd(8! 8) " + 2 8 " 8 7 85 L 8 2 gcd(8! D) " + 2 " # M D
The only &rame si%e that works &or this set o& tasks is & " $ (assuming the lasttwo tasks are split as described abo'e.)
f) (D, @, , @), (4, ), (6, -), and (9.@, 6-, D, 6)
Sol+ The &rame si%e has to meet all three criteria discussed in the chapter.1. & I max(ei)! 7 i 7 n
& I D
The smallest period is 8! which is less than the longest execution time. Ne cannot ha'e
a &rame si%e larger than the period! so at this point we know we ha'e to split the (+.8!
5$! D! 5) task. Splitting it into two tasks does not work (try it! to see). Split the long
task into three (+.8! 5$! $! 5)! (+.8! 5$! $! 5)! and (+.8! 5$! 5! 5)
&I $
2. & di'ides at least one o& the periods e'enly
& ∈ J! 5! $! C! 8! A! #! 5! 5$K
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
& " $
5 L $ 2 gcd($! 8) " A 2 " 8 7 8
5 L $ 2 gcd($! #) " A 2 $ " $ 7 #
5 L $ 2 gcd($! 5) " A 2 $ " $ 7 5
5 L $ 2 gcd($! 5$) " A 2 " 8 7 5
& " C
5 L C 2 gcd(C! 8) " 6 2 " D M 8
& " 8
5 L 8 2 gcd(8! 8) " + 2 8 " 8 7 8
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
22/75
5 L 8 2 gcd(8! #) " + 2 " # 7 #
5 L 8 2 gcd(8! 5) " + 2 " # 7 5
5 L 8 2 gcd(8! 5$) " + 2 " # 7 5Either & " $ or & " 8 may work! assuming the last two tasks are split as described abo'e. Neneed to make a schedule to 'eri&y the tasks can be scheduled with those &rame si%es.
Scheduling Sporadic Jobs We assumed there #ere no sporadic "obs
Sporadic "obs have hard deadlines) release and e'ecution times that are not kno#n a priori $ ence)
a clock-driven scheduler cannot (uarantee a priori that sporadic "obs complete in time
o#ever) scheduler can determine i! a sporadic "ob is schedulable #hen it arrives $ %er!orm an
acceptance test to check #hether the ne#ly released sporadic "ob can be !easibly scheduled #ith all the
"obs in the system at that time $ 7! there is su!!icient slack time in the !rames be!ore the ne# "ob8sdeadline) the ne# sporadic "ob is accepted, other#ise) it is re"ected
Can be determined that a ne# sporadic "ob cannot be handled as soon as that "ob is released, earliest
possible re"ection $ 7! more than one sporadic "ob arrives at once) they should be &ueued !or
acceptance in /9: order
Practical Considerations andlin( overruns0 $ Jobs are scheduled based on ma'imum e'ecution time) but !ailures mi(ht
cause overrun $ robust system #ill handle this by either0 13 killin( the "ob and startin( an error
recovery task, or ;3 preemptin( the "ob and schedulin( the remainder as an aperiodic "ob
9epends on use!ulness o! late results) dependencies bet#een "obs) etc.
ode chan(es0 $ cyclic scheduler needs to kno# all parameters o! real-time "obs a priori $
S#itchin( bet#een modes o! operation implies recon!i(urin( the scheduler and brin(in( in the
code al!orithm to shedule s&oradi 1obs. The yli shedule of &eriodi tasks in the system uses a frame si2e of @, and a ma1or yle ontaints ? frames. Su&osethat the initial amounts of slak time in the frames are , 9.@, 9.@, 9.@, , and .
a. Su&&ose that a s&oradi 1ob S(6-, ) arri#es in frame , s&oradi 1obs S6(?, 9.A) andS-(69, 9.@) arri#e in frame 6. "n %hih frame are the ae&ted s&oradi 1obs sheduled5
a. Su&&ose that a s&oradi 1ob S(6-, ) arri#es in frame , s&oradi 1obs S 6(?, 9.A) and
S-(69, 9.@) arri#e in frame 6. "n %hih frame are the ae&ted s&oradi 1obs sheduled5
Sol
S(5$! )
Since S arri'es in &rame ! scheduling decisions about it are made at the start o& &rame5. Frame 5 has a slack o& +.8! as does &rame $. Frame $ ends at t"8 which is well
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_793.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_793.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_793.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_793.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
23/75
be&ore S
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
24/75
Real Time System by Jane W. S. Liu ha&ter @.- Solution
/[email protected]+ ;ra% a net%ork flo% !ra&h that %e an use to find a &reem&ti#e yli shedule of the &eriodi tasks
T C (-,D,)8 T6 C (=,)8 T- C (?,6.=,A).
Sol+
1. & I max(ei)! 7 i 7 n
& I 5.C
2. & di'ides at least one o& the periods e'enly
& ∈ J$! C! A!5K
3. 5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
/i Gi & " $ & " C & " A
$ D $ D #
C C 8 C +
A 6 $ A A
Hence &or & " C! =etwork &low graph is2
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
25/75
T$ canor
eah mode of o&eration, system has a fied number, n, &eriodi tasks
F >or task Ti eah 1ob Ji,k is ready for eeution at its release time ri,k and is released &i units of
time after the &re#ious 1ob in Ti suh that ri,k C ri,k* H &i F Iariations in the inter*release times of 1obs in a &eriodi task are ne!li!ible G 3&eriodi 1obs may eist F 3ssume that the system maintains a
sin!le $ueue for a&eriodi 1obs
F Whene#er the &roessor is a#ailable for a&eriodi 1obs, the 1ob at the head of this $ueue is
eeuted G There are no s&oradi 1obs
7otation for lok*dri#en shedulin!F The =*tu&le Ti C (i, &i, ei, ;i) refers to a &eriodi task Ti %ith &hase i, &eriod &i, eeution time
ei, and relati#e deadline ;i G ;efault &hase of Ti is i C 9, default relati#e deadline is the &eriod ;i C
&i.
http://3.bp.blogspot.com/-ij5jQ7qRtOI/Um__qWR2-BI/AAAAAAAAAEA/UnxsK98Z4q0/s1600/neerajblognow15.jpg
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
26/75
Kmit elements of the tu&le that ha#e default #alues
The lok*dri#en a&&roah has many ad#anta!es+
* one&tual sim&liity8
* %e an take into aount om&le de&endenies, ommuniation delays, and resoure ontentions
amon! 1obs in the hoie and onstrution of the stati shedule8
* stati shedule stored in a table8 han!e table to han!e o&eration mode8
* no need for onurreny ontrol and synhroni2ation mehanisms8
* ontet s%ith o#erhead an be ke&t lo% %ith lar!e frame si2es. "t is &ossible to further sim&lify
lok*dri#en shedulin!
* s&oradi and a&eriodi 1obs may also be time*tri!!ered (interru&ts in res&onse to eternal e#entsare $ueued and &olled &eriodially)8
* the &eriods may be hosen to be multi&les of the frame si2e.
* asy to #alidate, test and ertify (by ehausti#e simulation and testin!).
* Many traditional real*time a&&liations use lok*dri#en shedules.
* This a&&roah is suited for systems (e.!. small embedded ontrollers) %hih are rarely modified
one built.
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_""3'.html
Real Time System by Jane W. S. Liu ha&ter @.= Solution
/.@.=+ 3 system ontains the follo%in! &eriodi tasks+ TC (@,)8 T6 C (D,,4)8 T- C (9,-) and T= C (-@,D).
"f the frame si2e onstraint (@*) is i!nored, %hat are the &ossible frame si2es 5
Sol+
1. & I max(ei)! 7 i 7 nThis step is ignored! here.
2. & di'ides at least one o& the periods e'enly& ∈ J5! 8! D! +! C! $8K
3.5& 2 gdc(&! pi) 7 Gi! 7 i 7 n
/i Gi & " 5 & " 8 & " D & " + & " C & " $8
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4437.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4437.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4437.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4437.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4437.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4437.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_4437.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
27/75
8 8 $ 8 $(x) 8(x) 5D(x) A8(x)
D # $ # D #(x) 5(x) A$(x)
+ + 5 8 $(x) + 5A(x) A8(x)
$8 $8 $ 8 D 8 5+ $8(x)
Cyclic scheduling: frame size
9ecision points at re(ular intervals2!rames3,
Within a !rame the processor may be idle to accommodate aperiodic "obs
The !irst "ob o! every task is released at the be(innin( o! some !rame
o# to determine the !rame si+e ! =
The !ollo#in( > constraints should be satis!ied0
1. ! ? ma'2ei3 2!or 1 @ i @ n3 2n tasks3
each "ob may start and complete #ithin one !rame0 no "ob is preempted
;. Api
to keep the cyclic schedule short) ! must divide the hyperperiod , this is true i! ! divides at least one
pi
>. ;! $ (cd2pi)!3 @ 9i 2!or 1 @ i @ n3
to have at least one #hole !rame bet#een the release time and the deadline o! every "ob 2so the "ob can
be !easibly scheduled in that !rame3
Constructin( a cyclic schedule 9esi(n steps and decisions to consider in the process o! constructin( a cyclic schedule0
Ddetermine the hyperperiod )
Ddetermine the total utili+ation E 2i! F1 schedule is un!easible3)
Dchoose a !rame si+e that meets the constraints)
Dpartition "obs into slices) i! necessary)
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
28/75
Dplace slices in the !rames.
The clock-driven approach has many disadvanta(es0
- brittle0 chan(es in e'ecution time or addition o! a task o!ten re&uire a ne# schedule to beconstructed,
- release times must be !i'ed 2this is not re&uired in priority-driven systems3,
- all combinations o! periodic tasks that mi(ht e'ecute at the same time must be kno#n a priori0 it is
not possible to recon!i(ure the system on line 2priority-driven systems do not have this restriction3,
- not suitable !or many systems that contain both hard and so!t real-time applications0 in the clock-
driven systems previously discussed) aperiodic and sporadic "obs #ere scheduled in a priority driven
manner 2/9:3.
Solution http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_!'3".html
Real Time System by Jane W. S. Liu ha&ter ?.= Solution
/.?.=+3 system
T
ontains for &eriodi tasks, (A, ), (@, -), (69, =), and (66, ?). "ts total
utili2ation is 9.A9. onstrut the initial se!ment in the time inter#al (9, @9) of a rate*monotonishedule of the system.
Sol+ The scheduling will be as2
http://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://4.bp.blogspot.com/-JVhLYEQ6BeQ/UnCBGXqvzJI/AAAAAAAAAEQ/QDLhRwk3X9Y/s1600/neerajblognow16.jpghttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.htmlhttp://targetiesnow.blogspot.in/2013/10/real-time-system-by-jane-w-s-liu_8734.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
29/75
Schedulability Test for RMA
n important problem that is addressed durin( the desi(n o! a uniprocessor-based real-time system is
to check #hether a set o! periodic real-time tasks can !easibly be scheduled under R. Schedulability
o! a task set under R can be determined !rom a kno#led(e o! the #orst-case e'ecution times and
periods o! the tasks. pertinent &uestion at this point is ho# can a system developer determine the
#orst-case e'ecution time o! a task even be!ore the system is developed. The #orst-case e'ecution
times are usually determined e'perimentally or throu(h simulation studies.
The !ollo#in( are some important criteria that can be used to check the schedulability o! a set o! tasks
set under R.
Necessary Condition set o! periodic real-time tasks #ould not be R schedulable unless they satis!y the !ollo#in(
necessary condition0
i5 Gei < pi 5 Gui @ 1
#here ei is the #orst case e'ecution time and pi is the period o! the task Ti) n is the number o! tasks to
be scheduled) and ui is the C%E utili+ation due to the task Ti. This test simply e'presses the !act that
the total C%E utili+ation due to all the tasks in the task set should be less than 1.
Sufficient ConditionThe derivation o! the su!!iciency condition !or R schedulability is an important result and #as
obtained by Liu and Layland in 1HI>. !ormal derivation o! the Liu and Layland8s results !rom !irst
principles is beyond the scope o! this discussion. We #ould subse&uently re!er to the su!!iciency as the
Liu and Layland8s condition. set o! n real-time periodic tasks are schedulable under R) i! i5Gui @
n2;1.4
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
30/75
N5 " A 7 #! ∴ T5 is schedulable
w$(t) " $ ⌈t*6⌉⋅$ ⌈t*#⌉⋅$ " t
N$ " 8 7 8! ∴ T$ is schedulable.
9ll tasks are schedulable under R,! there&ore the system is schedulable under R,.
7 ! ∴ the system is schedulable under EGF
. T C (A, =), (6, =), (69, =)
Sol+ " C*6 C*5 C*5+ : .+$ M
∴ this system is not schedulable by any scheduling algorithm
d. T C (A, =), (9, 6), (6, -)
Sol+ " C*6 5*+ $*5 " +.#8 M R,($)
Schedulable utili%ation test is indeterminate! use time2demand analysis!
w(t) " C! N " C 7 6
∴ T is schedulable
w5(t) " 5 ⌈ t*6 ⌉⋅C " t
N5 " A 7 +
∴ T5 is schedulable
w$(t) " 5 ⌈ t*6 ⌉⋅C ⌈ t*+ ⌉⋅5 " t
N$ " 8 M 5
∴T$ misses its deadline
This system is not schedulable under R,
7 ∴ this system is schedulable under EGF
Earliest Deadline First (EDF Scheduling
7n /arliest 9eadline :irst 2/9:3 schedulin() at every schedulin( point the task havin( the
shortest deadline is taken up !or schedulin(. This basic principles o! this al(orithm is very
intuitive and simple to understand. The schedulability test !or /9: is also simple. task set is
schedulable under /9:) i! and only i! it satis!ies the condition that the total processor
utili+ation due to the task set is less than 1.
/9: has been proven to be an optimal uniprocessor schedulin( al(orithm. This means that) i!
a set o! tasks is not schedulable under /9:) then no other schedulin( al(orithm can !easibly
schedule this task set. 7n the simple schedulability test !or /9:) #e assumed that the period o!
each task is the same as its deadline. o#ever) in practical problems the period o! a task may
at times be di!!erent !rom its deadline. 7n such cases) the schedulability test needs to be
chan(ed.
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6564.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6564.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
31/75
more e!!icient implementation o! /9: #ould be as !ollo#s. /9: can be implemented by
maintainin( all ready tasks in a sorted priority &ueue. sorted priority &ueue can e!!iciently be
implemented by usin( a heap data structure. 7n the priority &ueue) the tasks are al#ays kept
sorted accordin( to the pro'imity o! their deadline. When a task arrives) a record !or it can be
inserted into the heap in K2lo(; n3 time #here n is the total number o! tasks in the priority
&ueue.
t every schedulin( point) the ne't task to be run can be !ound at the top o! the heap. When a
task is taken up !or schedulin() it needs to be removed !rom the priority &ueue. This can be
achieved in K213 time.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s -liu_&".htm l
Real Time System by Jane W. S. Liu ha&ter ?.A Solution
/.?.A+ a) :se the time demand analysis method to sho% that the rate*monotoni al!orithm %ill &rodue a feasible shedule of the tasks (?,), (A,6) and (@,?).Sol+ " *A 5*6 A*8 " +.6A
TG9 analysis2
w(A) " ! N " 7 A! ∴ T is schedulable
w5(A) " 5 ⌈A*A⌉⋅ " $ N5 " $ 7 A! ∴ T5 is schedulable
w$(A) " A ⌈A*A⌉⋅ ⌈A*6⌉⋅5 " #
w$(5) " A ⌈5*A⌉⋅ ⌈5*6⌉⋅5 " 5
b) han!e the &eriod of one of the tasks in &art (a) to yield a set of tasks %ith the maimal
total utili2ation %hih is feasible %hen sheduled usin! the rate*monotoni al!orithm.
(onsider only inte!er #alues for &eriod)
Sol+ ?hange / such that2
w$(8) " A ⌈5*/⌉⋅ C " 8 "M / " $
) han!e the eeution time of one of the tasks in &art (a) to yield a set of tasks %ith the
maimum total utili2ation %hih is feasible %hen sheduled usin! the rate*monotoni
al!orithm. (onsider only re!ister #alues for the eeution time).
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6564.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6564.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6564.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6564.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
32/75
Sol+ ?hange the execution time o& tasks such that maximum possible utili%ation
w$(8) " e$ ⌈8*A⌉⋅ ⌈8*6⌉⋅5 " 8
"M e$ $ C " 8
"M e$ " 6
"M T$ " (8!6)
Rate Monotonic SchedulingThe term rate monotonic derives !rom a method o! assi(nin( priorities to a set o! processes as a
monotonic !unction o! their rates. While rate monotonic schedulin( systems use rate monotonic
theory !or actually schedulin( sets o! tasks) rate monotonic analysis can be used on tasks scheduled by
many di!!erent systems to reason about schedulablility. We say that a task is schedulable i! the sum o!
its preemption) e'ecution) and blockin( is less than its deadline. system is schedulable i! all tasks
meet their deadlines. Rate monotonic analysis provides a mathematical and scienti!ic model !or
reasonin( about schedulability.
ssumptionsReasonin( #ith rate monotonic analysis re&uires the presence o! the !ollo#in( assumptions 0
Task s#itchin( is instantaneous.
Tasks account !or all e'ecution time.
Task interactions are not allo#ed.
Tasks become ready to e'ecute precisely at the be(innin( o! their periods and relin&uish the C%E only
#hen e'ecution is complete.
Task deadlines are al#ays at the start o! the ne't period.
Tasks #ith shorter periods are assi(ned hi(her priorities, the criticality o! tasks is not considered.
Task e'ecution is al#ays consistent #ith its rate monotonic priority0 a lo#er priority task never
e'ecutes #hen a hi(her priority task is ready to e'ecute.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s - liu_&""".html
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6444.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6444.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6444.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6444.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6444.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6444.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
33/75
Real Time System by Jane W. S. Liu ha&ter ?.? Solution
/.?.?+ Bi#e t%o different e&lanation of %hy the &eriodi tasks (6,), (=,) and (A,6) are shedulable by the rate monotoni al!orithm.
Sol+ The priorities to tasks are assigned statically! be&ore the actual execution o& the task set.
Rate ,onotonic scheduling scheme assigns higher priority to tasks with smaller periods. t ispreempti'e (tasks are preempted by the higher priority tasks). t is an optimal schedulingalgorithm among Pxed2priority algorithmsQ i& a task set cannot be scheduled with R,! it cannotbe scheduled by any Pxed2priority algorithm.
The su&Pcient schedulability test is gi'en by
The term is said to be the processor utili%ation &actor (the &raction o& the processor time spent
on executing task set). n is the number o& tasks.
n our case *5 *C 5*6 " which is not less than +.D6
The abo'e condition is not necessaryQ we can do a somewhat more in'ol'ed su&Pcient and
necessary condition test! as &ollows.
Ne ha'e to guarantee that all the tasks can be scheduled! in any possible instance. n particular!
i& a task can be scheduled in its critical instances! then the schedulability guarantee condition
holds (a critical instance o& a task occurs whene'er the task is released simultaneously with all
higher priority tasks). For that! we ha'e to use the method as mentioned in Exercise A.8.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s - liu_2.htm l
Real Time System by Jane W. S. Liu ha&ter ?.D Solution
/.?.D+ This &roblem is onerned %ith the &erformane an beha#ior of rate*monotoni anearliest*deadline*first al!orithms.
a. onstrut the initial se!ments in the time inter#al (9, D@9) of a rate*monotoni
shedule and an earliest*deadline*first shedule of the &eriodi tasks (99, 69) (@9, @9),and (6@9, 99) %hose total utili2ation is 9.4-.
R,
=ote! the third task (the blue one) runs past its deadline &rom t " 58+ to t " 5A+.
EGF
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_2.htmlhttp://4.bp.blogspot.com/-p93hOWtLgjI/UnCFW3JtBAI/AAAAAAAAAEc/VaXq3boRNTY/s1600/targeties1.jpghttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_2.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_2.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_2.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
34/75
There are no missed deadlines in this schedule.
b. onstrut the initial se!ments in the time inter#al (9, D@9) of a rate*monotoni shedule and an earliest*deadline*first shedule of the &erioditasks (99, 69) (@9, @9), and (6@9, 69) %hose total utili2ation is .9.
Sol
R,
The third task (the blue one) runs past its deadline &rom 58+ to 56+ and &rom 85+ to
8A+. The third task will continue to be backlogged &arther and &arther each time a new
-ob in the task is released! but the &irst and second task are not a&&ected.
EGF
Task 5 e'entually misses its deadline. Once -obs start missing deadlines! almost e'ery -ob is
going to miss its deadline. Rate Monotonic !s" EDF
Since the rst results published in 1HI> by Liu and Layland on the Rate onotonic 2R3 and /arliest9eadline :irst 2/9:3 al(orithms) a lot o! pro(ress has been made in the schedulability analysis o!
periodic task sets. En!ortunately) many misconceptions still e'ist about the properties o! these t#o
schedulin( methods) #hich usually tend to !avor R more than /9:. Typical #ron( statements o!ten
heard in technical con!erences and even in research papers claim that R is easier to analy+e than
/9:) it introduces less runtime overhead) it is more predictable in overload conditions) and causes less
"itter in task e'ecution. Since the above statements are either #ron() or not precise) it is time to clari!y
these issues in a systematic !ashion) because the use o! /9: allo#s a better e'ploitation o!
the available resources and si(nicantly improves system8s per!ormance.
ost commercial RTKSes are based on R. R is simpler to implement on top o! commercial 2!i'ed
priority3 kernels.
/9: re&uires e'plicit kernel support !or deadline schedulin() but (ives other advanta(es.
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
35/75
Less overhead due to preemptions.
ore uni!orm "itter control
Metter aperiodic responsiveness.
T#o di!!erent types o! overhead0
Overhead for job release
/9: has more than R) because the absolute deadline must be updated at each "ob activation
Overhead for context switch
R has more than /9: because o! the hi(her number o! preemptions
esource access protocols!
:or R
*on %reemptive %rotocol 2*%%3
i(hest Locker %riority 2L%3
%riority 7nheritance 2%7%3
%riority Ceilin( 2%C%3
Ender /9:
*on %reemptive %rotocol 2*%%3
9ynamic %riority 7nheritance 29-%7%3
9ynamic %riority Ceilin( 29-%C%3
Stack Resource %olicy 2SR%3
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s - liu_'1".htm l
Real Time System by Jane W. S. Liu ha&ter ?.4 Solution
/.?.4+ The Periodi Tasks (-,), (=,6), (?,) are sheduled aordin! to the rate*monotoni al!orithm.
a) ;ra% Time ;emand >untion of the tasks
Sol+
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_714.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
36/75
b) 3re the tasks shedulable5 Why or %hy not 5
Sol+ =o. ased on the Time Gemand Function graph! Task $ did not touch or go
below the dash line by its deadline at time A. n another word! it can not meet its
deadline and there&ore not schedulable.
) an this !ra&h be used to determine %hether the tasks are shedulable aordin! to an arbitrary
&riority*dri#en al!orithm5
Sol+ =o. This graph is &undamentally based on &ixed priority dri'en algorithm which assigns the same
priority to all -obs in each task. n the graph! T5 is built on top o& T since all -obs in T ha'e a
higher priority than all -obs in T5. T$ is built on top o& T and T5since all -obs in T and T5 ha'e
a higher priority than all -obs in T$. This graph does not depict dynamic priority dri'en
algorithm! such as earliest deadline &irst (EGF). n EGF! any -ob in a task can ha'e a higherpriority at a speci&ic moment depending on its deadline compared to the -obs o& other tasks.
http://4.bp.blogspot.com/-jn0-Ta3XVwg/UnDFNPHDWSI/AAAAAAAAAEs/JK4uCphd2Dc/s1600/targeties2.jpg
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
37/75
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
38/75
/.?.9+ Whih of the follo%in! fied*&riority task is not shedulable5 &lain your ans%er.
T(@,) T6(-,) T-(D,6.@) T=(?,)
Sol+
& Ni(t) 4" t! the task is schedulable.
9ssume R,*G, scheduling algorithm is used. /riority T5MTMT$MTC
ndex! i! is assigned to each task according to its priority.
T5 i " ! T i " 5! T$ i " $.! TC i " C
?heck t " $! 8! A! D! #! +! 5! C! 8! A
N(t) " 4 t! t" $! 8! A! D! #! +! 5! C! 8! A "M Schedulable
N5(t) " ⌈t*$⌉
N5($) " " 5 4"$ "M Schedulable
N$(t) " 5.8 ⌈t*$⌉ ⌈t*8⌉ (check 5.8"C.8 "M min t "8)
N$(8) " 5.85 " 8.8
N$(A) " 5.855 " A.8
N$(D) " 5.8$5 " D.8 "M ,iss deadline! D =ot Schedulable
NC(t) " ⌈t*$⌉ ⌈t*8⌉ 5.8⌈t*D⌉ (check 5.8"8.8 "M min t "A)
NC(A) " 555.8 " D.8
NC(D) " $55.8 " 6.8
NC(#) " $58 "
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
39/75
NC(+) " C58 " 5
NC(5) " C$8 " $
NC(C) " 8$8 " C 4" C "M Schedulable
T$ is not a schedulable task
Time $ound in Fi%ed#&riority Scheduling
Since #orst-case response times must be determined repeatedly durin( the interactive desi(n o! real-
time application systems) repeated e'act computation o! such response times #ould slo# do#n the
desi(n process considerably. 7n this research) #e identi!y three desirable properties o! estimates o! the e'act response times0 continuity #ith respect to system parameters, e!cient computability, and
appro'imability. We derive a techni&ue possessin( these properties !or estimatin( the #orst case
response time o! sporadic task systems that are scheduled usin( 'ed priorities upon a preemptive
uniprocessor .
When a (roup o! tasks share a common resource 2such as a processor) a communication medium3) a
schedulin( policy is necessary to arbitrate access to the shared resource. Kne o! the most intuitive
policies consists o! assi(nin( :i'ed %riorities 2:%3 to the tasks) so that at each instant in time the
resource is (ranted to the hi(hest priority task re&uirin( it at that instant. 9ependin( on the assi(ned
priority) a task can have lon(er or shorter response time) #hich is the time elapsed !rom re&uest o! the
resource to the completion o! the task.
Since #orst case response times must be determined repeatedly durin( the interactive desi(n o! real-
time application systems) repeated e'act computation o! such response times #ould slo# do#n the
desi(n process considerably. 7n this research) #e identi!y three desirable properties o! estimates o!
the e'act response times0 continuity #ith respect to system parameters) e!!icient computability) and
appro'imability. We derive a techni&ue possessin( these properties !or estimatin( the #orst-case
response time o! sporadic task systems that are scheduled usin( !i'ed priorities upon a preemptive
uniprocessor.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s -liu_3.htm l
Real Time System by Jane W. S. Liu ha&ter ?. Solution
/.?.+ >ind the maimum &ossible res&onse time of tasks T= in the follo%in! fied*&riority system by sol#in! the e$uation %=(t) C t, iterati#ely
T C (@,), T6 C (-,), T- C (A,.?), and T= C (A,-.@)
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
40/75
Sol+ teration
wC(t")() " $.8 ⌈ *8 ⌉⋅ ⌈ *$ ⌉⋅ ⌈ *6 ⌉⋅.A
" $.8 .A
" D.
teration 5
wC(t"D)(5) " $.8 ⌈ D*8 ⌉⋅ ⌈ D*$ ⌉⋅ ⌈ D*6 ⌉⋅.A
" $.8 5 $ .A
" +.
teration $
wC(t"+)($) " $.8 ⌈ +*8 ⌉⋅ ⌈ +*$ ⌉⋅ ⌈ +*6 ⌉⋅.A
" $.8 5 C $.5
" 5.D
teration C
wC(t"5.D)(C) " $.8 ⌈ 5.D*8 ⌉⋅ ⌈ 5.D*$ ⌉⋅ ⌈ 5.D*6 ⌉⋅.A
" $.8 $ 8 $.5
" C.D
teration 8
wC(t"C.D)(8) " $.8 ⌈ C.D*8 ⌉⋅ ⌈ C.D*$ ⌉⋅ ⌈ C.D*6 ⌉⋅.A
" $.8 $ 8 $.5
" C.D
,ax possible response time " C.D
Time $ound in Fi%ed#&riority Scheduling
Since #orst-case response times must be determined repeatedly durin( the interactive desi(n o! real-time application systems) repeated e'act computation o! such response times #ould slo# do#n the
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://3.bp.blogspot.com/-IVbr6M_dxbA/UnXzMH4_2OI/AAAAAAAAARQ/--7u6lUDo1I/s1600/SnapCrab_NoName_2013-10-31_14-3-37_No-00.jpghttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
41/75
desi(n process considerably. 7n this research) #e identi!y three desirable properties o! estimates o!
the e'act response times0 continuity #ith respect to system parameters, e!cient computability, and
appro'imability. We derive a techni&ue possessin( these properties !or estimatin( the #orst case
response time o! sporadic task systems that are scheduled usin( 'ed priorities upon a preemptive
uniprocessor .
When a (roup o! tasks share a common resource 2such as a processor) a communication medium3) a
schedulin( policy is necessary to arbitrate access to the shared resource. Kne o! the most intuitive
policies consists o! assi(nin( :i'ed %riorities 2:%3 to the tasks) so that at each instant in time the
resource is (ranted to the hi(hest priority task re&uirin( it at that instant. 9ependin( on the assi(ned
priority) a task can have lon(er or shorter response time) #hich is the time elapsed !rom re&uest o! the
resource to the completion o! the task.
Since #orst case response times must be determined repeatedly durin( the interactive desi(n o! real-
time application systems) repeated e'act computation o! such response times #ould slo# do#n the
desi(n process considerably. 7n this research) #e identi!y three desirable properties o! estimates o!
the e'act response times0 continuity #ith respect to system parameters) e!!icient computability) and
appro'imability. We derive a techni&ue possessin( these properties !or estimatin( the #orst-case
response time o! sporadic task
systems that are scheduled usin( !i'ed priorities upon a preemptive uniprocessor.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s -liu_&2&3.htm l
Real Time System by Jane W. S. Liu ha&ter ?.- Solution
/.?.-+ >ind the len!th of an in*&hase le#el*- busy inter#al of the follo%in! fied*&riority tasks+
T C (@, ), T6 C (-,), T- C (A, .?), and T= C (A, -.@)
Sol+ The le'el2$ busy inter'al is based on T! T5! and T$
t " ⌈ t*8 ⌉⋅ ⌈ t*$ ⌉⋅ ⌈ t*6 ⌉⋅.A
t " C.A " length o& in2phase le'el2$ busy inter'al
$usy 'nter!als
9e!inition0 level-Pi busy interval 2t) tB be(ins at an instant t #hen
213 all "obs in Ti released be!ore this instant have completed) and
2;3 a "ob in Ti is released.
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6263.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
42/75
The interval ends at the !irst instant t a!ter t #hen all "obs in Ti released since t are complete. :or
any t that #ould &uali!y as the end o! a level-Pi busy interval) a correspondin( t e'ists. 9urin( a
level-Pi busy interval) the processor only e'ecutes tasks in Ti other tasks can be i(nored.
9e!inition0 We say that a level-Pi busy interval is in phase i! the !irst "ob o! all tasks that e'ecute in the
interval are released at the same time. :or systems in #hich each task8s relative deadline is at most its
period) #e ar(ued that an upper bound on a task8s response time could be computed by considerin( a
Qcritical instant scenario in #hich that task releases a "ob to(ether #ith all hi(her-priority tasks. 7n
other #ords) #e "ust consider the !irst "ob o! each task in an in-phase system. :or many
years) people "ust assumed this approach #ould #ork i! a task8s relative deadline could e'ceed its
period. Lehoc+ky sho#ed that this Q!olk #isdom that only each task8s !irst "ob must be considered is
!alse by means o! a countere'ample.
The (eneral schedulability test hin(es upon the assumption that the "ob #ith the ma'imum response
occurs #ithin an in-phase busy interval.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_".html
Real Time System by Jane W. S. Liu ha&ter ?.@ Solution
/.?.@+ 3 system onsists of three &eriodi tasks+ (-, ), (@, 6), and (A, -).a. What is the total utili2ation5
a.
b. Sol+ " *$ 5*8 $*6 : .
c. onstrut an earliest*deadline*first shedule of this system in the inter#al (9, -6).
Label any missed deadlines.
Sol+
3ellow stripes indicates missed deadlines.
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_4.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_4.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_4.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_4.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_4.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
43/75
d. Su&&ose %e %ant to redue the eeution time of the task %ith &eriod - in order to
make mthe task system shedulable aordin! to the earliest*deadline*first al!oorithm.
What is the minimum amount of redution meessary for the system to be shedulable by
the earliest*deadline*first al!orithm5
Sol+
3ellow stripes indicates missed deadlines.
e. Su&&ose %e %ant to redue the eeution time of the task %ith &eriod - in order to
make the task system shedulable aordin! to the earliest*deadline*first al!oirthm. What
is the minimum amount of redution neessary for the system to be shedulable by the
earliest*deadline*first al!orithm5
Sol+ " (2x)*$ 5*8 $*6 7
x I +.$58
"tili#ation $ounds for %D& Scheduling The utili+ation bound !or /arliest 9eadline :irst schedulin( is e'tended
!rom uniprocessors to homo(eneous multiprocessor systems #ith partitionin( strate(ies.
:irst results are provided !or a basic task model) #hich includes periodic and independent
tasks #ith deadlines e&ual to periods. n bounds depend on the allocation al(orithm) diff erent
allocation al(orithms have been considered) ran(in( !rom simple heuristics to optimal
allocation al(orithms.
s multiprocessor utili+ation bounds !or /9: schedulin( depend stron(ly on task si+es)
all these bounds have been obtained as a !unction o! a parameter #hich takes task si+es into
account.Theoretically) the utili+ation bounds !or multiprocessor /9: schedulin( can
be considered a partial solution to the bin-packin( problem) #hich is kno#n to be *%-
complete. The basic task model is e'tended to include resource sharin( release "itter)
deadlines less than periods) aperiodic tasks) non-preemptive sections) conte't s#itches and
mode chan(es.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_"2&.html
Real Time System by Jane W. S. Liu ha&ter ?.6 Solution/.?.6+ a) :se the time*demand analysis method to sho% that the set of &eriodi tasks (@,
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_9426.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_9426.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_9426.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_9426.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_9426.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
44/75
), (A, 6), (=, =) is shedulable aordin! to the rate*monotoni al!orithm.
Shortest period has the highest priority...
T (8! ) w(t) "
N " 7 8
∴
T is schedulable T5 (6! 5) w5(t) " 5 ⌈t*8⌉⋅
N5 " $ 7 6
∴ T5 is schedulable
T$ (C! C) w$(t) " C ⌈t*8⌉⋅ ⌈t*6⌉⋅5
N$ " 6 7 C
∴ T$ is schedulable
b) Su&&ose that %e %ant to make the first units of eah re$uest in the task (A,6) non&reem&table.What is the maimum #alue of so that the system remains shedulable aordin! to the rate*
monotoni al!orithm5
Solution +
T"J(8!)(6!5)(C!C)K
T"(8!) T5"(6!5) T$"(C!C) (in order o& priority! T being highest)
T5 (6! 5) can be made nonpreemptable &or the &irst 5 time units (its entire duration) and still
allow the system to be scheduled on time.
Solution 6+
http://2.bp.blogspot.com/-jUOg3_rxJhk/UnDTgqvbCKI/AAAAAAAAAE8/Z7Exf-TlMW8/s1600/targeties3.jpghttp://2.bp.blogspot.com/-jUOg3_rxJhk/UnDTgqvbCKI/AAAAAAAAAE8/Z7Exf-TlMW8/s1600/targeties3.jpghttp://2.bp.blogspot.com/-jUOg3_rxJhk/UnDTgqvbCKI/AAAAAAAAAE8/Z7Exf-TlMW8/s1600/targeties3.jpghttp://2.bp.blogspot.com/-jUOg3_rxJhk/UnDTgqvbCKI/AAAAAAAAAE8/Z7Exf-TlMW8/s1600/targeties3.jpg
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
45/75
& we make the &irst x units o& Task (6! 5) nonpreemptable T$ is una&&ected by this change
since T5 is a higher priority task anyway. T5 is also una&&ected. ts response time will not be
a&&ected by the change (i& anything it would impro'e)
N" x 4"8! x4"C
x can be at most C time units. ut since Task 5 (6! 5)! only has an execution
time o& 5 time units! x can be 5 time units
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_120.html
Real Time System by Jane W. S. Liu ha&ter ?.6- Solution
/.?.6-+ 3 system ontains tasks T C (9,-), T6 C (?,=), T- C (=9,9) and T= C (@9,@). Thetotal blokin! due to all fators of the tasks are b C @, b6 C , b- C = and b= C 9, res&eti#ely.These tasks are sheduled on the ;> basis. Whih tasks (or task) are (or is) shedulable5
&lain your ans%er.
Sol+ For ith task to be scheduled by EGF basis
" $*+ C*A +*C+ 8*8+
" +.$ +.58 +.58 +.
" +.#
&or T
+.# b*+ " +.# 8*+ " .C M ...not schedulable
&or T5
+.# *A " +.# +.+A58 " +.#A58 4 ...schedulable
&or T$
+.# C*C+ " +.# +.+ " 4" ...schedulable
&or TC
+.# +*8+ " +.# +.5 " . M ...not schedulable
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_1209.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_1209.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_5.htmlhttp://4.bp.blogspot.com/-FcFKhMruZEU/UnDYNx35FRI/AAAAAAAAAFI/qL6ZK7OkGcs/s1600/targeties4.jpghttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_1209.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_1209.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_5.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
46/75
/arliest deadline !irst schedulin(
%arliest deadline first 2%D&3 or least ti'e to go is a dynamic schedulin( al(orithm used in real-
time operatin( systems to place processes in a priority &ueue. Whenever a schedulin( event occurs
2task !inishes) ne# task released) etc.3 the &ueue #ill be searched !or the process closest to its
deadline. This process is the ne't to be scheduled !or e'ecution.
#hen the system is overloaded) the set o! processes that #ill miss deadlines is lar(ely unpredictable 2it
#ill be a !unction o! the e'act deadlines and time at #hich the overload occurs.3 This is a considerable
disadvanta(e to a real time systems desi(ner. The al(orithm is also di!!icult to implement
in hard#are and there is a tricky issue o! representin( deadlines in di!!erent ran(es 2deadlines must be rounded to !inite amounts) typically a !e# bytes at most3. 7! a modular arithmetic is used to
calculate !uture deadlines relative to no#) the !ield storin( a !uture relative deadline must
accommodate at least the value o! the 22duration o! the lon(est e'pected time to completionU V ;3 N
no#3. There!ore %D& is not commonly !ound in industrial real-time computer systems.
7nstead) most real-time computer systems use !i'ed priority schedulin( 2usually rate-monotonic
schedulin(3. With !i'ed priorities) it is easy to predict that overload conditions #ill cause the lo#-
priority processes to miss deadlines) #hile the hi(hest-priority process #ill still meet its deadline.
/9: is an optimal schedulin( al(orithm on preemptive uniprocessors) in the !ollo#in( sense0 i! a
collection o! independent jobs, each characteri+ed by an arrival time) an e'ecution re&uirement and a
deadline) can be scheduled 2by any al(orithm3 in a #ay that ensures all the "obs complete by their
deadline) the %D& #ill schedule this collection o! "obs so they all complete by their deadline.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s - liu_#.htm l
Real Time System by Jane W. S. Liu ha&ter ?.- Solution
/.?.-+ "nterru&ts ty&ially arri#e s&oradially. When an interru&t arri#es, interru&t handlin!is ser#ied (i.e., eeuted on the &roessor) immediately and in a non&reem&table fashion. Theeffet of interru&t handlin! on the shedulability of &eriodi tasks an be aounted for in the
same manner as blokin! time. To illustrate this, onsider a system of four tasks+ T C (6.@, 9.@), T6C (=, ), T- C (9, ), and T= C (-9, ?). Su&&ose that there are t%o streams of interru&ts. Theinterrelease time of interru&ts in one stream is ne#er less than 4, and that of the other stream isne#er less than 6@. Su&&ose that it takes at most 9.6 units of time to ser#ie eah interru&t. Likethe &eriodi tasks interru&t handlin! tasks (i.e., the stream of interru&t handlin! 1obs) are !i#enfied &rioriteies. They ha#e hi!her &riorities than the &eriodi tasks, and the one %ith a hi!her rate(i.e., shorter minimum interrelease time) has a hi!her &riority.
a. What is the maimum amount of time eah 1ob in eah &eriodi task may be
delayed from om&letion by interru&ts5
http://en.wikipedia.org/wiki/Scheduling_algorithmhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_5.htmlhttp://en.wikipedia.org/wiki/Scheduling_algorithmhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_5.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_5.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_5.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
47/75
a. Sol+ & an interrupt comes while a -ob is running or a higher priority -ob is
running! the -ob
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
48/75
N " +.# 7 5.8
∴T is schedulable
w5(t) " +.C +.8⋅⌈t*5.8⌉ " t
N5 " .# 7 C
∴T5 is schedulable
w$(t) " +.C +.8⋅⌈t*5.8⌉ ⋅⌈t*C⌉ " t
N$ " $.C 7 +
∴T$ is schedulable
wC(t) " +.A A +.8⋅⌈t*5.8⌉ ⋅⌈t*C⌉ ⋅⌈t*+⌉ " t
NC " D. 7 $+
∴TC is schedulable
c. "n one or t%o sentenes, e&lain %hy the ans%er you obtained in (b) about the
shedulability of the &eriodi tasks is orret and the method you use %orks not only for
this system but also for all inde&endent &reem&ti#e &eriodi tasks.
Sol+ The interrupt beha'ior described in the problem is the same as the beha'ior o& a
high priority periodic task. There&ore! the amount o& time taken handling interruptscan be analy%ed with the same method as high priority tasks.
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3&".html
Real Time System by Jane W. S. Liu ha&ter D. Solution
/.D.+ 3 system ontains three &eriodi tasks. They are (6.@,), (=,9.@), (@,9.D@), and their total utili2ation is 9.=D@.
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3964.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3964.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3964.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_3964.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
49/75
a) The system also ontains a &eriodi ser#er (6,9.@). The ser#er is sheduled %ith the &erioditasks rate*monotonially.
) Su&&ose that the &eriodi ser#er is a basi s&oradi ser#er. What are the res&onse time of
the follo%in! t%o a&eriodi 1obs+ Kne arri#es at - and has eeution time 9.D@, and one arri#es
at D.@ and has eeution time 9.?.
Sol+
N9 " C.58 2 $ " .58 N95 " #.A 2 D.8 " 5.
6) Su&&ose that the &eriodi ser#er is a deferrable ser#er. What are the res&onse times
of the abo#e t%o a&eriodi 1obs.
Sol+
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
50/75
N9 " C.58 2 $ " .58
N95 " 6. 2 D.8 " +.A
b) 7ote that the utili2ation of the &eriodi ser#er in &art (a) is 9.6@. We an !i#e the ser#er
different &eriods %hile kee&in! its utili2ation fied at 9.6@. Re&eat () and (6) in &art (a) if the&eriod of the &eriodi ser#er is .
Sol+ ?ase
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://2.bp.blogspot.com/-MbIhdAL2AXE/UnHrQZcnjyI/AAAAAAAAAHg/9_hoJxMX1zU/s1600/targeties10+(3).jpghttp://1.bp.blogspot.com/-sWfBs518IXE/UnHrJHerp_I/AAAAAAAAAHY/Bvs37Uuk9TA/s1600/targeties10+(2).jpghttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
51/75
N9 " 8.58 2 $ " 5.58
N95 " #.A 2 D.8 " 5.
?ase 5
N9 " 8.58 2 $ " 5.58
N95 " #. 2 D.8 " .A
) an %e im&ro#e the res&onse times by inreasin! the &eriod of the &eriodi ser#er 5
Sol+ @engthening the period can impro'e response time because a layer period allows us to
increase the execution time so that more o& the sporadic -ob can run but period must remain
short enough to replenish the budget be&ore the next aperiodic -ob arri'es and short enough to
remain the highest priority task.
d) Su&&ose that as a desi!ner you %ere !i#en () the harateristis of the &eriodi tasks, that is,
(&,e), (&6,e6),.....(&n,en), (6) the minimum inter#al &a bet%een arri#als of a&eriodi 1obs, and
(-) the maimum eeution time re$uired to om&lete any a&eriodi 1ob. Su&&ose that you are
asked to hoose the eeution bud!et and &eriod of a deferrable ser#er. Su!!est a set of
!ood desi!n rules.
Sol+ . /eriodic Starts
5. ,aximum /a
$. ,inimum ea
& /s " /a and es " ea! then all aperiodic -obs will &inish as soon as possible. & the system is
unschedulable! make the period as long as possible (and the budget)! so that as many -obs can
&inish as soon as possible.
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://2.bp.blogspot.com/-gwKKZ4ROwXQ/UnHrZ0p34JI/AAAAAAAAAHo/ph8j46KmZHc/s1600/targeties10+(4).jpghttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
52/75
Solution http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_&.html
Real Time System by Jane W. S. Liu ha&ter D.6 Solution
/.D.6+ 3 system ontains three &eriodi tasks. They are (-,), (=,9.@), (@,9.@).
The task system also ontains a s&oradi ser#er %hose &eriod is 6. The s&oradi ser#er is
sheduled %ith the &eriodi tasks rate*monotonially. >ind the maimum utili2ation of the ser#er if
all deadlines of &eriodi tasks are surely met.
) Su&&ose that the ser#er in &art (a) is a &ure &ollin! ser#er. What are the res&onse time of
the follo%in! t%o a&eriodi 1obs+ one arri#es at 6.- and has eeution time 9.A , and one arri#es at
6.D and has eeution time 9.? 5
Sol+ Find max es so system is schedulable.
W1(t) = 1 + ⌈t/2⌉.es = t "M W2(t) = 1 + ⌈3/2⌉.es = 3 =>
es =
W2(t) = 0.5 + ⌈t/2⌉.es + ⌈t/3⌉ = t
=> es = 7/4
W3(t) = 1 + ⌈t/2⌉.es + ⌈t /3⌉ + ⌈t/4⌉.0.5 = t
"M es " +.8
Hence! es "4 +.8!
" es*/s " +.8*5 " *C
so!
http://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.htmlhttp://targetiesnow.blogspot.in/2013/11/real-time-system-by-jane-w-s-liu_6.html
8/9/2019 fullsolutionmanualrealtimesystembyjanewsliusolutionmanual-131113071856-phpapp01.doc
53/75
N9 " A.$ 2 5.$ " C N95 " A. 2 5.D " $.C
6) Su&&ose that the ser#er in &art (a) is a basi s&oradi ser#er. What arethe res&onse time of the abo#e t%o a&eriodi 1obs5
Sol+
http://2.bp.
Recommended