real time system 06 philip a lapalante 2nd edition

Upload: anshuljain77

Post on 30-May-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    1/34

    SVSIemHenOrmanceAnalysisndOptimizatio

    KEYPOINISOFTHE CHAPIER

    ) .Notri rrlpr dnvcn syiems cfl b. e6ily an{lyzed or rcilrime bh x genenllynpo$ible o pFdicL*omr asc o maoce 'n identrpr

    3 Inprovns rveGCe c$c perfommce genenily dcErds won cseAlLhouehdoi conpilen perrom good opLimizarion,toy shoutd be$udicd ur ro my$ Jretrbehrvro.'Ineft 6 m idhcEnr adeotrinnmeandncmoryE{tummenrennoy

    Ii 'his chrprerwe exmre 6sues elaEd o syiem prtommce osed onfttponschq tnc 10 dms md nemoryload ns Recall nar r.rp,,y n,? r rnetrmebeRe.n reccipr or f inrenpr ad complcrionof alt asscia@dprdcesineTirtrJeili,B i rhepereniase ol lme rhs C?U is do'ne 'uefd pnce$rg.Findly,us,i,a lr..r,r x rhepercenhg. fusible menory ha is being sed .'n'h .hapu, moE rhD my oder in rhc praenr votume,h i conificruon ofexpenenc.. rolkbe. &d dckr. Anaiysisor ealrime pedomM.e is difrcuu arbe* md usudly impo$ibl. for inremF dnve. sys@ms.

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    2/34

    9,1 RESPONSE.IIMEALCULATIONTIE elm,xrionor stn.D{-qrrhne LheLas[ rl r (r l dnfhu f.o.snng difftrsd.|cidLngon rhr Lr"|E r \!nem inroL,nl Tlrmu:1r.tr' r tr{ Ne hrve beerloor'ns rhcr crl.trlircn! buL r \ nc!$\'y '..dnfhtr llio* rnd'ng\heEst cxn hci dnrtrs\LherDs $u($ oj tu\f.Ds. rne delrl rndho! Lhey.i.

    TLE e\ponseimcJcl.)_ o' r polled oop $em conllr ol Lhrte omPonenhLh.hrrdvrc drLx)r nr,i!nl ni rtrLDe he ol\.re lig bysoi'ee{.m! d.v'ce:Lh. rmc o. rhcFoll

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    3/34

    ere.urionimc of !ich Phrt i,us

    'lnecalcu io, orrcstotrsrms foofLclor\ includiig tr,erruprakncy. ontxLsqilch rmemd schedde/d'spfthrimcs sq j Fjgurc9.1)!d.!L!i;gi c,,up' aEncy rd Lhe hedule im$.'lhe ronkrL$ il$ trmes er rull(cd by 1rc.,gftcn tolLovinBhc uls ds.used,ForpNnotrve sysEmsth llred LrcprcsciF ,hc racb' s aftectns rhe espons im.. In gcneml.he rtspon$ rime brn, = L,+ c .+ s +,1 , (9 .2 j

    wheEa, r fie inkmpr lrlcncy.C, h 'hecotrexr aveLiLne. h Lhe hedulp!me. and l n 6e adlal pre.es ime$eeFem 9.1)

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    4/34

    Cxl.ularotrol contiL ev.re$o tims r rN smr t p . i o n L U l c l r { h e d u l c ' m \ \ . n e g ! b r qhen l r .$ h in inLcmtl rndml{ ,rh 'n! trPle nktupb. whcn ! isp p l i q J m .n n l ! n . ' o n q (h r n ' n e m p i l o n r D l l r 5 ( e

    c e 1 whetr heh,ghri-pfi.rLYroral 'Enupr l.t!r.y canbecompurcd

    q l c r I r n . 1 1 ' d p ' ' . . ) L i r a . o . " ' o nd e J r ' f r h e . .r, f lhe ongc$ ompletionim! loran nrnc[on m rhe nEnprd' / L i n ^ - | . i - r e De , i k I d , . . b h dh \p r ' J ou n -ou o . c t i r L nne { ^ 1 i n L o 'b T i r p s r i n !F - p . \ . l l . u ' 1 r \ ' l - ' 1 1 r D ' . 4 e e \ 0 . . . h d . ! r r d1 - Fn c J - p . . d e r .o . ! r .qo Odemi".r on o n ( uinrd ',' i on me di c ndr: vhen r luilFfr.rrJ md ne r rcmpL o jnemf on..t

    Fni..on{d$ 'lr 'ldem'nd onoi*hrn Pmrs, x oi Lhe igh*L0nonl]']

    'nLenped. rhe !dlLul&iod of rr i5 dimv .Ne il is roo involvedfor N here.F*!m$ tor pFentrve pnonry d n

    wheP , is Lieumenecdld oSid.eprmes , misll bcimp.siblero rmo$ \yncms:nexrnnlesor boundedctFnse\ J kms ee l l l l . l0 r l . . r l l43 l .

    crnnor eFo.$\cd unrl rll hishe.pnorily cod"es rveIn Lhb.Ae s! .m .etresenLhe nrempl r[en.yas

    co'npLereishe.pnoriryotrLines

    9.2 TNTERRUPTATENCY'ftfle is ad inhernr dehy brsen wben m intenpr o.cun lnd Phen ceo-s ' c .d .ng . . rh t sde) F ra l ed hr , , - ' rpJ 'd r ' nJ . I r . rdbe :u \e {s o- Dor \tudraRdd\onv G rcLd(d, d bo't delimd incidenul. The effecr of la@ncyk mosrpm.omced-bur easi b fiidvhen lowe4nonty inremps tre inriatd ddns fie erc.rion of ? hiprionLy Rsk. For the reveise.or in nundiobin sysEns, fte ered is slnentrtlesrned 6d more subLleLodelemine The rouowmspffisnphs desdibls,ency sourcs in fudher dehil.

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    5/34

    The onnbrion ,o ,nLempLarencyfsurrnigiom rhe imiLiLioon,hc swnshintt ' "d 4 ! ! i ' e -R

    r'./4r. TheE dehys catr prcduce buih-in hLcn.ies ofumse.ondsor .vetrnicrcse.onds.ro rexrnplc. rh. amohr ol rimeberweentrhef ri.xhflrldcvicc mtiahsan rtfttrttsiSrd lnd when l dudly laLchs'nLo heLn'.',rp'cofkollernr] besveml nrioF.oids or morc, cpcndiry nrch'ns peed f 'lf iikmpl.onoucr chip.le lrom Lhe anufaruEr, or nry be measui.d

    Macroinslruclion Execulion TimesnrLrudionDmgnd (o r 'i.fof.og.rf) rlE is.wirh c\! crlcprionr. nimenpl.nrn nrsLncdhLccirl$, condi on .odercgrLcis, nd.'hft dda rccdcdo donplcr cxccurion l rhemrcminirudion(mtrrop'oe,4r) otrldbc dcsoycd il inLcnprod. hus, e needLo ind rhe.rcluior dne olcachmrcoiniru.rion r-. cuhrionme$urenenr(seeeniod3.23r .orhanufuclus s dtu shcds. te itrhcrion wrh rhe onSes xecurionrime n your ode you mrr checl rhecompiler uLpuro decide h6-$ill.Nsc rhcmdximumnrempr kre..y f n hN JU$begun xecuhs when hcnrcmpLsicnal s to.civ.d.

    & | t ! d e ' . n l y h { h l n s 5 0 m i r \ q q d \ rThe aren.r aNed y insncnoncompleook onenovdlooked,esullinsin *ious problem. n cerun laneuogemplcmenu ns,su.h as vdions otFORIRAN p sns prmere4 vB paEmer.r k6.e prorecredy disrbleddes m [email protected] qr$!h liis rypi.dlyenrrlsnulriple ndircr oadswh'ch irfie fis is ong cmrcsuk n conridsrbG eriods unnswtuch he n,emp6 {edislbled.

    Delibnre di$blin8 or d,e in@m!6 by rho soir*&e ca creare substrriali.hpr laiency, md 'ns mus b includ.d in de ovoGll larncy calculauonlIdmpB e disrbledor a numbr rEmons, ncludirypEerion ol cndcarEgions, u Sroudnes, d conrei swirchins.

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    6/34

    Whenx higlr.pnon'y . thc Lotulnlcnprrden.t.m De omDred

    $h{e L,,,,, 'hc mx\trnuNnLenpL rknq. rf is rhu mrr''pr Lrlcicyd!! roprotrcr'.i delrror rh.,nLenpr5isml. r r rlr lon,sc! o'hplcrionlnr ol.0inn'r.!on, rd rr, \ rhemdimm, ri c rhc irn 'ttr mt d.libftrcly disabledrodin!. SjN Ll'r iitrtr$ *ill occufsrhc' *h,le Lbenkmpc R lrp i.n r disubhd trkrenc] s ieplr(cilon rL! g.catc. f 'lic Lro

    d hfrruF hfrc) ssn0 r + oatf0.rol= Do r

    9.2.5 owPrlorlrynteruptsHigh

    hrs ben dcird, rhc dfcdlvc 13conplerc h.hish-pnoriry\l-ro Lhc Lhflcffcctr o oLopfly DcLennnalof rhe time ro.omplere hc higr-liriorry . rc h dh.trscd in strtis.qu\ecrons. ftur, se can represc rltr hrci.y 6

    when low prionLrtuurincn(rtr,p6o'! ollrighcrprio.iry hcsrulr.n.onaEnrhecdcu l&ono t ,n lenpr l r rncy i s rh rd f cdo l l r i sL r rp io r i r yk \ k5 ru in i4d rhe rme l rhe nkr!pr. sind. rhdhrd\!i.c u\trallymhcs LhcDcr!p' b 0Eimcftpr rontroll!fbur o.snor eml Lh.cPU un'il ic hiBherpriony nLernF

    *h{e a-- n rhc nrcnpr l.Lcn.y nd / r rheLime eedcdo omdete

    9.3 TIME.LOADINGND IS MEASIJREMENTfte need o knov theeft.uion 'idc ofvdiou)'Dodules d rheoverdlsv.'Te odm! be'oeimpeme hrio i impotunr o ibo'l'aflln,gctr.n' drdengneeringpffspedive.Noronly&ecloadingjcquncmcNnarcd$sP6dessnsoalsbural$ lnoving rhem, p.irri s imponsnLii$lccriig h{dmd |ne sy$emdesisn pprcachDuridChcadingmd resins hr(eded D rocuson rhos nodules

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    7/34

    9.3 . i

    9,3.2

    T = ; \or cou6e. heacLu.ln!ruqion (im* aE rc,turcdbcloahind Theycm beobra,nedmn LnanutLuid\ dau sheds. y mrg Lhensmdions ins rto-s,roaryzerorsimursLo^.r by edu.!rcd usssins. manufanmr ddu hcds tnmbqotw es o. erchnNU qD' mcnccded *elr. Exmple 9.r r usrres rhecrrcursrions.

    iMdequm Scvrii duhodscr bcusd roprtdrc' rmtrme nd \!!uh LimcoxiinsUsinq LoEic nalyzerThcbesmerhodor rEsqtrg 'liecrcdlio' trmeol.mh odul.{ndrheoyfloltCPUuhlizrbon\ ro usea LrCtr.nil),zer 'e rdvdrlr olltrc uecdut.fl trhL.n.iermd olhfl dclrysLrar c nor duces I1! diutrbrcr rhd Lhr rrqm mrr oe.orifL.lc! (orpM',Llly) ode'1,d '. ngcr h.rd\arc mun b. av trllblc ftur.rlic oSi.drl!zcr is usurlly mploy.d Dlyr Llrlft nrg$ ol $c .odtng hr\e.dichnrn! phrsc.md*pedrl\ dtru-qrrlen inLelntronr los'c ii y&r lor riminspupDs\ '\ dtr.trsld in ChqrE. Lt

    whcr r; rooerlly rDrLheoer orlyzci or ifone n nol rvritiu.. inind'oicminins rime ord'nA trr10 qq! !re!utr,rimc ftis cchnL,tue qurcs ,hd the code alErd), b! !,nLq,, ulL 4rppmx,nra.ont ,he iml codc ri!, or rhr sm'lr. ryncn* be xyilrbk for'nspen,onThe rpprca.h impl) nvoLvflmcn-q LhcoigALprh rhroulh hccode, ountrnc r in!rudion r),pes ong rhesax u dJding hen execurion

    Foranyp.rjodic t6'ch. he orrtLNkereculon rm dn,idcd y rhe.ydeh. lbr Lhr n'odules LLr in4loading br fiar ffk In lpo*dic or m'dsysems.hem,{idum lsk execurione should c tre(1.I kno*. Addigthekperce^bgdovd.ll $e rask in fte syreD yrlds Llr rokl lime odrne.ItrN 'me ording.l,n rhe.rde rime orm'nnum,iLn.bdwcrn cureDlet to icy.le Ti iidA, k Lhe cruil e\ecurion me.den tor, u\k\ !e have

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    8/34

    l*r's do rnelolding nJysis or he oftspodinu ode.

    A ,ir?,? riyi,3 conbines$e h,sh{rder rDsuage ns@n,otrwft ftequivaleff ssembly r&eurse in$rucrions 6ros ir for e6y r,crng Fo owineshonly6 a mixed isriig ror Lif .ode r a e.nedcassmbly anguaCcor .2 addEs machibe lne ssmbhr and comp,ler diEdives have bc.n omi(d(3ronswft $ne dra dlooron pseudoopsl for clrny andb.caus. ,hey dond

    The nshcLions bsiming in F are noadngpont 'nsunnions rhaLwewilds.ume,le r0 -' . rc\aono!.we q'lla...me dllo p nlru,non: m maeE

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    9/34

    Tmci.s te woFLp3hmd cou.rine he .$rucrions,reeerhaLrherce12inkger md 15 ammg po'nr nshcuons or a rord exeurim Lnne r 0.322nill'*co.d. S'nce hr pFglam unsn a5 mrllis{ondcycle, hedne-loadings031 = 16.5%. f fie ofier cycles serc malyzed @ have a rins-loadid8 ^lq 0m'rh*rold.].le 10.6.dd an-milLssbndoad'ng or ln6 roregDundr,bockgrundys*ould be 60 5%. could E lnne loadins be redued for rhis modutc?Id Lbiscxmplq L\c cdpdi$d could havc b.n nade in tu.d pomr rosavedne. This, how*d'resrric6 lhc tuEe of rhe veiable PRE TAKE. Diar r,

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    10/34

    PRE TA(E.ould onlyhe nlesermulriples fSCALE.If LLr(weF rceprableDMAd values.ro lhevanablesffar rnddz.The.ompensabonurns RouLdperfomrll crlculrronsm lixedpoint nd {ould conven he esulcLonorrne

    As a finalnoc, theprme$ ofinsnd'on coundns anbe aurcmaEdfapdser is wnGn for rhe arser r$smbly lrngurse rhd crn E\olrt brm.hins9.3-3Picroridl epEenialio.

    {! u{ J'fr!rcnL hJd'nB r .olor p ems or c\claioi l.\.,i, ifiguR Thq eLdd' i Lhe o'e5.ore\p.f,d. o Lhe {usl e djrodule. wheE,\ the shadingpdrhs ae usedLo d'ffercn'iehe'ghL rrneodinateuis is lsed o depicl noi,Iy evelTodours.dri$ J rimc iie rirh 'im'n rhe_,e . runngw: ' l -e l " she' onoa . )mm-k indsor i JF !shrde Ue ponion ol lhe rime ioe needed o conpleE rhe ksk. Thennen-,' his F -.t 'emrmo.nnghr 1 -L{ bf ienpFd d I c-eJJ'm li \tung v'd

    Il$e chm cannol e codplercd.e. 'he sysEn ns,ves s a Gel lor rhcsyr.h 'imerosdi.g nd te

    q

    5 m 0{ * I

    rsE e.4 ds dd id $rtluoi r.bn

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    11/34

    onLbLLo'al.r. rlsob. usd ro.ompui.ih.voGL.rseresPon\eimeura raslin p*iodic s)_nenrTh,sL dNcu$L'ln. \ubsr'lucDLecronThtr LtTeDr'epE*nhrionalsoN.monoronicy$emit Lhemsimum inLcmrf nlEDcL.s r.e kno*n

    4 Inst.uclion xecu[on lme lmulalorsThe calcdruonol ,nirudion ri'ncs equtr$ more hm jlr rhc inromalon\uppl,ed Llre PUndntrfacLuefsrr bools.11islsodcpcndenlon emoryrc.e$ hnrs rnd wdr ilcs Ll'!' am dek.mined y theove ll sysemdessnSome omDanr\ thd tcquciLly dcngnph'fonn\ ur nnuladon roshrn\ o d'cl'ndndion ere(ion tine a0dCPULltroughpurrn en-qme{s rn ilu 'he cPU L}pe,memory pccds.id anin$rud on Dnx, rnd .alcukrc Lorrl n{rucron imes rnd rhroughpulStrchsinularoAmay be commncidlly va,lable u( arc senerillydifll.ulLLownEbc.au* mo! machiner odi) havcwde vrrirs erecurion fles. The woslermples&e p'pelLned&hin$ a RlScarchrccruresbr phich hese'luerceol innddions nnuencesn\ftcron rim g.

    shonsedions l code m bedmed y reddr,Ste \y$emdock befoEandafier te exe ion ol Llre ode. he trmediffc(occ cs. Lhen e mea\uredodeLemmeheac'ull inre lexecuuon. I!ourr. irihc code ormally rA onlJa re* microse .onds,t isbetreroerecur scvcrdl outmd lmesand hen !'deErorrlere.uliondmcblrhetrmerpe.l.ThntrillhclpLotnovemy'nrc.u .tinmduced by the -lnnulmry or Lhe tocl. Il you usc rhh Echn'que,be sure to!dh!lareLhecrurl ime penr0 theopenoop md subrad r frcLnhe oal Thsis ii,loeous Lo subhcring tc weighlof lhe plriic cup uscd o weiSha

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    12/34

    9,3.5 Detehinislic Pedorm.ncecrche, p,per,nes, d DMA (r dengned o ,mtrrove veragecat ue perlbman.d denoy d{eminrn and 'us nrkeprcdrcnonficllrime pdlomanee$entrdly mpo$iblc.In he ss olcache.lorex.mple, rhe nfficdon in dEc!.he?whnc r r beingltr.hedromhasasilTi6cdnrer'r'edontheeKe.n rftollhrr iniru.{ior. So.Lodo worr cas pe'lbmmce youmunrsumethaleveninrrucrionisnorekhed iom!&heburlrommrinmemory oveEr,robnnsLlHinsrucrionnro he tuhe.oneolrhe cx!he eplre.rnL aLcorLhms'icus.d EChaprer mun be used. hn hr\ r very deldff'ouseflecron lhe tredrLdip omm.e simirdy ,n hecase lpipehnes nemus alwaF ssu,nc haaeverypo$,bleopponDiny.trpLtchne e.dso|Jtnu\h.d.Fim]ly.NhcnDMArpresenL'nhesvncm. chivc roa$unc Lhd liclc(caljng so!!!dns {ers}opponuriry,r!s nilliring n$iudion crh ridcr.Docs rhismlar rhd thlsc *idcly uicd dlhircclurulcchnhuer rendersy$.m ffcdivelynonbdyzrblo d pnlomdnc.?Es*nriall) yes fioweveiEmnking omecasomble lmprions abod h! rtd imprcr trhek efectr,sortu onal rppoximdion ol perlomrce is posible.

    9.4 SCHEDULINGSNP.COMPLETEYoumayhavcastcdyols.lL why hn r rlrcrc fomuli o r rc.ip. forprcdidin!pe omin.e in nor rtal rime sysomr?"The ms*n is $ar moi $hedul_EprobGns nvolv,ng erl syiem re N? complere lobkmr.An NP.?,,r/.?solubonsm exponentraiuncrionsor rhepmblemsize. su.h solutro's m lor :!solvable, venon superconpuLen.nd'n-qpoly.on;l dme solurion ro dre da$ ot NP-compleleprobGnxwould rprcdr mrjorscEnnnc rrdiem shiftmdhrve fantNic economicmrlicamns.Md

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    13/34

    sq!nd\, hovevc(bl'evehd NPcomplekproblcms ave nlvhmdsoltrLio's(burLha, e w'll ncvc.be ble ro showLhaI)Forexample.t,tr ercelGnl rPosti n Lhn .in' [153].3 umbqofdsnc4r1 '?q \en h rn ' l f h i n ! \ " t r rprtdi.rl coDnrrin(or concluded (hc|]rohLemonrenPds NP compleLcrNP r,&/ (AnNP hfd pobleDL simihrL. anNPcompletprobleDrx.epr lDllo r hc NP hardprobl!tr DoL venM ciponen[rl Lime Lu'ioncm be lnudd

    l

    5.

    when rhcc a'e mutoal rdNon .onn(ins i r Lmp.siblc 0 indxronlly on lineop rmalnn limc hcdukLThe pmblcmof dec,d'ng herhr r LsPo$ibl! ro $hcduk r seL I|renodrproces*s har \esmDhnr mulriprocc$orchedlling ioblcD wih r*o procesotr.no tsotrr$, dbifary Pmial odq rclarDns,md evsryusk hav'nsunr.ornpudion imc r polynomialA pinDl order eLariondd&res ha lrny troc$ cm callNelf (renexivnyl fpo.csn crLhPtuce$ . thentheavq* r norposibleGflLsymnerry).d I procc$A calhpdesA andproccs a crlls po.cs C. thenpmces A .rn .aLrPnes IThe ntrk'fmcesor s.litdllrrg prDbkmwirh ttro poce*o , no d_sotrrues.ndepe.dcnrsls. and rbirftry .om0ua' on Lines s NP-Tho mulrprocssor h.dulioe problem irb rvo proc.soF no re5our.cs.ndcpcndenrsks, bitn.y Pamdoi{, ind llsk compnr nnumes f enh( onco' lso uni( of iine r NP compleleTne muhipo.e$orsch(nlins floble'n *nh rvu po.c$of, one Esource. loEr pmll o s(pinhl ordcron erchproces$r), ndea.hcompuoLionine ol every sk dluil ro I untrn NP ompicE.Thenuhiproucsso.hedulingpFblem urh Lhfte r morc .o.eso^.one esource.ll ,idePendenLsksta\k ,turl o untr NP.omplcLe

    De ynie q mr ru n!6r money n \ trh \Jn.m\r

    REDUCINGESPONSEIMES NDTIME-LOADINGldsnrilyine aserul ompuratron,sprelimin4'nep 'n Educm,ginr load'ncManyappmachernploycdLn ompiler oin'zaron ca bc uidt2l bul olhermerhols sveevolveddr arcsPec*i.all) nqred to*rd Eal ne svftms

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    14/34

    s.5.1 onpule l slowesr_ycleAlllrocflrn-q should edone rhcdowsli3rc 'hd.M b olcEed checkinsr LeDiperrrureiscrtr lbr. hrgc room r l:$er rlran se.ondDy bewasetul.r.r ont$rltr.c ryprrlly crnm{ rhnngetriclly otri4 ro Lhemal.cnD.In ourtrudcar lanlekmpk. r dedi.re.l *nsor is rsed ro monnor h! Ernpmrue.ir),r rn o!4+mpcnruF tr dqecr.d.

    S.5.2 ScaldArllhmetlcA\ wesrv in chrprer2 nr!gqocetrrons re,eLyf'.rlly r{er LhanoahgPo'dop{r'on\rorDorcomptrle$.wecmmkcadvnreeor'lls ra('n.ena'nsyreNhyDitrLL'nlym-s'nLe-qesy va/1/i,./,, Lo iLnuhE or f e poiNopftr'on\ ThEs.lulon Rasoreof$e ft{ merhodsorimpllmcnringlL{umbsoFmions In. y conipuFr yftms Hue r llo',scomplcncNtrfber I Nd. rl'eLsB (leNsisnincanLtr )ol vh'ch is NrigneJ. $de I!.roi uhhh issonetrn'esalled h..qrdnx/,,toor $e numbff (ee Figuru95). ll Lhe unLier

    sompledenrn ese4LhenheMSB mossignificanrit)orrhenumberch likesi8I bn.The ages numberhdcm heEpftsnrsd hftwoyh (2 ' r,)' LSB,rdrhe nalle$numberhdcan eEpresmleds 2' ' LsB.

    c b y i F | } 4 | t , e | . d d o . 0 0 l T t r j ' 6 l r u n E

    ascaled umbc canbe addedmdd,v'ded y r con$b' (bur or snorhercaled umben, sssnedcompuhrionsnvolving uch umben m b.pe omed n in'cgcrconvened ro flo4in8 po'nr only rr Lr'e lii ncp-3 prcce$

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    15/34

    Since heGGm invns Elrlon beNeeDccu !t i.d oogcofrbe nalediumb* r ndural queiio. rrises: Ho{ d@s one dcrnb Llrc ppropnagranulanryl SuPPosehe -bn nui po$ ve Frl nunberThen

    wlll rcprcsenrny.ombrin rhh inewalro wnhinoneLSB For0trDibeBirhnoNynmefi. nnges, eleclhe ueNrl sidiho buL se$c hl-eflol fie 1{or j e q u r o . B r u . e , . r ! - t d ' n s r n L \ B o r o m

    9.5.3Blnary ngularMeasuremenlA vriar onon rhe .alcd um$r idca ses e lad 'hr addD-s 30" crnv anslEn [kc 'akins f lros complemen'.tar n, iI360'< r < 0" is dnansre,henr+ I30"= r r30'=-J I}n re.h^iqre.cnlleditta4ansrtatmtaaRn|nt'lBAM. Norks slblloes.Considerhemor sgnilicMtbi rorm, bnword o ba$iged a value of 130 deerees. hd rhe lea$ sisnificd bir lEs m sigled

    2i ' ! 130 ecEesTh s h rhe e l signinon'bi t or LSBGeeF gure9.6)Ls h , . b r BAM Lod q l F r 'm in ,mumls lueo '0 rh - ' ,

    1302h | . __ t30c= l 60d 0

    E3ch, 6ir wordhs a Darimum alue l2' _ 21 ' ') . l30c = 160r LsB

    130 '=LSB

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    16/34

    BAM.sn be rddedmd submcredogelhn d mulriPlied d divided vDlegcs, !n'l convenedar Lrie a$ d,gc ropoduce oNns poinl cstrlLs ormored.c!@y. BAM canheencnded o Lwoor more wods. You shotrldsa fy youaclf Lhsr ie overflow condi'ion for BAft,nlnbempERn6 noprcbkmas$e dngle mplvMaPl mund o 0

    A vflarion on the scalednumbr conc.pl rrbws us ro codPure Elrttuelvcompl,cftd luncios Ning mos y fixedponr dilhme c t,ol-!rr rdrl.r relv onfie narhemdi.al enniionolrhsdenvarvelaconrinuous d Mlued umbonJ ' t L ' q I'Itd b. suppsehrrrhs olloqinghmncx*s:

    Then G) h cllled dE dsrtari" or /di This dedvtlive d r EPEsnb thesloFof fie llncdon d ut poin! andwe cm lse rhh infomd'o. to nreQoliE rfuddionardu.lno*npoinrJ bclqeenrheknoMpoinboI|netuncbonarrarThenN iep in atply'ng fift chni'tue s to build a ribte ol $3led DGsG

    for rhc uncrionusingan anay|narconhins nc sMple rmcrion p.inb aterh Atmd posibly/'(r) rt rhaL oinl The vilDs forro, r0 + Ar, md !o on do nor ndm buill nb rheookuphrcrion.II he mk'ryopemren moe rn4 ore r$le), lhm |nse v'lEro he $orcd in ine kble il theYlundlodh genenci.e, rcanThe hoke of Ar represcn6 hdedfl bsrweDdsftd resolurioior L\e lncnot A sened. ook_upmd FEUE9 7 provid* thegeohe

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    17/34

    95,5

    As Fisure .?sho*s. |r cBblecm boused or rhe nrcQolalon lir') forr < r ' < a + A r b Y r h e l o m u l a :

    lfI(l) h srso $oFd in Lrre blc. then rhe tuk up lomuh becomcsllr) =Ij) + (\' r/(r)

    Asaindh aprcsenta $deotrberwedne md nonory oadinsAsabonusne ooktrp ableatsoprovdes or Ia$ IuncmncompurorionILlre csncdvrhe happsnso be ons or 'ne soEd values.md mv smpu'ermplncn'rdonofrhi EchnqFshouldheckor hes i6l

    l!.e01con@tria sc shc Lq dt Eri(Br tr ih(4t. d $n(ro) r {h(s).

    EssicOprimizatlonhooryIr 6 mpdbr to extenmenrwi$ you compilff and o tno{ hoP tr w'll read rdcenan hish.oder lhguase onsrucb such A care labme.s vc6us nened Jr\en aremenB.meser e6!s chdacrsvdi,bles and oon A se'orexrensilercn cascs houldbpEpar.d for rhehish-oder lmsu.se in que*nn b erpo* 6eindcaies or lhecodp,ld

    c h l P 9 r s F h o I t d o D ] U e A r o l y l n U d o A ] n * i q

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    18/34

    Morcovcr$dny ol rlr Lcrhihucs scd n codeopdm,zaron ndencoc'ne facr h,, i" siy uiLinELiccrplc$ion rhcr n no subnilure or soodinfoftm' ro rfonnoh@ any ilsornhm or expl$son ocrlts suchasrhos. harcompusexponentrls, squrE .oos. ruroiom whco po$ibre o enhmmFinally.monof c .odcopLi'nizarioncchniquesusedy comp es cb be

    clplohd 'o inrprclc cal'rinc pedombc. Olen d*e irats,es w'll Ee'nploy.d trvhiblyby rhccof,rpilcr.r cM bc runedon or of w,$ compil.rdtrec'ivs or swiichcs, ur yotr sholld knos ahilh on* ae avai lable.r ,pm'cularsra'egy norbflnBu$d. oumay anr o mplene nyouHlfar dEh'gh{d* or a$enbly xnCmgccvcl.Letir bricfly. hci.cx,minc om!.ommonly sed primizatrn echntlu6andrheir mp$r on rcalaims rrom.ncs.Compiler pLmrarion echnqus

    r Useol aidnc c idcnrnicsr Comnon subepresion elmm onr Usc oI intiNic lhcrions

    r L.op inducdone[nin ion. Uss oI eghE6 md cachcsr Flow ofconrci opLimizdio.

    r Derd vdiable eLinimtion

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    19/34

    r Shonrftln BoDlNd.od!

    tranl orrheseechnrqu.sF lcilirlted ualgL e use 1Btrh.k allui:tnur

    9-55,1 rscotA.ilhnedcldcnti(iB cood compilea hould \ed$meLic dc il,es ro eliminr u\ele$ cod!. For .\rmPle. mul'iplicrtron v rltconydfl l or rddnion y he onsrml"0'iholldbt elrmrnd.d on erecu'ar!odd.AxhoughLhismayseem virl ind vodd no.mally e voidedbv LNpFgmm'nei heu* of symboli. o.iin^.an obscure h4e rl.DhtroD\ron

    9J.5,2 RduciDn n strenglh ,e?dr.r,, ih ra,.(J, reler b (heuseolfte lanc$ msconnndion po$'ble Lo conplhh r 3ive' crlculrLion orenmplc.nmy compileNwill rcplrce ulriplq or or xn inEgd by horh{inrcs* rhd n a povn ol2. bya senes lshin in$rucbons.h l inn crions ELrpicrlly frsEr Lirn inreAd irll'plicdionInsomc.omp'tfls,chmlddvanabks mdyloadedm esir1e6,herF'nLegervdablcse ftn maybebecause( n Asumcn|DL.rLculiron\qr hLrpkce nvolvinehe$ese^, wheicrshoseDvolvinscliru(fts re nhkeq creshoDldherforcbe ilen in decidinCherher vrirblc $ould be .hanckr o.

    FudhcmoE, i n well knosn Lhar ivide innddions Lv0'callvoi.e lonesLoerellrc rhan uhiply nsn.'ions Hence r nry bc bctr.ro mulLipLvv Li.rciplocd of, iumber hd ro divideby rhd ntrmbsr or cxmPk, r t 0 \'l lbe fsrer dli r2.0. Mmy conpilenw l nol do $is auron icalv

    :+''.d rgxin$kno$np tms rlrLyieldol trm'z on opponnities hef. opLimizftst exsy o mPLemenrid dlo* lnl muLLifleornnzrron

    9,5,53Conhon Subxp.AsonEltnination Repeded d.lhuoN odc sanc subexDE$ionn LBoditreknr equdions shouldbe anded

    ch Jp r t h m r d l m r n ( M i r . i . d d o r n x o i

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    20/34

    'hm ord'mry urctror. /,,irr./tnfl',nr arcsimplyma(os Rhffe rhe rulrund,oncaLLFepli.edb! 'n hne.Dde trnn-soDp'lrtronlrx mprovs ft31rft peformrDce becru\e rhe need Lopr$ pmmeles, ftde space ror lmal

    would be oFnnhd by fordins 2 0 3 4.0 hro 3 0PerrormLnghsoperrtron muuy lcads o odc LLM|s esi* o debbecaus hepmsmmner enoms heoptrm,zarionxplichry. id drtDueh Eongind lalenenr may be DoE descriprive,a comrrd cm be prcvid.d bfo ' " rmp- . ' f \ o .D ' -co rpuedd-g rh ri n : d l t r : onpnn noryou- !od lhc ro re i . r 'mexample.pi rv_2.Thhwillrypicltlyrve

    lloaring o'ntloadmdone floarFg oifl dividc n$ru.riod-poknridlly eEal ime cycle, hh cao cad o Lincloadi. a {ng .o f0 . . ! x a - o .o ,ns .h o -n rv . . Jn8 hh x#3) r c ! . ^ t . u J rsinveneFldionsh,p erseenme md memoryod,ne-you havcjus edemory Lo$oflhe prccompu@don$dl

    9.5.5.5Con{rnr ftrding Von comprrer fffonnconranl ordfs, bu

    9,5,5.6 doplnvrisn(Optimizarion Moycompile^lill ftovcced o bperromedwrhin rhe oop, pcdlled aap invaiont apitntzanan

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    21/34

    e - j i - l o n p I n d u i t u n t l i n i n d i " n \ ' r b l .i , d . n a , i ' . F - ' d ' i

    r: . tr rndanorhervlnable.r.h,.h is lid.m rrm'ionorj, n u\edLo lLsdnd. r.ny. ofL.n is used nLyol x renoflool Lcmii o'.we.rnse(ndbj ?plrc'n-qs k$ lor oF onr.

    9.5i.9 ReBov,l or Dead 0r linrca.hrble Code Oi. or Lie ersieinedods for decFAing mc'nory !.ode-dE r. ccde hdr aonever e t.chcd nrhenomd now_olcon@L uch

    9.s.s.3 se of Resisrersnd Ciches whcn p.ognmminsm r$embrvl$-qur-ge,r shenuslngangu{geshd srp|]on csF,e' ype tirblcs. srh rs c.n r usually dvlnheeou\ Lopedonn rlculalonsusins rc8isEs.TvpLcallvrsFreFLoEsisLdopeErons c lisEi Lhane-qfrLomsmory tresThus. fwnhin nodule rnd iI enoughe-qLne mrvdldbls, you should ry ro r.r.e rhe .ompilerinnruc ons.ordo rhi\ explicillywhenpms mmiie 'n asemb\ lmstris!lr rhepm.esdr t.hiEnure sWPpo$ible b f.(e rtuqu.rllyusedv&iablcs no Lhe {cbe d rho h'gho.d(bneuage r b$mbly hnem-seevd.Aldoughmon opum'z'i,g o'n0r.N rlcacbe mJblesuhm po$,hle,Lhe lruc or dt sou(e GYel od! rffefl\ Lhe

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    22/34

    code ichLbedebuc dem!nis hr tEdunda $ridizxron iniruc'ion\'

    The Ler o1thevmirble debus'consuned silnl.s oI sherrershould e implcmencdsig rhe

    dc erecuLednly f r debug las s ser,0rFor exmpk. .oisder $s followns c

    *ill Eke seve l ml.mseconds ne rhir sor nor you ft in debu-smddc. Debug code.ondiLrcnalompile rcilirirs vr'lrble sftnos lansuaseomprLe6.hus, shouldeplicc he pEvious iremenr i'h

    HeG. fde1is, onPitd dne ve rhar l n.ludsfie codebd!'cn nand'hrnd irend only rrhe symbolrcon$ailDEBIIC s dennedDsd co; remoql also in!ass proErm ElrabilirvGee ror *

    9.5,5,10low-ot-CoDr.olpiiniTaLionn novof contoloPrmitad@unnece$aryjunPo-junP bremens replrccdv a sinsleJumpatnd'fte follosingprudocod. illusnfl$ thesnudion

    Such ode s noL omruyCenenrdsoms ubmdic 3en.B s or rdsadonb, psgrmme., bu misntEsuX nprccs andes.p umoned

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    23/34

    9,55,11ConsrjntProprgrlion Ccnain aftble sxsiSnmenlbLemenklan be chargcd o rhcRbq - r.ing -s r ei d 01opponuniriesr rheuseolmmcJiirc odct.

    [qccdlFil l ircdb}xmmrfl|?h8onP'on'giL

    9.S.5,r2 ead-Storelin'nriionn a shonPEceof codecm be conbinedVtuiiblcs rlrarconn'n rhe sme valueinrod singie mpdry vanable

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    24/34

    9.5,s.I3 d-Vrr'$le Elininalion A vmrbler livear r poi in aF oenm r6 vrlue m be r$d ub$qu.nLly:lheN'r trs ,?da ndsu6jeclo

    while ftis exanpl.appeb Lobe dvidl. gai. L.ouldcodine ion atrLomatedode sncdrion rnrdrlion

    9.5,5.11hort.CircuilingoolenCudecompoundoolem xprc$ronsy re$ing rch $t cadoptinh 'he e$ingof

    IOl / o / q \ s l . c fon r ! .F ceqL .n ' i'nsde rhe 1f md dmpsour Ie finr FALSE ondnion. h4 js, n rauronrcally hon ircuir oolcanode.95,5.15Loop Unmlling Lmp unrolling uplics,eshbhent etin a looD n oder Lo edu.e fic number or lmp remrions md hen.e theovederd ffuftd. ln $e exogg.BEd c6e. me bop ii conpletely Fph.d by

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    25/34

    . r h eu . p o \ " h e r d o f r o o , e "

    9.s.s.r6 oop ,mmins Looptm,n,ns . roopurior sokch0iqueorco,nb,nrng*o {m,rr. roofvnLo ne hus du.ns oop verr,eady hc,orofr*o Fo.example.te follow'ngasrlcode

    9,55 I7 Cros Junp ElininarioD lr'he sm. code pF$s 'n mor rh&Thkelid'naEsanadd onalJumporcrosJrmp orexmple,Iherollo*'ng.ode

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    26/34

    9.5.6OtherOplimialion TechniqusA ihpling oforhcr D mrrLonconndflrlois ollows

    5

    ArinBcascricsorANDcondirionssoharrliecordidon'norl'kelyohili r r s ! . d f i . (Adxre .ORcond tuonsso iha rhcmos l rke l y ro ruccrsed fiAr .This cdmiq!! r cdllcd oolcatrlion.circuiring.)Arbg endes . a Labl.sohar heno$ kequeoLlysoughrvalu.se delid Lo s.ompmd (thh echniqueislu$avada'ionI3,above).Repldcchrcshold ss on monoronecontrnuouslyond{reastrBnoninsrc$idg)uncrions y Ess on hetrpr.mnss. rlrcEby voidingevdhdrion lrhc fufdion. (ForeraDrple,hy usc hccodc.

    Oprimic rhecommoi.usc.Thc os frcqucnrlyscd dhrholld also r2. Amdec a scri.sor IF $aemenn o rhar hemos likelyvalue

    Link rhe mo$ lre{tusmly used piocedu@sLogdhd b m*imizs LLrlocahLyfrefeEnce.Ghn only pplies n pigingor c&hsdsynems)Srde Jdd clemcnshd de uscd oncurenLly Ccrhd 'o ncrca* rb.locolnyor ftfercne: rsa'n, rh6 only rppl'es n paB'ngo! cactud

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    27/34

    3 S'orc roc.duEsDsequenceo harcallingnd alledprocedtr'$illheloded LogeLheiLo ncEde rhe ocriLyol rcfeEncei efln. h^ o0lyappliesn paging rc,chedsy$emtNore hd n mo$.a$s rhcse chniquesil l oprmizehe veEgerse. or he

    Alrhoughmany or rhe optrm'amn Lechni{tuesiven i. iht rexr cm beau'ornared.aiy co prlen perlonnon\ one opdDnz on p$s. overlmk'ngoppodu.ires tr' &e DoL cvealed nll alLer kN one pa$. Hence hrDdop'imizarior qnprcvide ddnionalrectrtroDme $v'n3s Tose rlreeltecLofmuliple'pss opLiLnjza'ion.onndef he oll ow'ng rample. hecode l-gmenr

    a r r r a r j r r ' x

    is mprcvedy oopJaNm'ns.loopcodeinLhis a$ rh. ri'ialzr on 'nvrnmtEmov md.eDovalofexrnneorsof alrt). he re$r'm' codeN

    Nex( oop'nsunoll'nsy'elds

    cM p , . syn e n P e d n m s l tA m | yn s l t o F i n l d h i

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    28/34

    cotr{ant oldns. rhc mPrcved odc 6

    Theoncinslcodeinvolvcdn'neaddronsandnnclbPlicdrionsum'rous lu-""".i"i r"'-"."", *o t".p "'e'heids rhe inprcved od ' rc{luics nlvsir^do 'o .. o- m rl \ rnJ nn ooo ovlherd

    I ' erJ,i i a, ". , -'pi. ** " + reDn ri op n aro1

    -ouro rv' bee ab'ro mrkesrh an mPsvcmem.

    9.5.4Speculativeieculion

    d 'n PiPclinecomp Edue(Reall

    Lr$dcrions fsfl ln fte cse oron involves n dleprccc$oropridrricixtr pddllelProct$bldck as ongas hee;Jckon 'ode rhd could bc nnning on okallowsdle timc md rcsPonseimes 0

    naxy s iocudedba.k as n PiPelineNbingl

    9.6 ANALYSIS F MEMORY EOUIREMENTSWirh memdry bsoming den*r md cheapc( meno'/ load'ng marvss*..-" r"* Jr " ..*". sritt, ire"tr"iem u$ is mPdtn i' maiv airboftesysemswlEre savmgsn space. o*er consw. dicus rhis norion wtrh respecL o dahnoueh he sum.nb irc spplicrbe o Jlreahime sJeems- - i,^i "i.r.. r '.. ". .m - udh o ':dcmer'G ro ttlre didi" " - , ^ i . ' ) . . * . o 'oam meno l l no RAM m' ' oh l , *':"* r.", tc i." mt, c;,o_]mlDPedoo' D\'LA ocrr'on rismillustares IYPE msmorymap.

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    29/34

    sunof L\s ndrv'du.l onoryThe oal memory.lord'ngs Lvp'callvhclordin-qor $e pmsmn.nrck, andRAM rcisU ) = M p P t + v R P x +M \ ' P s

    shere M/ tr Lheordl semory loading Mp r'tr. and Ms re rhcmenory_oad'i-sror rhe mpram.RAM. and$ack areA ftspccrivelv,ndPr ' fr, andPr arcoe'.m ds)-o ur' m-tD illordFd 'tc prcq ' RAM .no hr r%i . * " . * r r q " . . . bc rF 'ouL lo . r ' oqeq rd r f l ' 1 ' t .u t% tu ' vPdi\ arecrcdfl ftin 100r., hen hesv$em annolopemrEropenv

    Ra M ; . . d . " b d * " i a h d , r *

    Yoowill se how ro cslculrte MF Mr, md Mr shonlv.Memory-MaPped/O sndDMAMnory

    We dD norDdudc memo.y_d.pped/O.nd DMA memory 'k ffid'lo.dineeotrdion .12,snce h.v m fixed n hrd*ft Hoq'\er e' lrs" l*l; d'; -inim"- .'-uer or -emorv lo.srions ror rhe$ pu4cd Fidi roCfl $e job dones,c $m. mon for sowdr' Thx IFA nemoo ann'M id d'mtre dyianrc memorymas

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    30/34

    {h f l eM i , x 'heDemdr ' ' o ]dmgfo .LheroubonsNed m LhePregmms, fd I,

    cmfillv RoM vhidh.or; n\ rhc rlrrkblendtrdrngte onearDssrrun rM rfpli.aronrh cm henored n rhr arcx Hcmnicmory-

    mry he ortd i'i RAM i'NLeadf ROM tor'nftAe'l leLdnDgpeed ndmodLl'Fr '\ deG.m'ned sy$m dcsietrrLnc.herord,ngnor foi Lhrxm ^ ioL d.,e, kd triird,e rppLicliod ogrns hrvebeen.oDpreLedr dy ca\e, riememorr-oad,nsacrof atr e co puEd6

    whenM.n $e memoryodins or rLrRAM rrer,1,,s he unbrru$J in theRAMma md ?; is the obl rvr $le loorcnsn LlrAslin, iAe nlmb{s c rvtriL$lu ouFu mm Lhenrei

    prog'r'n i.r. L,! n rhe nunber olMhe Loul rrLabk tocarronsr rhe

    Tbe ftdrimc operrung yrem uys rhe iack fta lor comerrsavmganriauromaricanrbh Allhoughmorc hm onc rk.an be epLwthn rhr @_i rIcon!on]cnL 0 iE\" rrsconfu in:oily onE. ho5i4 oflhe a.k d my trftis dcp.idctrLon hc ysc'nt $a'c md Lhc iz.or rcconoxr5rved or dnyoF'ask. uppor rhecoden for any 6k rqtrires Do$." locdions or rc8ideKproemmcounc(au,om Mnablesmdsoon,andl,D!\Lhem:xiDumnumbaof rask\ hr c4 bon Lhe ck d sr Lime Yotr i.rc drk dc@mindion-ifn'c, inenncannolbekooqnor [email protected]

    4 - , i / - *Hence.Lie memory'loditre fdor can be compured

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    31/34

    \her,{r'r ir th! m.Nry lod'ng ld $e nr* ri$.usd in rhcnrlk aroa.nd I A Lhe okl Nrl.bl e

    (9 .16 )U{N Lhe mb( of Loririons

    MenoryManagementchemesThe d*.usnns in rhc rdl'n! s.ctroDL\oshonkr ! .onsid.ed In rheconlexrof rhc mcmory disttr$cd D chrpLe' 3 Fbrerample n a bank+,lirdrn-qchemeheft lour nbtLnrl ba'k\ m usd rhemaly{\ is rpplicd u ctrd, parrle ntmory bxnl.

    REDI.ICING EMOBY.LOADINGA\ mcnrloncdrcvroNy nemory.loldines e$ ot aproblem m n hr bc$ trheprr. buroccsFDrlly \y{em needso bc ds'gnedn shrch ie .viihblemainmcmo!_h nnrll 'n rclrrcn Lo hepogon nz.derclopedc rcdrcr nemoryordin-! oc lrcD r riDe*hen ftmory {i\ d rprumiu rid nn-ghr,olde rhsprincifle\of sonwm ensineerin,s.hu\ thllshouL'leu*d wrh c rion.

    MemoryloadLncm one arti !M br rtduccd ar Lheerpens ol Mo'he. Forexample,ll ruromaricri$l$ (vdahles hr arc ool l o pdedurct Increaserhe oadms n rhe ack irca olDemory, heE^ slobdv..!bles appe,i n LheRAM rea. By lorcingva ables o be enher o.al oi global. eliercrn bepurchasedn oneeea ofmemory fie expenre I rbeoLher.husbalmdnghe

    h addnioi. nrcnned,at erulr ilculationsh,, 8.e conPured xplicnl)Equnen anablc irhe n $e nackor rheRAM ,a. dePend'nsnwherhtrr aloraL r globrl The nLemedidc rluccatr e rorcedmroa re-listerricud byomirrirg lE nEmed,areilculation.o llu$me, considerhe ollowing !$rl

    c h P c r \ . n P . d o m u c A f u | l \ 5 d i d o g l m t r . i o n

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    32/34

    9.7.2Reuse arl.bleGlobrl varidblesrhar 3a usedonly once sy du ns rraramn_cm beEused Er lor orher ullo*s unlonumctx Lhc tuirhle!4ne\ns, De mermxhodins r sene.csincehcywi be ptry,nS dud rcle.An exanple f rhrmel\od h rhcse ol named oMMoN ovenays f FoRTMN. you qanalsouserhr mc'hodor oop.oumes id de seneric nnoru..burbe.mrut,o prevenr, pmces iom desnymg rhe onren6 l r vrBbt. when har rkbtc is rkobsinsusd by anorhe.

    9,7,3MshoryFEgmnlationMemory rEgmenbron (dis.trs$d in ChaprerB) does DlL rrlNr mcmoryloadme.u' ' crn producetrecb *m blingmenDry.ovenoad,ns.D,bhctue,alrboogbutricisnr emory ava'lablc.r ir nol comiguous.Axhough e di$u$ed conFc'ton chens m Chaoler md poi,ncd urLh lhey*eEDordosidblernealL'mesynems,heymaybc.e.esary,nsedourcdes oI vduol femory load'ns.

    9.7,4 SFModltyhg Cod.One nerhod Li,r can be used o savespa.e n de .ode arcaof memory albeiran eiEnely dlnscrcus md ricky one-is lhe s?t:,,/iti,s .d?. Thr DclhodExes dvanage of fte ld rhd lhe opcodes I cenain nsrucrionsmay dffer bJonlyonebt. For example, y nrpprs a b ir in a JUMP n$rudio., an ADD'nshcrion s ccrEd Allholgh$il rypeoI prcgmming nsuilty rises Eohcoiicidcn@,esends xh, abourpmslmnen who could rri,c $cn cmefronlesly. The moi 'mponm' disadvmrase r suchcoding s $a' n ursrcys ftpngEm\ derminisn. Th6 Lytcof proglmmmg r rlmo! neverdoncDday and

    NO|E 92 Mny incllde on{hip c@na har @obvi,@slf-froditlng cod. (rhccachedoesnor npdo'srhecodead .x@uras }.u.mod,n.d codc) or $e etrecr ot monityins cod. wirhin

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    33/34

    one @rromm.e drc3LhrL s cmnor ov4 ir sreardeprh ow'ng o derceoeoe ;d r . ' .de o fene p 'e e I t b \ d r \ i node t re odc" In mrnJq* . o,r ' O i. rhc -L.e CFr-{ .!' i b 'n' ro pro a, i e o's rdd' onMorcoveahenandyzing svsem\ p{lomance rhroushfrrucbon ountng,il is very dirficulr Lo ccounr or drsk delic! a.ce$ rim* ln no{ cse\ 'hc bdlppnrchis t rsune {d$.Ae acccs ns tordevi.cI/oandiDchdc'hcmiyour Frromsnce pEdicions liem Pmicipah in some om of anelwo*, sry . localmr nd*ork (LAN), oadngrhenerwo* can siouslvdedadcmlrime Fdommcc srd mdc measuementl tharperfomm.ei4o$ible. tn mosi dsi wc med to a$6s rhe Peilomince ot fie sviemNrlninc rbd fte nerwo* s ii Lhe enposibl. $ale(i e ba troofter uses)'Thc. nex\uremcns of psfonihce cr bc Eken under v.rving condrions orl@ding,md , perromin.c cuee can begeneraledEXERCISES

    byrdk e r (vnh cqq !*,rch ,ior isnoEdlrr) DBw u qau otr doe re In $ rysbn6) whd tr de $i.m un'hdhc (cru uiidLbo) I&b/

    c f u p 0 . \ ' L . n f u t r o D I ( \ n J ] ) ! 5 I i o 9 ' m P d o n

  • 8/9/2019 Real Time System 06 Philip A Lapalante 2nd Edition

    34/34