版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
MemoryHierarchyReview1Outline7.1IntroductionPrincipleofLocalityMemoryHierarchy7.2BasicofCacheDirectedMappedCacheBitsinaCacheCacheWriteCacheMissesMultiwordCacheBlock7.3CachePerformanceImproveCachePerformanceMemoryisaBottleneckFullyAssociativeCacheSetAssociativeCacheMulti-LevelCache7.1PrincipleofLocalityProgramaccessarelativelysmallportionoftheiraddressspaceatanyinstantoftimeTwokindoflocality:1.TemporallocalityIfanitemisreferenced,itwilltendtobereferencedagainsoon2.SpatiallocalityIfanitemisreferenced,itemswhoseaddressareclosebywilltendtobereferencedsoon7.1MemoryHierarchy–Speedvs.SizeMemoryTypeDiskDRAMSRAM7.1MemoryHierarchy-OperationIfdataisfound(hit)transfertoprocessor,otherwise(miss)transferdatatoupperlevel.AccesstimeHittimeMisspenaltyUserswantlargeandfastmemories!
SRAMaccesstimesare2-25nsatcostof$100to$250perMbyte.
DRAMaccesstimesare60-120nsatcostof$5to$10perMbyte.
Diskaccesstimesare10to20millionnsatcostof$.10to$.20perMbyte.
Tryandgiveittothemanywaybuildamemoryhierarchy7.1MemoryHierarchy7.2CacheCacheMemoryhierarchybetweenCPUandmainmemoryThestoragemanagedtotakeadvantageoflocalityofaccessCachetwoissuesHowdoweknowifadataitemisinthecache?TagandvalidbitIfitis,howdowefindit?MappedapproachesHowdoescacheworkexampleAddXntocacheDirectMappingmapmanymemorywordsontoonelocationincacheAddressismodulothenumberofblocksinthecache(blockaddress)modulo(no.ofcacheblocksinthecache)Example:Cachehas8wordMapping=blockaddressmodule87.2DirectMappedCache7.2DirectMappedCacheTwoissues1.Whichmemorywordinthecache?Usetagtoidentify2.Whetherthememoryblockisvalid?Ex.Initially,thecacheisemptyUsevalidbittoidentifyThusthecachedatastructurearevalidtagdataword…CacheIndex7.2DirectMappedCacheIfatagismatchedandvalidbitison
ThenarequesthitTagiscomparedwithupperportionofaddressReadhitsReadvaliddataoncacheReadmissesstalltheCPU,fetchblockfrommemory,delivertocache,restart
Writehitscanreplacedataincacheandmemory(write-through)writethedataonlyintothecache(write-backthecachelater)
Writemissesreadtheentireblockintothecache,thenwritetheword7.2CacheReadWriteTerminology7.2CacheWriteIssuesTwocachewritescheme:1.WritebackWhenwriteoccurs,onlywritetothecache2.WritethroughWhenwriteoccurs,writetothecacheandmemoryWrite-backproblemcacheandmemoryinconsistence,andcomplextoimplementEx.Whenacacheentryisreplaced,itmustupdatethecorrespondingmemoryaddressWrite-throughproblemWritingtomainmemoryslowsdowntheperformanceEx.CPIwithoutcachemiss=1.2clockcycleswritetomemorycausesextra10cycles13%storeinstructionsingccSolution:writebuffer,storethedataintowritebufferwhilethedataiswaitingtobewrittentomemoryTheprocesscancontinueexecutionafterwritingdataintocacheandwritebuffer7.2DirectMappedCacheCacheExampleonDECstation3100UseMIPSR2000CPU64KBdata98KBcachesize
7.2MultiwordCacheBlockTakeadvantageofspatiallocalityWithacachemiss,wewillfetchmultiplewordsthatareadjacentIncreasingtheblocksizetendstodecreasemissrate:
Usesplitcachesbecausethereismorespatiallocalityincode:
7.2Performance–Missratevs.BlocksizeImprovementoninstructionmissMakereadingmultiplewordseasierbyusingbanksofmemory
7.2Memorysystem-hardwareIssues7.3ImproveCachePerformanceThreewaysLargercacheSetassociativecacheReducecachemissrateNewplacementruleotherthandirectmappingMulti-levelcacheReducecachemisspenalty7.3FlexiblePlacementofBlocksTherearetwomoreflexibleschemes,thendirectedmappedSetassociativecacheFullyassociativecacheExample:block12addressisplacedin8blockcachePlace12%8=4Place12%4=0DirectmappedSetassociativeFullyassociativePlacedanyatblock7.3FullyAssociativecacheAnextremeschemeAmemorydatacanbeplacedinanyblockinthecacheDisadvantage:SearchallentriesinthecacheforamatchParallelcomparators7.3SetAssociativeCacheBetweendirectmappedandfull-associativeAmemorydatacanbeplacedinasetofblocksinthecache(address)modulo(numberofsetsincache)Ex:12modulo4=0Disadvantage:SearchallentriesinthesetforamatchParallelcomparators7.3EightBlockCacheConfigurationTotalsizeofcacheinblocksisequaltothenumberofsetsThus,forfixedcachesize,increaseassociativitydecreasesthenumberofset,butincreasenumberofelementinaset7.3MissRatewithAssociativityHigherdegreeofassociativityLowermissrateMorehardwarecosttosearch7.3Implementationof4-waySet-AssociativeCacheParallelcomparators7.3UseMulti-LevelCachetoReduceMissPenaltyAddasecondlevelcache:oftenprimarycacheisonthesamechipastheprocessoruseSRAMstoaddanothercacheaboveprimarymemory(DRAM)misspenaltygoesdownifdataisin2ndlevelcacheUsingmultilevelcaches:tryandoptimizethehittimeonthe1stlevelcachetryandoptimizethemissrateonthe2ndlevelcachePrimarycache(L1)Secondarycache(L2)L1cachemissL2cachemissCachehit7.3DecreasingMissPenaltywithMultilevelCachesAddasecondlevelcache:oftenprimarycacheisonthesamechipastheprocessoru
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年江西泰豪動(dòng)漫職業(yè)學(xué)院高職單招職業(yè)技能測試近5年??及鎱⒖碱}庫含答案解析
- 陜西省寶雞市高三教學(xué)質(zhì)量檢測語文試題(含答案)
- 基于脂質(zhì)代謝和mTOR-S6K-GHR信號通路探究越鞠丸防治抑郁癥的作用機(jī)制
- 2025年云浮普通貨運(yùn)從業(yè)資格證模擬考試
- 2025年武漢貨運(yùn)從業(yè)資格證年考試題目答案
- 2025年外研版三年級起點(diǎn)九年級生物上冊月考試卷含答案
- 2025年冀少新版七年級歷史下冊月考試卷含答案
- 2025年岳麓版必修2物理下冊階段測試試卷
- 2025年平頂山工業(yè)職業(yè)技術(shù)學(xué)院高職單招語文2018-2024歷年參考題庫頻考點(diǎn)含答案解析
- 2025年山東電力高等??茖W(xué)校高職單招職業(yè)適應(yīng)性測試近5年??及鎱⒖碱}庫含答案解析
- 四川省自貢市2024-2025學(xué)年上學(xué)期八年級英語期末試題(含答案無聽力音頻及原文)
- 新疆烏魯木齊地區(qū)2025年高三年級第一次質(zhì)量監(jiān)測生物學(xué)試卷(含答案)
- 衛(wèi)生服務(wù)個(gè)人基本信息表
- 北師大版八上《生物的遺傳和變異》
- 交叉口同向可變車道動(dòng)態(tài)控制與信號配時(shí)優(yōu)化研究
- 安華農(nóng)業(yè)保險(xiǎn)股份有限公司北京市地方財(cái)政生豬價(jià)格指數(shù)保險(xiǎn)條款(風(fēng)險(xiǎn)敏感型)
- 技術(shù)交易系統(tǒng)的新概念
- 通用電子嘉賓禮薄
- 春節(jié)習(xí)俗中的傳統(tǒng)節(jié)日服飾與裝扮
- (完整word版)英語四級單詞大全
- 武裝押運(yùn)操作規(guī)程完整
評論
0/150
提交評論