Os Material Part 4

You might also like

Download as pdf
Download as pdf
You are on page 1of 45
unit - ag? Menoy managenant ara vituol wana, Memory ¥ dk important port of dha Computer dhat (s weet bo storie dhe data. Sh manage ment Vs critical bo dhe computer System becawe dhe amount oP main memory availoble ma Computer system y's very Umitecl, The ole of momoty management 1s, & memory menaget 18 weal to keep hack of dle status of memory Location whethwy tis Fee ot allocated. ® memory manager permits computers evith dhe small amount | oP main MeMOLY bo execute Programs longer dhaw> dhe Site eP available mamery. * They con be moving tnfrmation’ back ena forth bekween primary mamory endl Secondony, memory, by uring dhe conept of swapping, % memory manage should enable Shaving of memory Spaw bekween protsses. * The memory manager 18 yesporsible Ry probeding dhs. Momory alllocatecl to enth Prowss from being Comupted by another Prowss. Base vegisters:- specifies dhe smallest Legal Physical memory address, Ute registers: Speufia dhe sin of dhe ‘ange. iegical_auldhess spa: “We pai of base ‘egisber ane Lins Yagistens specifies he Ugical addiess Spas. af base Yegister hold 300040 anol Limit Yegisber {8 180900, dhen chs pregram can legally auess all | | aoleliesses fom 300040 Arrough 4 20940 - | os 25600 3o00 #0 | <— base KIO Unt (1aoro ) Process gg000 Rddess _ Binebing :- Tre association of Program Instruction and data to dhe actual physica) momory Locations 1s called Address Binding. Roth Logical anel Physical addresses are used in computor memory pddtess loincling —ehiutotedl tno 3 types. © oompile time a@dcliess brncling ® Lad time adkdyess binching ®© Execution time adbolvess bindling . |eompile Simei * IP dhe compiler \s_sesponsible fox performing addyess binding dhen i 1s callecl compile. time addyess binding. * O} will done before Loading dhe Program into manny. Leont_Nimwts dF Wis not lenown at compile time hare dhe process Es reside in mamory dhon che Compiler must genovate dhe. Aelocatuble code, In dha case Frat bineling is celayed until loac time. JP dhe starting @ldlvess changes we need only yeloacl dhe user code bo inuporate dha changeol value. 5e cho binding cen at dhe tim OP execution dhon (t Vs catllel a2 dynamic bincLing. # The program will bepb en changing dhe Locations in memory until dhe time of program emecations. 4% dt will be postponed even after loading dha | | program tn memory. wompiley 01 Assernblet t compile tive, (ober ottwr object Untoge cetilor > noah ee scant oe, =, are options o ‘IF. | Untage Glitor | a a Load Hime | Lo System aul ) Pee NN nam'e {n memory pinaty _Lmomoy: \ execution Hime o1 im ; : sun Hire. gical Vetsus Physical dclress spa relocation Memory Logical [ed 3hb mmu | Fig lynamie yetocation wang relocation yegister \ ne conupt of Lagical adatiess Spa dtod is pare ba Separate Physteal eddess spate in central to [Proper Memory Monegement. {egrcal_ouldess | & The aaldtiess gensveted by dha cro of computes system. & Ot 1s othrwise calleel as virtua) adchess. | » The Logical addless of dhs Program 1's Fann. Gprsreled | when dha program 8 running. Logi cat @oldliess SPAR | 88 group of several Logical auldtess 1s yeered to | OS Logical adklress spa. | * The Logical aodiess 's \basically used as a reRrence | to auess dhe physical mamoy, locations. Physical address » Tw addhess san by dhe momoy unit. & The Physical adcliess 13 @uesseol dough he. tones poneling Logical addiess because @ wer cannot directly auesieal the physical edeless. Ri Tuming a computer Program 14 many neues @ physical mamoxy spau. 60 dhol dha Logical address has to be mappec with dhe physical adldyess bere dhe ‘execution of dha Progam. humoty management Uwe Coumu> : 3h ts @ hondevare devia chat tops dha legieal address bo physical addyess. The valux cn dhe mmv yelocation Negisber ts able bo every Lagieal @aleliess genaraiteal by che chu to be mapped into @ physical memory adldiess . eg: IP dhe base te at theo, dhon an altempt by dhe wet bo addes Lotatioo © & dynamically +elocated bo ication 1000, an atte to Loation 34b i's mappect bo Lxation (ya. The User program never sees ho yeal physical ‘ada 2 The pregram can creake 0 printer to location ax ‘Stove iy ty momery, manipulate ib anol compare witty dhe thn addiesses all as tho number 46. only when i}1's wed Qs a wemory agdress U's it teloeabed yelative to daa base re The we Pregrany eleaL anvtto dhe Lgical adchesses, ® A process mui be in wwmoiy bo be executed. A proves hewever can be wappecl bemporarily out of ty bo a backing store anol dhon brought bare Into memory Ri eontinued execution. | Q stanclanel swappg= & Slanelorel swopping Envolves Moving prounes between main memory andl barking store. % Tre backing store Is dommonly a st disk. * a mut be Umge enough bo ationmocabe copia of all memory Images fox all wets and rt muwt provide cures ater to dhase memoyy images. a The system mainba'ns © steady guoue consisting of all prowses whose momey images are on dhe bauaing store 61 In memory ancl ere realy bo wn. | | operating | Systero sl oub oer | easren Pr] | Py | {@-sunp en | a Backing store men memory a when even dhe crv sehoduler decode bo execute a prowess, it calls dhe dispatch. patches chatks to see wdhiotnon dhe nuod prowess = Te ds; in dha gueus 16 In wemoty & of fa ts not and iP dhote v9 Wo Free mnomny reagon, dha cLispatchor swaps our a process currently Cr mromoty anal swap in de clesived prows. a ot dhen reloads registers ard bians1s contol to dha seleckect process. Suppose dhe highs Pulority process emives land wants serie dhe moMOTY manoger can swap out dhe Lower priority prowss an dhen Load anol enecube dhs higher [priority prowess. whoo sho hughes Jmority prow Finishes , chon Gre = Lowen pnority Process coun be swappecl batk in anol tontinued. “The varian’ of swapping 18 Somolimes calles 94 dhe yollin Yllout , Normally € prowss dhat 1s swapped out will be swepres trace into dhe samo memory spaw it occupiee previously. ma is cn dhe method of dhe address binching. major part oP the swap mw 1s dhe bransfér time. The total hans tina is ebieaty Propotionad to dhe amount oF memory swappedl. | The tonkext switeo hime cn sath a ‘sunapping System is fersuy hugh - To get an telea oP dhe tot us aun dhat dre Wor prowess conkext sustch Hime. , stove 1's the standard sre and dhe bactung ‘Ss tome in Nord chish with he tank tate oP some per second. from are attual hamfer of dhe wms prow bo oF main memory takes pod per second = + second 4o me = 450 milliseconds. af we want bo suep a proms we ust be gene chat 7 ts completely dle. 9 process may be wailing, fy an tnput output operation, when we wank to sup A bo fice its memory. © swapping 0 _mobile systemsi= a mobile dovias generally we Flash memory. * Js @ sem conduttot stoiage avi. a spaw Coubaint is ere oP Sno yeason why moble eperating system elesignors avoid swapping * Othe teason is dhe poot Shrough pus between main mmnoty and Flosb memory in dhe clive. 2 Pndvoid doe nok Support suspping eanuepts, « prdborl berminate dhe prowss thsuPRuent a mao ts @veulable. » Refre benminaling a porowss andiotel wer ibs Application state to Flash memory. * — Prolrovol Supporting paging So thay elo have memory management lees a © Contiquow Memory _ fillocation:- [Cor Oe Te malin emoyy must euommodate both dhe loperating system ancl dha venous wer promsses. Tha mamory 1S generally elivicled cate 4w0 partitions. © Resident eparating system) —> tow memory | ® vse prowssar — hugh yRaMoyy. ¥ Te ihterpb ‘Vectors is @ften in low memory and Me programms usually pla dha operating system in low memory only. On dhe tontiguews menory allocation each Process (Ss eonbained th a single section of momety dhat is Contiguers bo die Section containing ghe naxt protess. | @ memory probection:< irate | register | Logica | | cpu ]--Baehess | | | The major ‘sua of mamoyy probecttona ate, | © protecting dha operating System Fforn ether uses prowsses, ® protecting uset prowsses from one anothon, » Te memmy — protection can bbe achieded by uring & Yelveation Tegiste! with a Umit register. a The ‘telotation ‘egisber Contains dhe value of smallest Physieal addiess. The Lint register uniains dhe range of Uagico) adghess. with Yelocation and Lint vegisters eath Lgical addyess Mus be less chan dhe Umit Yegisber The Lins anol yeloeation contents are aailedt 3} wil friochuws dhe physteal edess. Every addliess genmrateal by tha chy is chackedl gaint dte Lint eno relocation ‘register. By cud operating system and prom can be. frotected. » memory alloration:- eattion’- wr y Te simplest ‘nsthoel for along momory 1's to chide Nummy ‘unto several Fre Sh ,, Retin. & Gath partition Wey contain exactly ore prowess, & Sn chi muttiple pentition methods , whan @ pantition v's Fee, a prowss is selected orn dha Input quaun andl is loaded unto die Fee pasion. s whoo ghe prows berminabes, dhe Patton becomes available for anathan proces. & Sn dhe Venjable __potition, scheme the operating syptem Keeps dhe table rabicating ushich parts oP mamoy are available andl which ane occupied. AL Memoyy 9 available for wes Prowssea and 19 Lon sidered) ore Longe blot oF anallable tommy Ys cates! ule. x x when @ process Gmives anc noools mMamory we search fy a bole Longe enough Ry dh prowss. * wher dha partion i's free, @ prowss to selecbeol form dhe Cnpub quevs and b Loaded ilo ee partitions. when dhe prowss berminates ho pentition becomes Available fi anotor prowss. fA sek Of holes of variow size 1s scabered Smoughout Memory. when @ prowss niods memory @ hole dhat is lege enough fer dhat [rots eill be assigned. Br allocating gha mamny dhe following dtnee algorithms con be wed, | © First Roe Pllocabe dhe First hole dhat ss big, enough. Searching con slat erthes at dhe beginning oP dhe seb of holes ot at dhe lotion, whore dhe previow Fisk Fre Seavdb ended. we can stop searching as soon as we Rind a Free hole chat 1s lage enough. | @ Beat Bee | Nplate cle smallest Hele dhat 18 big enough: toe mus | Seoyelo dhe entive Usb, unless cho Uist 1s erderech by Sire. Trad procluces dhe smallest lePlover hole. Q worst Re Allocaje dhe Longest hole, Again we mut search entire Ust, Unless Vis sorbed by 9i2¢- Thi produces dha Longest lePiover hole which muy be more useful ghan dhe smaller tePtover hele Flom best Fit approach. © Fieggentations. | @antoral_ Fregnantation:= IP dho mamory 1s allowtecl to dhe pro 1s Longer dha vis Yequat, dhe portion eP dha momory will be wasted. ul pot being wedl is lnown 2 dhe | Wiken nail Fagan tation. © sternal _Figguantaion:- 4 AS yrowsses Gye Loavleel ancl removeck Pom Momory dha Fee mummy spate is broken into litle pieces. & when enough jotal wemey is available to satisfy a qusst, but A is nol contiguous 1s. calleel a ho exter na) Fagmentation. & Thete is Q Solution to dhe external Fragman tation is called as compaction. * compaction 33 dha provess of combining all Ree mann Yn ene Longe blocks. 2 * Compaction Is possible only IP yelocaton is olynami, and \s done ed dhe emecuhon tim . SS ess Paging \o dhe memory manogemant Schema dhol bent physreatl addyess span of din prowss to non- ontiguous. paging avoids extemal Fiegmantation anal dhe reed fy wompaction. Bi also sowes dha emsiderable problem of Riving amo chunks OP venying sites onto dha backing store. (aste_rvathede | x Brealeing dhe physical memory tnto Prneol sire exe calle as Fees. & Breaking dhe Lagicall momoty —tnto blocks of sama | sire aye callledl as Pages. | when process Is to be entecuteel, rts pga are loaded into any available momory flame From hair sourt. The backing store 1s Glividest into Rxcol sized Ibloelss hab axe dhe same siz as dho memory Bemos. ical te phystcal ‘es sre IF pu foLPja €la Fwy eee MD Yrysveal memory Every address genavatecl by dha crv y's divicled + {nto ywo parts. | & page number Ce) * page offset Cel> : : | The page number vs wel ar an Under cro a |Page tbe- The page tabla eonlains dhe base address of eat Poge tx physical mumey- This ase address is combinad wills dhe page efHieb to dehim dhe physical ymamny address dhot is Sent to dhe memory UW. The paging medel of mamoy 1s pogeo i‘ 2 pagel ala page: 0 \ 3a page 2 : 2 3 poge ve | pegee | 3 Lagical mnomory poge 4 s ry ‘ page 3 a Prysteal Rone mamneny umber A Tw page size is doFnoct by dhe honelware. ¥ The sie ef dha page is powei of 2, varying between sia bytes to 1uB yer page Aapending on dha Computer anchitedure. & The Selection OF cho power of @ a a page size makes de banslation ef a Legian addyess cho @ page number axel page offset. (Percovore suppers ¥ The hendware \mplementation of dhe Page table can be done tr Several wotys. ¥ The simplat wey ss te dhe page table io \mpomonted asa Set oP dleclicateol registers. * The cpu dispatcher Yeloadls dhose registers, jt ar Neloaals dhe othr Tegisters. . * The page table tbave Yegisker CpTeR) ean be wed to point dhe Longe sire page buble. (8 Tho me needled bo auess Q& wer momeyy louattion i's very \ugh unit page buble base tegisters. The transaction Loola-asicle Buffel, (TLE) evercomes all dhose problems. Gach ently én dhe Tee consis > bay oy tag Gia valus when a Lagieal eddies 1s Grevated ky dhe cry vb page yuumber 1s Presentecl to dhe TLS. QP de page number vs Fund Jhon y's Called 64 418 hits and \s Fame number is immcbiately avaitable and ts Weel bo GuoH monory. AP dhe page number is nok Lo Sho maemey Tue theo it Vs collect as TUB mss q@ memory reRrene to dhe page buble mut be made, IP de TUB is ebeady fan oP enhies an entity enby must be selectech fy -yerhacomont. a Replauement polis Yarye From Leaut recently wed be dhrough Youn robin bo random. X The Peneentage of dima ghet a particular page numer 1's found tn de Tes Ys called Wit ratio. eRRetive auos H 7 a Fchive in ° ™} = Px hibmanory time + Ct-p) » nus mem E t Tima. whol wi be dw eet IP Wt yatio i's 707, tim By tes Vs ons anol alien to Moun memory 1s gons 7, Soln:- p=n07 p> ha rato. =70 eas" wo = OFS Ut mamoyy time = 3ons+ dons = laons TUSs memory fime = 30ns+4ons+Gons = alons GAT = Pxbit + U-P) miss = 0-1 xXt¥040-3% 910 5 e = Bxo+b3 = [4ans Protection: a The protection ait catn defn a page bo be yead only, Yeaol.write, of escecube enly probechon. & ene more bit Is aotlecl bo each entry th the page table to Improve dhe protection. a The bit can be valid ov nual. OP dha bit ts set to ‘valid’ dhui valua erobicates ¢hod dha @sociated page is in dha provess Lagical address epaue. a IP dhe bit is set to be ‘nwalid’ dhe value Crobicckes Thor de page & not En dhe prows Logical adohen spac. *® Pdolvesses tn pages 6.2.3.4, are mapped normally dough de page table. » Page dpble o ef 2] vy \ \[ 3 v {Page © aloe v 3} Page 1 ai5 v 4 [ pope coe v S| sig [wv & tho ‘ Tp page S| ey 3 lege : [page s | eens y Kyaiow'4 1 Yoasripet 2 eRe] Most oP dhe table would be unwed bab Would Lake up valuable memory spa. Soma sustemm provide heretwere in dhe Rim oP a page table \ergih eqistes (PTR) jSheveel__ pagee= w Advantage CF pagins 8 dhe possibiliy oP shaving common code. ¥ Cpnsicler dhe system dhat support 40 wets, each of whom executes dhe bent _edbitor. x af dhe bexb ecbior consists of Iso 6B of coder and soke of clota saw . » we nee B000lee fo support Ho Users. » OP dha code ts seentank ov pure code Lmeans Non self mocb fying code. 3+ never change eluring dhe execution) crwan: dhat can be shoved. | eal 3 io | ede H : | data ecls [eo ed | datas 1 ea Sy edi [3 | [eater } page toble P. 7 4 eae | process pr eas f s Astor Lu eds |b ; Ledt_] 3 Jab Pe lata | 7 | "7 Process po is >| ey i | (datas pogerable FF, ee | poms Ps : | Two 61 more prowsses con execute dhe [same cock @b dhe sano time: each prowess hos tb own rs ef Yegisters ancl data storage +o held dhe data fy process executon- _ oF dhe__ page _terble:- /QWeercicnl paging: % Usmputer system Suppers a Longe legical etddhess spam CP tp ott), » fe exemple — consicler dhe system anth az bit lagreat edlhiess Spau- OP dhe page si tn such syste 15 41ke than dhs page lable may contains upto | million entries. | & IP dw sie ts bo Vugh we would nob want to allocate | dhe page bale Contigueusly oo main memory. | * ene simple Solution to air problem i's, to chiviele dha page table into smaller pieces. x ene wey is to We & two level paging algorithm, ty which dhe page table itself is also paged. cg consider dhe system unith 32 byt Lagieal adaliess space land dhe page sire of Ake. 8 lagical adleliess 1S divieledl into @ page raumber epnsisting oP go bits and dhe poge offseb consisting of 1a bits. {a Tela Logica adtess ® ree = [__|ha Cuter page ble Page oF lable Yn dhe above example we page dha page table, dhe Page Mumber ts fervor cLivided into a w bit page number and a to bib page offset. Tus dhe Lygizal aaldress i as Folbus. w Lo 12 if Po. a page number page offet. BR G an Cnolex into dho euler page table Pa 1s dhe Abplouemen’ unithin dha page of dhe cnnor page table. Consieles dha vax enthtecture as, £ 2) 7 [is Pe a_|} | Section poge of feb | S> Section number | P> an Lnolex into peye tuble | A> aliplaemon’ within dhe page Innot page oPBek Pe esesl to we Lh AL Ouky page Were dhe euber page lable consis! 2 bytes. To avowl such a large table sto divde dhe outer page table Into smaller pieces. we can duvide dhe cubet Pege table In various ways. eg: dhree level peging schome, And gute page outer page inne poge of Peek Py te [Ps d 3u 1o lo wa @D Washed page teblex fy a Bystem uvith 64 bik Logical addiess span, a two level paging schema 1's no Longer appropriate, The adalyesses [oor Live, ts of ao * Washed page table can be ued far handing address spaces Layger than 33 bits. a Hash value is dhe yittual page number. * Each enhy th dre hah table contains a Liked List oP elements. * Gach element can be classiPeol D Nitya page Tuumbet ® value oP mapped page fea cnto, D pointer bo dho noxt elemont in dhe Linked List. | Ugical | iy pie! crv Pid Aah | Cha) Paes ible PeLal ye hash table The virtual page number 1s compared to i eee Fleth tn dhe Past elemant rn the Unbedt Uist. % OP dhe 1s @ match, dhe eoresponding page fama 1s | wed to Rin dhe desired physical adldyess. i IP dhe 13 No match subseguont entries tn dhe Linkesl | Uist exe — searcheel fo matching vittual page rum bet. ® dnvertesd _ page. Lables: 4 3p goneral each prowess has dha page table. a Jt contans willow of entries in ench page lable. © mosb of dhe memory area canbe wasbed autng dhe paging comuayls & Tra sdution to dhe above problem 1s inverbecl page lable. x» The Following jwo conuph are representecl in ‘Unver bed page table, Ly uitual adldvess oP dhe page stored in the yea! momoty Location. Ls anfiymation about cho provess hot owns che page. physical Memory Pege table X Each virtual address In dhe system consists of hrple tuple. % prowss id, pagenamber, offset S x @ pair of < prowss-td, page-number is stored in he. | inven teal page table. | a whon dhe memory refBrene eceurs post of dhe virtual addiess, ennsisting < proess—ial page-number> Ys presented fo dho memory subsystem. 4 Tho Unverbeel page table is then search, 92 12 fend, ho Physical address 18 gurerobedl. * 3 po math found, shor an Nlegat adalvess spa hos beeen altempbeol. | Bei mentation: a The seg montation \5 dha omo1y management scheme | dhol support dhs wet view a memory. x Tw Logical address space is dho collection of segment | An program 19. dhe cailection of segments. ¥ The §sqgmenk Moy be dhe, | & main program, | Ls subroutines Ly modules | | by Rundions Ls Local and glotal variables etc. Th Legieal view @P dha segmuntation ‘3 & within che segmont, dha addresses spect both dha noma and ofBek within Seg mont- & By simplicity dhe seqmenb ave rwumberedl, insbeacl oF home. So dhe Lagical addiess epnsisb OP a kwo duple. sxgnantoion _ eden: ¥ THe physical memory "3 @ ono climonovonal address but | lyre auldiess have a two chimensional adelress. | X To aetess ANY progtams we mwl map Ye two dimnstonal | adboliess wer clefinad adoliess or to ano A'menssonal | Physical ecdtehess. |x The operating system beeps a segmunb tnble similar to the pege table. * The segment table hw a segrtont base fa segment Lim. Segment base > stovtitg phypieal address Limit —> length oF che segment: XA Lagieal address consist OP tuo pents. by Segrnom 8 Ls ofRet into drat seqmant a. Umit | Base Segmont table cro Hs a] Prysical memory Trop: Addyessing enroy x The — Segmant umber v3 tueel @ an dndex into dhe Segment table. qe fet cl mus be belween © bo _segmont Lint. ma) / © af dha condition solisRed, it vs addlect to dhe segmant tase andl generate dhe appropriate physical addliess. fe OP dha Condition 1s imo! satisRed, Hap uit be send by 03. |probection= { x own segrnantation probection can be athieved by using s@montation Vanelware. % The ePRet oF dm segment 's choked bere atessing : . / | Ymomoty- Bae see : } unite dhe hulp oF dhe —pprobechon oii, Megal auess can be Skonedl avoided. ® protection can be —athievedl oy dha Aefining sqgmunts as yea only o1 execute only ung protection bit shaving: | * The same seqmants can + be shaveol bby veore chan one prowsses- » Bach proves thas @ — segmont table. hon dha segment table entries of dhe two different prowssea point: to dhe same physieat Location, then dhe Segments can be shared. for Pe }400}———_—_ [wack] ge ee al Segment © se@gmants Limit Base gH) | ?/teee _ woo oe Seeman 4 ioe coo} 2 segment 3 main pare a hoo 4300 4300: —____ fsegmnent 1 segmant & 3| x00 3200 Hreof Segment >| ; 4[ 1000 47100 ual —— ical | Lagical aaldvess SO Segment table Sea NAAT Physical memory example fbr _ sharing oP _sepnests= | iywt_| Base | of as.abb | ha06 ge 1] aves [esans Editor Segment table ial Nogicatl tmemory prow Pr Rr Pi 7a973 eave tii 40003 Umit | Base Ae cata | aseee | 430be 1] geo 3 oe _— Physieal memory segment table Segnentation with paging = # an paging dho — phyoteat Momory 13 divides into equal | Bie OF blocks ate calleel pages. | # an segmentation, dhe physital memoyy ys civiéled info vaniable Sired blocs Calle Seginents. » Both paging and segmantotion hove morits anol domonits. # Inte) 3% we both paging and segrontation concepts. % The mociinum yumber oP Seginonls pox process YS 1bKB, ¥ Gach segmont eat be loge as 4a. % The page she 1s Ake Selector of set. ical (°e addvess : V desonptos table Segmont ——>|__deseriptor j | e Ra Unwoar adldbess Directory page | _ofBet a m pgp-els L___} directory directory elitectory en é enhy Page olirectory base _egister a Tw Ipmical address 18 abivibleol thio dwe path. Ly selector Lo offsee wo fast partition consists oP uplo 8ko segments dha are Private to dhet process. a The second portition consists of upto ska segmanb hat are skonecl among all dha protesses. * The infermation about Pixs} partition kept In beer Local elesoriptor + Te Information elbout second partition wept in Qobal_ esesriptos table (07). x Te Legicatl aoldliess 3 dhe past OP cselertor, @PRsetd. whore dhe selector ‘s dhe 14 bit number dhon UsTsT?\ \3 lessee S—> segmont number 3 > segment is \n LOT oy ODT P— deals usith protection la During @aess translation, Fast dhe legical aclotress 1s Converted into Lineon addtess. a Tw Lina addtess 1s Aivided into two pants. page yuunbesr do. bits page offses (a bib. o lo Le te la Page ruumbet poge Offsets | & In two level paging sehame, dLivicliyg dhe page numbey nto, Lo vo bit page lable Airectory & w bit poge table entry * By using — page cbiectoyy enhy anol dhe page table dho rear adboliess can be converted into appropriate physical e@dctiess. Kitwel memoyy Managemen’: & Uittaol wornoyy 1S dhe beehnizuo dha allows ho execution ef prowsses Shat ave not completely Ca memory. Advantage ef virtual mummy vs chat — programs con be Larger than physical remory. & UNbual memory also allows promsses to shave Res eourly and to Vmplement —sharedt rromory. UF rrovicles ePFeient wachanism Ry prowss creation, | x oe x vfrtual memory en ‘mouiny ‘mplomenbeo| by dho foltowing edomonol — paging i domand segmentation | | Sn UNtua) memory only dhe pert of dhe Programs needs to be tn Tramory, Ri execution. Demanel poging in 09 15 A bechnigue, Co ushich Pages are Loaulec fom disk inlo rnin momay enly hin Yrey ene vasdlecl- (2, damaneled by dhe progsom. Tus bechnigus allows dha eperating system bo cave memay spaw by bosping only dose pager Co rain mamoy dhab ate currently euived by dhe program. & Dernanal paging ‘s sinilay to cho paging with swaping . ® In clomara paging alll Promsses can be bept 9 Seepnelony mamory. * Tho process which needs bo dha executed i's swapped Into memory — trubeaal of swapping entiie process. = Vemand paging ate called as besay Loy _swapper became dhe swapping of pages 1s done only whan de CPo yeguives It. * In do eonboxt of a demand paging system, use oP dhe beam Swapper 1s beehwtically chumect ® 8 Swapper rnanipolates entire promsses , whore aa a pager Cs conemned vith ho Crobividual P32 oF @ process. © Tw we we pager vathor chan * sunay pen” co womnectioon with — elamand poging Tha bramfer of a pages mummy bo contiguous alisk span me | | | | Praga n rye © AY sD sO eH 0 LD BO WD sD udu wD uD 2D wd ULLLLL LL a when a provess "s to be Sewwappedl in, dro pager guasses whuch pages will be wed bere dhe process 1s swappect. | & The pager lonings Only necessary pages chto momony Instead of swapping a whole proves. an Jhb sehome dhe prokection ‘bit cau be wed to lstinguish dhose pages dha ave Yo martny anol dhose pages dha are Re on dro eLisk. when dhe bit is set bo ‘valid’ + Cndbeates shat dhe asou'atecl page is bot Legal and not in memory. whon die bit ts sail to “‘unvelid’ + Crabicabes chad dhe Pege vs etter Us not valid, oy G valicl but Is carrently on olish. * During enecution, (PF dhe provess auesses page chat aie in momory, dhon dho execution jroteeels normally. OP dhe page vs not th memay , chen _ page Foutt trap ill oceur. AF dhe process thier to ouess @ page chal was jet brought indo memory Access dhe pose mavked cnualid comes a je _[oult. page Ison backing store ® bring in missing page © Yeset page lable Prysteal ramon The proceeture for hanalling dui poge fault ts 1. we chek an intemal table Rr dha Provess to determine Whether dhe vefrenw was a valid ot invalid memory auess. 2. IF dhe veRiene wos twwalid ewe beiminate dhe process. 3P 1 wes valid but we have hot yes brought in that page, we new page it in, 3. Fir dha free Frome 4+ Scheclulo dhe elise. eperetion to teak dhe desired page into dhe nowly allocateel Frome. . when dhe elute Yead 1's complete we mod fy dhe internal lable leept with dha process andl dho pege bable to unalicake dhat dhe page 1s now in memory. | 6 Rested dhe Uutuchton chat was interrupted by dha Wrap. The prowess can now @uess dha page as dhough hoot always been tn memory. pure elena pegiss In dhe enter cases Wwe con stort executing a provess with no pages in monary: when dha operating [system sets dhe inuhuction poitter to dhe Past snshuctions lof dhe process whico 's oo dhe jon memory vesident page Who process Sromeelrabely foul for de page. ffber dh page's brought nto ntameny, ahs prowess Uontinues to execute faulting as nevessary until lenory page chat Te neeols 1's in memory. + dhol point it can percent with no mate Faults. Tra schome 1's called as dhe we elomane paging: Tho harelwate support fox the amend paging is CD page table Thi table has dhe ability to mor an enky | voli. Invalid bib - UD Secondary, memory Trt reomoty hold dose pages chal ave vot present in main memory. The secondary mestory 13 wanally hugh speed lish. oF (8 braun as dhe swap clovia, ar dhe section of disk used fos dua putpose 1s lenown as swap spae: fs a worst case example , consider dhe dhe jadtess instruction such as add dhe content oF tp p and fag dha yesulb in c. fetch and clewde the tnsttuchon (aon) \ a fetch A 3. fetch B | Ay Add A and B S. Stoie dhe sum iv c. of we Rutt when we by bo stove inc, we wit have bo get dw dlesived page, bring thin, conect dha page ible, anol Yestoit dhe instuction. The yestort wit require Fetching the Cubruttion again, clecoching rb again, fetching the two operands lagain, and dhen adobing again. Vow ever ehere is nok much Yepeabeal worl. jatel dhe xepetition Ys newssery only when a page fault ceuns. Perfeamane of gamend _paging:- | a The ‘emoy auess tims is egual to dhe efRctive | Auess hime Cma = ent). when dhore 1's no page Rutt, | * OF de page Faulk occurs, we must Fist ead dhe ‘Yelevant page ffon clisk and dhon auess Alesited woe. ltet P be dhe probability of page Faure Cosps) dhe [ET Onna Fo page Ra Fa To compute dhe " efRutive quess time ,we must henows how mush time Yo mmeced to sewia a poge faut. p Page aunt couses dro Feiloeniog Seguante to @ccur: °| 4 Trap to dhe operating syste * Save dw wer register ancl prowss state x Determule dhol dha inberupt was a page fut. % chuck dhat dhe page veRrenu was legal and cleteimine de Location of dhe page on dha alisk. Issue @ read From the dish toa Ree Fam. Ly wait tn dhe queue Ri dhe devia until dhe eaal yepust ts sexviced- Ls wait for dia devia sects andlor lateny time. Lo Begio dre bransfx of dhe page bo a fiee Fame. while waiting allocate tho cru to some ether user Receive an interupt ftom dhe elisk Tlo subsystem. Save dha Yegisters and process state fox otter user. Determine ¢hat dhe intenup was fiom dha olish. wviect dhe page table and ether table to show ghat dha desitecl page "s now i memory. : wait fox dhe CP> to be allocatedl to dh process again. Restore dhe user tegisters Process state, andl now page table and dren tesume cho intenupbeel inshuctions. Jn an eperating system dhat wes paging R, memory management, @ page ‘veplata ment algovithm ‘s needed lm decide which Page reeds & be replawe when a mew page comes tn. » When de process sturbs execution ancl auess & Page dhat vs not to memory. dh page Fauit ewitl oeuy. # The page fault con be serulung by swap io dhe desired page fom elisk to memory whoo dhe 1s ee Spa ‘in memory. * when hore ts no flee Spaw tn memory dren an Unmeedeel page woul be sweip cub Flom the manory bo disk, ang elesived Page would be swap. in to dhe Memory Flom ol’sk. Thi c tnown as page ‘eplawmunb. Baste steps fox Poje Yeplawemant 's D Fd dhe location of dhe dasited page on dhe dish. a) Prd dre Fee frome, 1 iP dhe tsa fiee flame use tb. 1) oP dhore vs no flee Fame we dhe Poge teplaument vthm to selecb @ vidlm Fame. 1) gone dha uletin page to dhe lish. change dhe page ancl Frame tables aunielirgly. 3) — Reaol dha clesireat poge into She Flee Frome. change dhe | Page andl fame tables. | 4) Restart dhe wer prowsses. valiel- invalial fiom bit e to pene : oer © Reset page table for Page table ee a af ne frames are fice tne page transfexs (om out ons 9) are -Yeguitecl. a dt will inerease page fate senie § ePechive auess time. x we ean reeluwe dha overhead by using a mooli byb - + modify bit 1s associates! evith each page, and set by the hondwere whenever chore 1s any changes in dhak page Sine 1 was tead in Fiom dha ebisk. = oP dhe modify BL is not set, dha page has not been mootifeot sina it was ead nb momory- a The number of page faut ave inversely proportional to the number ef available Frames. a» af dhe rwmber ef available fiome increases, ¢ho number of page Gut elecreases. ae le, ™ w ne ch g v b x4 uaa e Y 2 3 4 s 6 Number of frames Page Yepleue ment Algorithms: | | we mut to solve dwo maior problems bo Implemant elamand paging. we mu to dovelop Frans Allocation algorithm 4 page veplawment_ elite. oP we have wultiple Prowsses in memo, we musb elecide how many Frarnes allocate to earth prowess axl when page replawemant 13, Neuired, we must select dhe Fama dhat are to be replaced. | There ave mony page Yeplawment algorithms. Every eperating system probably has 1s own replammant scheme. go genonal we want dhe ont with dhe lowest page fautt rate . we evaluabe an algorithm by yunning hon a [pavticulor string ef memory yeRiences and computing dha wamber of Page faults. The string of momory teRrences is calleel reRiene shing- | lacoment :- | Q Elo page sepecmse x The simplest and Low overload — page veplawament algorithn Ts Fito algonithm. ¥ Pip guoue 1s yneuntained to \wld alt pages i memory. % when a page Ys rough? Unto memory 1 is Unserbed at dhe bail of de Ff gus. % The page ot dre. head of dhe queue would be reploredl when page feutt ows. a The given reBiens sting is 1.012080 42 $0 8.-2.1RO 19 GON 4 assume dhe Fame six as dinee. a” oe Boh eae Ae Aj el f] fl f In AF 3] fa} fa} B} A iW 1 'D] fof fof bb gin ee abe tot hier € 04 jal) = 15 fj 4 an hu example, dee fron ave initially empty. 3 The Fist dines teBrentos eames (1.0.1) page faults and | are brought ino dhase emply framus. * Tw next refrenw (4) ‘eplaws page 3, became page 3 was brought in Fist. = Cette) TEE EEE) Ee 7 7 % Sine o 1s cho moxb reference and o G aheady vo memory 80 No page fut Rr dha refrenw. i" The Flask rebienw fo 3 tesulb to page o being replawel sin tt wos dhe Rist of che dee pages in rtamory (or and #) > be brought In. a Th provss is continutel upto lash reRiene. Te Fh algorithm 13 easy to Implement but its pesfermana is not gooel- In some cases it hos been Pouncl ous dhat dhe number of page faults is nob feckly propoitional bo the number of fiemes. |unexpecteel yesult 13 known as belacly’s anomaly. | ® optimal page ‘eplawmont:- 4 | # optimal page Yeplawment elyorithm hos dhe lowest page | Feustt Yake of all algovthns. | 131 uni mover sufier ftom beledys anomaly. |¥ Tk con be worked nes replaw che page dat unl not | be wed for the Longest period of tim. ° ESE - - Eerie ° RIFlo i =I ' 7 ° i Tolol rusher oP page fait 's 4, a Rist dtree rePrences causes Rutt, dhat Py che dmvee erply, fran ¥ Tro reRrena to pegs A replnes poge 3, because 3 vil not | | be wed untl refrenw 18, where as © wit be wed abs and page tab lx The reRtences bo page # replows pager, as page \ wi be | dhe lost oP do chee page Gt manory to be Yefbrencea again ls Tw proves con be continued upto last seferences, p H prods only low peye feutts. > at i Ff to implensat, betawe 1 repuies fate © benouiledge oF de reRyenwe shig. : 4 stam replaces che page dhot el of time. @_uav. page. zeplecemant agent ¥ LRUL least Recently usecl) algo hos not been weal for dhe Longest pero ¥ dn di algorithm She time of che pages Last use would be ynwuinteuinwl with each table. x when a page mut be replaced, LRU chooses dha poge dhat hos not been week for dhe longest period of tims. 7 ° \ a 3 2 4 anal ° m| fal 27) 1 &) Be Wb fel aii el Bl bE Ho 3), ] lal fl fe 3 28 a Ce) iss: 1 1 1 hn fo lb} fe [2 2 hore total ruber of page faut ts 12. x In tha method, First Five page fault ave dho same as the optimal page ‘eplawmant a hon dhe veBrene bo pege 4 seus, LRU veplawmant sees that, of dhe dee Ffemes in memory, page 8 was wed least yecently. a Tha most yecently wieol page is page 6 antl jut ieee chat page 3 wes wed. lw The LRU Yeplavement algorithm replaces page, not lenowing dhat poge a 's @bout bo be used. The Tnplemartatoo of ue és, Q counters In dh inplemontation , a lygeal clock or counter 1s added to dha cpo and tine eF we Feld would be associabedl | with ath page lable enhy. ¥ Wo clock 1s ttuemanted For evely murtory reRrens. | ¥ Whenever dte erento a page 'S mace, dhe conten! of tho lode veyister are Copieel to dhe Hine of we Fiall tn He page lable enby for chat page. | * During teplowemunb dha page. wath dhe smallest ‘me value tut be replowel- 9D lade \inplenanftin:- aan dha Unplemuntotion a stacte witty page tumbers aye yngunbaiineel. * whenever de peg is teRhences, tk ls temoved from the stack andl pat on dhe top. 4 Tn dha way, dhe top of dhe staek i clays dhe most ‘Teeently weal page, axel bottom is dhe Leu pege. (Lav aponination page _Yepleumunk:- § 6 reRrene bit can be tel for ae page selaunent * The referee bit are qssocibbedl with enty un dha pge tbl ® The veRiene bt for dhe page is seb, by te harcore, whaneyor dhe page 3. re(Beneed. ¥ Tnitelly all che bits ere cleaved ‘o ty dhe os, O Adoliional serena bit agonthe: f The operalitg system sluPts dhe aeRrenw bit bit of ibs 8 bit byte \ bit anol aliscatcing dhe fo eoch poge unto dha ugh ordey jshiPbing dhe othr bits igh by how order bit. | Twe 8 bit poge we Ry dhe lat eght Hime pemiods. © Second _chane _algontiyrs: ie algoritim oP setond chanw Yeplaamant 's o shift registers contains dhe history of a To bas FlFo -replawment algorithm. » when a page has been af dw value vs ‘vero’ we x OF dw reRiene boii is seb to ae give dhe page 8 Serond chane ancl move onto seleck dhe runt FiFo page: selected ,we Inspect its YeRrence bit proceed to teplaw dhe page. uolon & pore gee Berond chon, ibs yeRrene bit 'S cleated, atch 1b Hae arnival tim Is Yeset 40 cunent hme. The page chat Vs given a Gecone chane will not be eplauedt until all etter pages have been Yeplauect. 4 Th vay bo Implement Me seconel chane algorithms Is @ Uveulor queue mathodl. reRrena bit « The pointer indicates which page ''s to be Yepleuzel nen’ - » when a frame tis needed dhe poinber edluanes unt % Ards dhe poge with a © vefrenu bit. x enc dha vietim page is fund dhe page ¢s teplaceel, enol new page i's enserbeel cn dha Cireular qusua in dhat position.

You might also like