资源描述:
《系统级编程_lab11》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Lab11:MemoryMountainRequirementsPlatform:ThislabassumesthatyouareusingVisualC++undera32-bitversionofWindows,usingIntelPentiumorPentium-equivalentmachines.Theexactcompilerandplatformaremostlyunimportant,asthelabisreasonablyportable.GettoknowyourCacheThis
2、platformofIntelPentiummachineshasamemoryhierarchy,whichincludesmultilevelofCache,suchasL1cache,L2cache,andsometimesL3Cachemaybealsoexist.Youcanusethesometools,suchaseverest.exe,tofindoutthebasicinformationofCacheofthecomputersystem,whichyouareuings.Fore
3、xample,tousingeverest.exe,justdouble-clicktorunit.Afteritmakessomeinformationcollection,itwillshowalltheinformationaboutyoucomputersysteminitsframe.Thefollowingisanexampleofitsmainframe.YoucanseetheinformationabouttheCache.Now,runeverest.exetofindoutthe
4、informationofyourcomputersystem’sCache,andfilltheblank.TypeSizeinbyteL1cache64KBL2cache2ML3cacheTheprojectofmemory_mountainPleasedownloadtheprojectofmemory_mountain.rarfirst.ThisprojectiftheWindows-versionofCMUCSAPPofmountain.c,whichyoucanfindinlthetext
5、bookchapter6.6(Notes:thisisthefirstversion),lorfromhttp://csapp.cs.cmu.edu/public/1e/public/code.html/mountain.c(Notes:thisisthefirstversion)lorfromhttp://csapp.cs.cmu.edu/public/code.html/mountain.c(Notes:thisisthefirstversion)YourTask1.Readthesourceco
6、deinmountain.cpp,andanswerthefollowingquestions:(Notes:youdon’thavetopaytoomuchattentiononthefunctionfcyc2())1)Whatisthevariableofsizeandstrideusedfor?size是工作集的大小,即操作的数组的总大小,size越小,得到的工作集越小,时间局部性也就越好。stride是步长,表示读取的两个元素之间的间隔,stride越小,得到的空间局部性越好。步长stride
7、的范围为1~16。1)Whatisthemeaningofthereturnvalueofthefunctionrun()?Run()是一个封装函数,对于每个工作集大小size和步长stride的组合,它调用test()函数,并返回测量出的读吞吐率,单位为MB/s。2.Ifnecessary,makesomechangetothevalueofMINBYTES,MAXBYTES,andMAXSTRIDE.3.Buildtheprojectandrunit,theyoucangetanoutputfil
8、enamedasout.txt.4.Copythedatainout.txtintoanExcelfile.Justasshowninthefollowingfigure.5.ClickanycellinthisExcelfile,thenaddachart.ThenclickFinish.5.Thenyoucangetafigurealikethis:6.ThefollowingtwofiguresarefromCSAPPe1andCSAPPe2Fig