您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > 英文版--存储系统(参考)
Chapter6Memoryfenlei.wdsxx.com分类信息news.wdsxx.com新闻2Chapter6Objectives•Mastertheconceptsofhierarchicalmemoryorganization.•Understandhoweachlevelofmemorycontributestosystemperformance,andhowtheperformanceismeasured.•Mastertheconceptsbehindcachememory,virtualmemory,memorysegmentation,pagingandaddresstranslation.fenlei.wdsxx.com分类信息news.wdsxx.com新闻36.1Introduction•Memoryliesattheheartofthestored-programcomputer.•Inpreviouschapters,westudiedthecomponentsfromwhichmemoryisbuiltandthewaysinwhichmemoryisaccessedbyvariousISAs.•Inthischapter,wefocusonmemoryorganization.Aclearunderstandingoftheseideasisessentialfortheanalysisofsystemperformance.fenlei.wdsxx.com分类信息news.wdsxx.com新闻46.2TypesofMemory•Therearetwokindsofmainmemory:randomaccessmemory,RAM,andread-only-memory,ROM.•TherearetwotypesofRAM,dynamicRAM(DRAM)andstaticRAM(SRAM).•DynamicRAMconsistsofcapacitorsthatslowlyleaktheirchargeovertime.Thustheymustberefreshedeveryfewmillisecondstopreventdataloss.•DRAMis“cheap”memoryowingtoitssimpledesign.fenlei.wdsxx.com分类信息news.wdsxx.com新闻56.2TypesofMemory•SRAMconsistsofcircuitssimilartotheDflip-flopthatwestudiedinChapter3.•SRAMisveryfastmemoryanditdoesn’tneedtoberefreshedlikeDRAMdoes.Itisusedtobuildcachememory,whichwewilldiscussindetaillater.•ROMalsodoesnotneedtoberefreshed,either.Infact,itneedsverylittlechargetoretainitsmemory.•ROMisusedtostorepermanent,orsemi-permanentdatathatpersistsevenwhilethesystemisturnedoff.fenlei.wdsxx.com分类信息news.wdsxx.com新闻66.3TheMemoryHierarchy•Generallyspeaking,fastermemoryismoreexpensivethanslowermemory.•Toprovidethebestperformanceatthelowestcost,memoryisorganizedinahierarchicalfashion.•Small,faststorageelementsarekeptintheCPU,larger,slowermainmemoryisaccessedthroughthedatabus.•Larger,(almost)permanentstorageintheformofdiskandtapedrivesisstillfurtherfromtheCPU.fenlei.wdsxx.com分类信息news.wdsxx.com新闻76.3TheMemoryHierarchy•Thisstorageorganizationcanbethoughtofasapyramid:86.3TheMemoryHierarchy•Toaccessaparticularpieceofdata,theCPUfirstsendsarequesttoitsnearestmemory,usuallycache.•Ifthedataisnotincache,thenmainmemoryisqueried.Ifthedataisnotinmainmemory,thentherequestgoestodisk.•Oncethedataislocated,thenthedata,andanumberofitsnearbydataelementsarefetchedintocachememory.fenlei.wdsxx.com分类信息news.wdsxx.com新闻96.3TheMemoryHierarchy•Thisleadsustosomedefinitions.–Ahitiswhendataisfoundatagivenmemorylevel.–Amissiswhenitisnotfound.–Thehitrateisthepercentageoftimedataisfoundatagivenmemorylevel.–Themissrateisthepercentageoftimeitisnot.–Missrate=1-hitrate.–Thehittimeisthetimerequiredtoaccessdataatagivenmemorylevel.–Themisspenaltyisthetimerequiredtoprocessamiss,includingthetimethatittakestoreplaceablockofmemoryplusthetimeittakestodeliverthedatatotheprocessor.106.3TheMemoryHierarchy•Anentireblocksofdataiscopiedafterahitbecausetheprincipleoflocalitytellsusthatonceabyteisaccessed,itislikelythatanearbydataelementwillbeneededsoon.•Therearethreeformsoflocality:–Temporallocality-Recently-accesseddataelementstendtobeaccessedagain.–Spatiallocality-Accessestendtocluster.–Sequentiallocality-Instructionstendtobeaccessedsequentially.116.4CacheMemory•ThepurposeofcachememoryistospeedupaccessesbystoringrecentlyuseddataclosertotheCPU,insteadofstoringitinmainmemory.•Althoughcacheismuchsmallerthanmainmemory,itsaccesstimeisafractionofthatofmainmemory.•Unlikemainmemory,whichisaccessedbyaddress,cacheistypicallyaccessedbycontent;hence,itisoftencalledcontentaddressablememory.•Becauseofthis,asinglelargecachememoryisn’talwaysdesirable--ittakeslongertosearch.126.4CacheMemory•The“content”thatisaddressedincontentaddressablecachememoryisasubsetofthebitsofamainmemoryaddresscalledafield.•Thefieldsintowhichamemoryaddressisdividedprovideamany-to-onemappingbetweenlargermainmemoryandthesmallercachememory.•Manyblocksofmainmemorymaptoasingleblockofcache.Atagfieldinthecacheblockdistinguishesonecachedmemoryblockfromanother.fenlei.wdsxx.com分类信息news.wdsxx.com新闻136.4CacheMemory•Thesimplestcachemappingschemeisdirectmappedcache.•InadirectmappedcacheconsistingofNblocksofcache,blockXofmainmemorymapstocacheblockY=XmodN.•Thus,ifwehave10blocksofcache,block7ofcachemayholdblocks7,17,27,37,...ofmainmemory.•Onceablockofmemoryiscopiedintoitsslotincache,avalidbitissetforthecacheblocktoletthesystemknowthattheblockcontainsvaliddata.Whatcouldhappenwithouthavingavalidbit?146.4CacheMemory•Thediagrambelowisaschematicofwhatcachelookslike.•Block0containsmultiplewordsfrommainmemory,identifiedwiththetag00000000.Block1containswordsidentifiedwiththetag11110101.•Theothertwoblocksarenotvalid.156.4CacheMemory•Thesizeofeachfieldintowhichamemoryaddressisdivideddependsonthesizeofthecache.•Supposeourmemoryconsistsof214words,cachehas16=24blocks,andeachblockholds8words.–Thusmemoryisdividedinto214/28=211blocks.•Forourfieldsizes,weknowweneed4bitsfortheblock,3bitsfortheword,andthetagiswhat’sleftover:166.4CacheMemory•Asanexample,supposeaprogramgeneratestheaddress1AA.In14-bitbinary,thisnumberis:00000110101010.•Thefirst7bitsofthisaddressgointhetagfield,thenext4bitsgointheblockfield,andthefinal3bitsi
本文标题:英文版--存储系统(参考)
链接地址:https://www.777doc.com/doc-7181977 .html