资源描述:
《系统级编程_lab11》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Lab11:MemoryMountainRequirementsPlatform:ThislabassumesthatyouareusingVisualC++undera32-bitversionofWindows,usingIntelPentiumorPentium-equivalentmachines.Theexactcompilerandplatformaremostlyunimportant,asthelabisreasonablyportable.GettoknowyourCacheTh
2、isplatformofIntelPentiummachineshasamemoryhierarchy,whichincludesmultilevelofCache,suchasL1cache,L2cache,andsometimesL3Cachemaybealsoexist.Youcanusethesometools,suchaseverest.exe,tofindoutthebasicinformationofCacheofthecomputersystem,whichyouareuings.
3、Forexample,tousingeverest.exe,justdouble-clicktorunit.Afteritmakessomeinformationcollection,itwillshowalltheinformationaboutyoucomputersysteminitsframe.Thefollowingisanexampleofitsmainframe.YoucanseetheinformationabouttheCache.Now,runeverest.exetofind
4、outtheinformationofyourcomputersystem’sCache,andfilltheblank.TypeSizeinbyteL1cache64KBL2cache2ML3cacheTheprojectofmemory_mountainPleasedownloadtheprojectofmemory_mountain.rarfirst.ThisprojectiftheWindows-versionofCMUCSAPPofmountain.c,whichyoucanfindin
5、lthetextbookchapter6.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.Readt
6、hesourcecodeinmountain.cpp,andanswerthefollowingquestions:(Notes:youdon’thavetopaytoomuchattentiononthefunctionfcyc2())1)Whatisthevariableofsizeandstrideusedfor?size是工作集的大小,即操作的数组的总大小,size越小,得到的工作集越小,时间局部性也就越好。stride是步长,表示读取的两个元素之间的间隔,stride越小,得到的空间局部
7、性越好。步长stride的范围为1~16。1)Whatisthemeaningofthereturnvalueofthefunctionrun()?Run()是一个封装函数,对于每个工作集大小size和步长stride的组合,它调用test()函数,并返回测量出的读吞吐率,单位为MB/s。2.Ifnecessary,makesomechangetothevalueofMINBYTES,MAXBYTES,andMAXSTRIDE.3.Buildtheprojectandrunit,theyoucan
8、getanoutputfilenamedasout.txt.4.Copythedatainout.txtintoanExcelfile.Justasshowninthefollowingfigure.5.ClickanycellinthisExcelfile,thenaddachart.ThenclickFinish.5.Thenyoucangetafigurealikethis:6.ThefollowingtwofiguresarefromCSAPPe1andCSAPPe2Fig