Lecture20:CacheHierarchies,VirtualMemoryToday'stopics:CachehierarchiesVirtualmemoryReminder:Assignment8willbepostedsoon(dueTue11/21)ExampleAccessPattern8-bytewords101000Direct-mappedcache:eachaddressmapstoauniqueaddressByteaddressTagCompareDataarrayTagarrayAssumethataddressesare8bitslongHowmanyofthefollowingaddressrequestsarehits/misses4,7,10,13,16,68,73,78,83,88,4,7,10…IncreasingLineSize32-bytecachelinesizeorblocksize10100000ByteaddressTagDataarrayTagarrayOffsetAlargecachelinesizesmallertagarray,fewermissesbecauseofspatiallocalityAssociativity10100000ByteaddressTagDataarrayTagarraySetassociativityfewerconflicts;wastedpowerbecausemultipledataandtagsarereadWay-1Way-2CompareAssociativity10100000ByteaddressTagDataarrayTagarrayHowmanyoffset/index/tagbitsifthecachehas64sets,eachsethas64bytes,4waysWay-1Way-2CompareExample32KB4-wayset-associativedatacachearraywith32bytelinesizesHowmanysetsHowmanyindexbits,offsetbits,tagbitsHowlargeisthetagarrayCacheMissesOnawritemiss,youmayeitherchoosetobringtheblockintothecache(write-allocate)ornot(write-no-allocate)Onareadmiss,youalwaysbringtheblockin(spatialandtemporallocality)–butwhichblockdoyoureplacenochoiceforadirect-mappedcacherandomlypickoneofthewaystoreplacereplacethewaythatwasleast-recentlyused(LRU)FIFOreplacement(round-robin)WritesWhenyouwriteintoablock,doyoualsoupdatethecopyinL2write-through:everywritetoL1writetoL2write-back:marktheblockasdirty,whentheblockgetsreplacedfromL1,writeittoL2WritebackcoalescesmultiplewritestoanL1blockintooneL2writeWritethroughsimplifiescoherencyprotocolsinamultiprocessorsystemastheL2alwayshasacurrentcopyofdataTypesofCacheMissesCompulsorymisses:happensthefirsttimeamemorywordisaccessed–themissesforaninfinitecacheCapacitymisses:happensbecausetheprogramtouchedmanyotherwordsbeforere-touchingthesameword–themissesforafully-associativecacheConflictmisses:happensbecausetwowordsmaptothesamelocationinthecache–themissesgeneratedwhilemovingfromafully-associativetoadirect-mappedcacheVirtualMemoryProcessesdealwithvirtualmemory–theyhavetheillusionthataverylargeaddressspaceisavailabletothemThereisonlyalimitedamountofphysicalmemorythatissharedbyallprocesses–aprocessplacespartofitsvirtualmemoryinthisphysicalmemoryandtherestisstoredondisk(calledswapspace)Thankstolocality,diskaccessislikelytobeuncommonThehardwareensuresthatoneprocesscannotaccessthememoryofadifferentprocessAddressTranslationThevirtualandphysicalmemoryarebrokenupintopagesVirtualaddress8KBpagesizepageoffsetvirtualpagenumberTranslatedtophysicalpagenumberPhysicaladdress13MemoryHierarchyPropertiesAvirtualmemorypagecanbeplacedanywhereinphysicalmemory(fully-associative)ReplacementisusuallyLRU(sincethemisspenaltyishuge,wecaninvestsomeefforttominimizemisses)Apagetable(indexedbyvirtualpagenumber)isusedfortranslatingvirtualtophysicalpagenumberThepagetableisitselfinmemoryTLBSincethenumberofpagesisveryhigh,thepagetablecapacityistoolargetofitonchipAtranslationlookasidebuffer(TLB)cachesthevirtualtophysicalpagenumbertranslationforrecentaccessesATLBmissrequiresustoaccessthepagetable,whichmaynotevenbefoundinthecache–twoexpensivememorylook-upstoaccessonewordofdata!
AlargepagesizecanincreasethecoverageoftheTLBandreducethecapacityofthepagetable,butalsoincreasesmemorywastageTLBandCacheIsthecacheindexedwithvirtualorphysicaladdressToindexwithaphysicaladdress,wewillhavetofirstlookuptheTLB,thenthecachelongeraccesstimeMultiplevirtualaddressescanmaptothesamephysicaladdress–mustensurethatthesedifferentvirtualaddresseswillmaptothesamelocationincache–else,therewillbetwodifferentcopiesofthesamephysicalmemorywordDoesthetagarraystorevirtualorphysicaladdressesSincemultiplevirtualaddressescanmaptothesamephysicaladdress,avirtualtagcomparisoncanflagamissevenifthecorrectphysicalmemorywordispresentCacheandTLBPipelineTLBVirtualaddressTagarrayDataarrayPhysicaltagcomparionVirtualpagenumberVirtualindexOffsetPhysicalpagenumberPhysicaltagVirtuallyIndexed;PhysicallyTaggedCacheBadEventsConsiderthelongestlatencypossibleforaloadinstruction:TLBmiss:mustlookuppagetabletofindtranslationforv.
pagePCalculatethevirtualmemoryaddressforthepagetableentrythathasthetranslationforpageP–let'ssay,thisisv.
pageQTLBmissforv.
pageQ:willrequirenavigationofahierarchicalpagetable(let'signorethiscasefornowandassumewehavesucceededinfindingthephysicalmemorylocation(R)forpageQ)AccessmemorylocationR(findthiseitherinL1,L2,ormemory)Wenowhavethetranslationforv.
pageP–putthisintotheTLBWenowhaveaTLBhitandknowthephysicalpagenumber–thisallowsustodotagcomparisonandchecktheL1cacheforahitIfthere'samissinL1,checkL2–ifthatmisses,checkinmemoryAtanypoint,ifthepagetableentryclaimsthatthepageisondisk,flagapagefault–theOSthencopiesthepagefromdisktomemoryandthehardwareresumeswhatitwasdoingbeforethepagefault…phew!
TitleBullet
Hosteons,一家海外主机商成立于2018年,在之前还没有介绍和接触这个主机商,今天是有在LEB上看到有官方发送的活动主要是针对LEB的用户提供的洛杉矶、达拉斯和纽约三个机房的方案,最低年付21美元,其特点主要在于可以从1G带宽升级至10G,而且是免费的,是不是很吸引人?本来这次活动是仅仅在LEB留言提交账单ID才可以,这个感觉有点麻烦。不过看到老龚同学有拿到识别优惠码,于是就一并来分享给有需...
这两天Linode发布了十八周年的博文和邮件,回顾了过去取得的成绩和对未来的展望。作为一家运营18年的VPS主机商,Linode无疑是有一些可取之处的,商家提供基于KVM架构的VPS主机,支持随时删除(按小时计费),可选包括美国、英国、新加坡、日本、印度、加拿大、德国等全球十多个数据中心,所有机器提供高出入网带宽,最低仅$5/月($0.0075/小时)。This month marks Linod...
一般大厂都是通过首年才有可以享受爆款活动,然后吸引我们注册他们商家达到持续续费和购买的目的。一般只有大厂才能有这样的魄力和能力首年亏本,但是对于一般的公司和个人厂家确实难过,这几年确实看到不少的同类商家难以生存。这里我们可以看到有对应的套餐方案。不过这两个套餐都是100%CPU独享的,不是有某云商家限制CPU的。但是轻量服务器有个不好的就是带宽是较大且流量是限制的额,分别是1GB和1.2TB月流量...
physicalmemory为你推荐
蓝牙itunes贵州省127支持ipad支持ipadnetbios端口怎么关闭8909端口!其他端口就不用了win7如何关闭445端口如何判断445端口是否关闭firefoxflash插件火狐浏览器adobe flash player装了不能用电信版iphone4s电信版iphone4s是买16gb的好还是32gb的好?routeaddroute add增加静态路由chrome18CHROME现在最新版是多少?
域名主机 域名城 长沙域名注册公司 联通c套餐 空间打开慢 sockscap 牛人与腾讯客服对话 网通ip 服务器合租 傲盾官网 免费测手机号 ftp免费空间 重庆双线服务器托管 新世界服务器 优酷黄金会员账号共享 跟踪路由命令 空间购买 双线asp空间 lick 中国电信网络测速 更多