欢迎来到天天文库
浏览记录
ID:35158852
大小:47.33 KB
页数:5页
时间:2019-03-20
《Windows Memory Management.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Copyright©http://www.intellectualheaven.comWindowsMemoryManagement(Writtenby:PankajGarg)1.IntroductionWindowson32bitx86systemscanaccessupto4GBofphysicalmemory.Thisisduetothefactthattheprocessor’saddressbuswhichis32linesor32bitscanonlyaccessaddressrangefrom0x00000000to0xFFFFFFFFwhichis4GB.Windowsals
2、oallowseachprocesstohaveitsown4GBlogicaladdressspace.Thelower2GBofthisaddressspaceisavailablefortheusermodeprocessandupper2GBisreservedforWindowsKernelmodecode.HowdoesWindowsgive4GBaddressspaceeachtomultipleprocesseswhenthetotalmemoryitcanaccessisalsolimitedto4GB.ToachievethisWindowsusesafeatureofx
3、86processor(386andabove)knownaspaging.Pagingallowsthesoftwaretouseadifferentmemoryaddress(knownaslogicaladdress)thanthephysicalmemoryaddress.TheProcessor’spagingunittranslatesthislogicaladdresstothephysicaladdresstransparently.Thisallowseveryprocessinthesystemtohaveitsown4GBlogicaladdressspace.Toun
4、derstandthisinmoredetails,letusfirsttakealookathowthepaginginx86works.2.Paginginx86ProcessorThex86processordividesthephysicaladdressspace(orphysicalmemory)in4KBpages.Thustoaddress4GBofmemory,wewillneed1Mega(1024x1024)4KBpages.Theprocessorusesatwolevelstructuretorefertothese1Megapages.Youcanthinkofi
5、tasatwodimensionalmatrixof1024x1024elements.ThefirstdimensionisknownasPageDirectoryandseconddimensionisknownasPageTable.Thuswecancreate1Pagedirectorywith1024entries,eachofwhichpointstoaPageTable.Thiswillallowustohave1024pagetables.Eachpagetableinturncanhave1024entries,eachofwhichpointstoa4KBpage.Gr
6、aphicallyitlookssomethinglike:PageDirectoryPageTablesPhysicalAddressIndex=0,Address=XIndex=0,Address=X1AddressX1–4KBPageIndex=1,Address=X2AddressYn–4KBPageIndex=2,Address=X3AddressX3–4KBPage…UnusedIndex=1023,Address=XnAddressXn–4KBPageUnusedIndex=1,Address=YIndex=0,Address=Y1AddressY1–4KBPageIndex=
7、1,Address=Y2AddressX2–4KBPageIndex=2,Address=Y3AddressZ2–4KBPage…AddressY2–4KBPageIndex=1023,Address=YnAddressZ3–4KBPage……Unused……UnusedIndex=1023,Address=ZIndex=0,Address=Z1AddressZn–4KBPageIndex=1,Address
此文档下载收益归作者所有