0% found this document useful (0 votes)
7 views

DocScanner 23-Jun-2023 9-16 pm

The document discusses memory management strategies, including dynamic storage allocation techniques and the organization of memory in programming. It covers concepts such as stack and heap allocation, parameter passing methods, and the structure of symbol tables. Additionally, it highlights the importance of efficient memory allocation to optimize program performance.

Uploaded by

Sasi Balaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
7 views

DocScanner 23-Jun-2023 9-16 pm

The document discusses memory management strategies, including dynamic storage allocation techniques and the organization of memory in programming. It covers concepts such as stack and heap allocation, parameter passing methods, and the structure of symbol tables. Additionally, it highlights the importance of efficient memory allocation to optimize program performance.

Uploaded by

Sasi Balaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 19
ERI tntretvction Ha ob a RS eet) te ee mt = ee i zanization ot Memory issues We willl disc WP this Be eames sone zone tanga rs tania Sas oe Catton strategies HHIE NA 4 Ie adopt, Pee te tee agave md management A wie a Cm Tener wt a Capea deci Te A ees alow recursion ? + Does the source NENA oe calle there may Ye SET instanaas Wie taning the coy. Memory allocation mane he Sey sore cosh instance with Hs TE Geof active instances is determined by nt ® one ala Me ep rn Stine pee etc Bea separ nara ey Tonnes, Bat 3 anguage should na vm Hs aes hao sprees 2 Does. the ange teem : sro pt fit he sve ne a om 8 He ed EEE storage Organization ‘The camper demunss for 9 Wok of memory to operating system. The an Mee ronmng (xeuting) the som pean A Cipro the memory allocation and deta nt destoation of memory brings the ellstive ti ‘isk et mesmo ei a te tors oy ORE Side tw houy re erated Large cou cou thes ms ts obits oy ton SHI Keeps tack op ifm BewErALE Code Ie i 7 oie the stay ae HE he vast ory. COMPILE placer ees eg othe ad of the memory cede a sects so can be plced at yond MSE ‘afoa of the memory. Comps ial fhe data objects ig ne Peles : f then re ee ae TE oe i gt aes Procedure ac ae eae c a the dat eben eae foe once the attic dant eae sate The suNiesion of yum ne se ve own by following figure, een Tor teat SOS BE is ad gang ‘onaging of active procedures means that whe ake IE Are pra Zrsation interrupted and information about ese SS Hen Seton ck. Whe the Control retams fom thecal a aE 288k anon se wen cel on many ie storage. Some data objects which re eee, UNE the ik rea of man «ie Ho a8 th af ie rh ear She Tor sxe mony for some dre — yr for the a ison er pron Stam te ate stator ssa a ae the size of stack and ea At fe it mayo ese nechngaly ting the peogeanh exec tyson Cee ther He sh pre 8 nn sete cme a ‘te — ce location Stratogles ao st ck . FER storage Altocat IAC Tee bol Ae aeteon Yee een na A we acetone ae yg M , Op satiate tee ae stored in the each aetna ain, he fsck area Hea ort 1h ang At¥ 09 rer on a Pn ye elon a ae rage lection SSIS BC this gy ctr 628 Bera yen Stra "SE hea ve a hs iene sion og “ae \ynamicaly fe * ben io ec, atcation is fr alt he data objects at ry | IT og stack allocation 90k sca 1 sate alain «The wa tion a bck is usc to manage pe tt AFD £2 be ne ESI Iatlon =n he crore ime amet sor an Eg — ‘allocation the heap is used to : sates, Ie reper tap mon <1 Me Mor mag eg "ap Aloeaton Howe a at of theese deta | Te 2 lve mn : : ee Se a nn een Ye ee DEE si ntcston ae 2 MS nin any ee Ot ne fe ae a The sg of daa ot aly ad chan allocation of aang ES rap altocatlon alla the continu bong twa Ti nee tS owebeten nM MM tvation recomds o olarak & mene eee th the amount of storage allocated ¥ seam when acta end. Thr deaf Hated meget wth the 0 m0 hang gg | and oP HES albu ice space vara? an Se ce ee act oe ya ome ty fess te ee la vs Sad Sea, Mad ooeee ser ean fl the addressos at which thy t Groot the most suitable block of metery ae a. nyo ccm ny |” Ae et fa” ees ao faces, Laopeal _ Racor heap management on be done by when any Aetna tag MY "ONY FOO the Hike tt ewe ent ny oo) » Suc allocation aoa —— + GASES Ra seca ete stm wine sc alloaton can be done ony the size of data objects Known a known 3 cope 2: The dat srwcturs can not be ered dynamically. the sense that, he se rd eae | nga tite Way soe os 8 BON pe tivatlon of main a Program, SHEN B&CURE Helo the ge ee spi del ck bs etna ge 8 oy, nds slack based al spc how 4 alocstin. Wege Y wg i - EF yt te alton tee spe pi ge largest mimibor of acne ers A eh scr it? ager action 65: on of sor roc - soe ‘Ase (20) ws Becunray 0 Tp monde te © otagers in ’ © ari) ae Tie feels c (Perit the array Aro. wea ‘herman Ap ey ap ” 2a quiokvor® (nt mint 2) fost sc ‘ sn i iea>e ‘ = portion (mu ‘uicksor (4 1, , > © seadanay 0: sors 299, uncon 2: UN tL a Mies eto 08 actuat r ncaa Woon tay Tins mete Mbit tone Atos BOTA STAC Hy * Pate et Ae ante alan Nay N joan OME He apy! Prag, NM wnat mi {sallat WA the FH LN, ne Hae SAW tho ata lg ecss dara Tee aah ot ee ean TaN ta ay a _ SHOOT EY panty ss a as cal eA TGOL we lB tame tha SM De a any ss totaal consi the (osstto900 [A Rha en dnt TE} Paramotor Passing lw He OF hg Tet seston thse parameters he re ane various PARAM. PUI methad, and thei realier are POE 8 cy The test parameters ate va evens on formal parameten do not stages the Yale of ay Coe ane geal pamelor passing metho by a an me ilo val Sem ‘Gon vonere Cally wag aa Bay tee 1 pant 0 2 Py ewiy tea tema ites at tho dt 0 eae = U8 we tfah = (hy pl a dee AN, m0), a Pet tt ae pent HAN, 1 DI, ray “ a iy sty wr ee ent of fli san, he da ' ie ae ee a 2a nt ot a Save i z Soa ear etd ats Ob ANT) WH sulted ad EREDNEED vie eu of the fli © pv ili a mae : Taras de function body Of x os 10 ay ofr sent ec eerie 1 Cal by ee. ib Cal by eters ado) Call by na yeuey ey = retuial Ree (At ye set pam ee oe we suede ME mig gy | ea td oy St ntti nt seane [OE Me eae tea Seen a i aou | wats Toran : ° ee ae Hey ms, so canny meen woh Rtn Stes ene te serie ee PU oft, var the Pei pints Ho) rig ie Ibe snd ipa wil Be “hen cone ot 10a 10) sce y = and ll] remains 36 iis be. ae er gn ee RE “Hence ost wil Be Cee a achanmcon symbol He ste ee Bee ek of sy hoa att Pa Beet ae eae ot ui ca oy ste eat . eet mit oo oe pe aunt parame appicd by the alr 1 cop is ble 8 wed by various pane tran by se iat ny | ows te nde formal pacinetr Se re able for Ope confi St cat pames then formal rameter cpaicg, fee 7 ON ca ain ys tae esteem cite ol dtp | aqyow oh an a ya somes Sra oe ae aetna Fe seman a of copied fl 1] = 2. Th fl] em Te nie ts (bia ad I TT tr ce ae ae “ ee — ae _ 2 . lerted by pointer to gy ~~ TERE gymboi-tanie Entrios =. eon bo te oe oe 2 RRR sean coms males femelle we pe FREES SOE ey, +The tems tobe store in symbol fo table are 0 Vanatte names ee pte stored WH el of sng Rn 1) Procedure names fe) Faction name ©) Liters constants and strings 1) Compiler generated temporasics Si) Labels in source languages + Compe uss ftowing =f norman from symbol ible Dat pe 4) Name $8) Declaring procedures ©) Otfut in storage 1) if structure or record then pointer to structure tbe vi) For parameter, whether parameter pasting is by value oF reference? vil) Number and type of arguments pasted to the function ees asm ee Teton of Setier and elaed xermaton = mals i) Base adress 1 cng of ee eT erly wd dl SUC fr sya ean How to Store Names in Symbol Table ? ee er ‘arutre for symbol table st nt san en eta ad 0 “There are to types of name representation hye as given Below 1. Fheactengths name si se peed apo or each same s allocated in ayia ble. In IS Ope of tgs y | oN ed an aT SSE Do sma then tere i wastage of space. om ret it For example oe aed se an be add in te oer re [es EE arouse Miguee 7 Pearse atom svaiabe’ is mune! a le Se 1 Be Fone stored records. The =p aaa wna Soe tt dave sure HE Fig. 7.3 Heshng to sync oe so freon stool! rl i de ea n fon should be th at ae wi be ne SSE =a. : 1 pet ene Sathtos whee bod ny See ce Dr NEES cummin ome ite tne cas =a tome oe a eee ee PR we | SEMEN seco tie pati canny ° 1 ees Mage of RihiNg & quick watch ponds eae sett aid topics Se oa any Ee Sb ve aca = rete is super fo Lnt ngsrucason 7 eae SimiSeee te te ow og | gE cc et | pee — Eon aprow or compass sk sin IEEE of plement fb Ne do ei a ei oun to ays ble + To getemine heen aru any ttnger between © 10 kot: We can Suc ay pesos = Nee) ees ne nus pon we can obtain the eat Hsatons of ame in sBO le = — Ee SST ae | GM el MN ne Pie mull you ap mae ues ttl ‘my IGEY dynamic Storage Allocation Techniques “There are fw fevnignes used in dynamite my remory allocation an Epis allocation = 2 tmp atloaton ele mines ulate el anion Mone wih oe ee a ey ee wt Seng nm He eupport pockoges te ty cp KEE cxptici an ‘The expt cation location can be dome for fied sie an warble sre bck [EERE epic locaton for Fed Sze Blocks This 1 the simplest technique of esplet alloaton 1 WHEN the sine for which memory i allocated is fs tn this technique a fre Tist is se, Free He 19 Set OF F66 Mocks Rheemset whee we want to allocate memory I some memory be dees Hk the free Int ets append el he, The block are nha (0 each other In ast strvture. The memory alos Fae ere oe tng previa ne tothe nese allocated blocks San eine dome by de referencing the previ Hk ory is elle Available he ag ion an allocation ner 4¢ The printer which points to first block of mem Dus memory alloation and dellocation & dane using heap memory J The eal location consists of taking @ black off the Ts ond deutoaty hats of putting the block bck om the Uist r vere adeatage of ths technique that there #0 space everest aris re eT PE 9 FOREN! Hg ntsiand Sm fo | rp memory Hy sg 0H 2M Bloch emt fo eed ttf eth Nh gn et eal he 8 Hs ng i "sey vi hon peg et allocation mets fe 1 ad untine plage, ero re ine PSCKOEE I EGE by Joy a rags Boek 1s 6t e " Tot pn se a 1 ed, Read pe od hn vee approach Le rar eben conf se ly a ides eta Hn inh wo see me a ee mat increments by he, That ako aan fe wee co a sy cri 8 Ce pag Tak ay nt NFORTRAN, he aay So poral Sv dp eon f0.0 the ha BSS Bek not yy BI Spal COMMON Block ang ta eA ng ZR eT cn: Recta eet engage | fea and tna hy, : TESS greene toring 8 : - zy staking tchnigoct = This Ian alemative appro to deter ion fF gat ble conan ent fe, are acd Sin ane oF met In this met, a user program ag TNS ets 10 absolute adie 2 ae rN crosman eg taps are used to mark the blocks a, Semtie peel esos Tares denotes the sta tae cpu me Blocks which are in uses me nef Si naarea dePOH He ating ag, sey recat | Foetal goa jae Bot Be oti a ea ag Se ge Ne, Ai hs Ths ale nde he Becks whch ae nme cueh| ABN we Ura fF on Bosh Oe foreach gy pene is males te ge Me Fee sepa omy on wt 2 PE tk arg ny nese pointers are then placed nthe heap) memer Remar and mink those Blacks which ate use Thos wing marking tchwigue i 6 posible to keep tack of th ing marking techni NEP HC Fe Hck eS ..,rrr~—~— site sen op mg a et iy 1. Expl about impli and explicit stnage request ey fC SOMMON block. 1 ee OPES seen _ Pet a Pt a ea, Tie The ena mrss am val fon eu ANC® Ope ney er Ty scanning the Tit of names prec SP fr xy ee dar CON ag etd BY 1 2 conte eon for 3 Conon a, me eng EET dynamic Storage Allocation in Fortran 4 The storage allocation in FOTRAN ie rcatvely simple beens ay 1 Sa isa Follows ~ compile time, Hence, FORTRAN ses | "hE OR MON My Blodd ay ‘ye ei handle this eerton tg re for 8 2k nase MyBlk vt re one adr ot be eg ay ale nes fo he it ts any FO OMB sag sequitements are known explicitly programming language that makes use of simple static storage alae rehly by sae tha these dats otc rin Cosmo en sale But there are some commands in Fortran that are handled co compiler, + Two such commands are - COMMON and EQUIVALENCE. Let ut sdesang = parameter list tthe subroutine calls. But passing such 3° long list of panne vest if this not the Bist declaration of Myla eee ee Soon equivalence operation Spt shang weap ie not # conteniont approach. Hence In such cases one can tse 3 common hint lables should be shared amg pena memory map for ch COMMON back is cvnd This Is actually: a way (© specify that certain vs certin subroutines. ‘There are 60 types of COMMON blocks; blank an named. A program muy contain only one blank COMMON block but any number of named COMMON blocks. pe ent Sree SESS en ee eee a Se ner ern pea SE a a Se a a Te Soc mail SNS pene eaters net nate + et en of eo ar wi png aN SEE er Sn Se a ee ae mantener ma at ete pore the ahi or te cane cas Tas es weet Seema eanetof te + eA ee eee Gr gemceton Pe soul pacts ee SOS ES os ee coo comping Pe NE FTA == concept of Code Generation Ace we wns the a pie he pee tg ATES igar ant eres tne macnn 3 Spay SSE SP manag a Pa, Sse hes aoe Thee “sy ee Fig, £24 Potion of code goer Income ED object code Form The oni of cue mation fa bet cM OF Muchine Si. This cl rom Abit : S83. Ovi cads tome ee aN athe eRe REST a Se meray ahs Seca — MTRIV and PLIC prooce abscluae See ae lac 2 Assembler code = Prcng an anny ngage alee pros ef cre yeneation sane cise he eee se frat or the mart fates a see the ma isc the aie hap pe oe Jorg anerbler sale an sur mike one Sea mee {toca aseming ig a ose ie ect ot te soccer pte tek of capper cares 2 oS Se nim oe mee oc exh OPE of thee adres ode he cae dialean an Se prpumnd wi genatlly tet the raw code Se rapes eae por cumple atch then the cate anure fu on be peated as MOV ARD/" els Seam ese aoe ADOERD /* perfor he aunen ofb w D/ MOV RDS /* ses the conser of pte A "7 an oot se ee ae eee ees eee ree See eed yl soe and ie emi pt ce ee te Sr sister operends then 8h we becom, aration comsine Ee memory. Hence while gore sho, ol Marna oN pportan! OE There are ere at eg fo eatin of Peng at nee ag eter llsaon, tect apprpring ge “ge ain os Cee ne pm mns aaty ner pote 2th 98 €VEN Odd number gitar Pee 2 ie Bien re ere tec adres COE aan 7 2 eee | fant suation order enn gn go a pitate ratte shay mc pene Fe pen et al pe eg co Wt wotgpcach coe Beatin various algothns forgonatng a Sant 7 an by sawing the onder In whith the tre adage or desing the BOOM code gene neces t hive ‘ed for ths tage a MPS Por knowing of + Ther stem pel pupoe es RR 89 aia ‘where oP i an opcode an sore and desinaen a ace nae [MOV ~ Moves fom source desinaton [ADD - Add sous to deste ‘hate ard etn tidy mend ery ins Pata wn sa seem ene meets ten a poco SHE ARNINE Ne ty, een bee

You might also like