深入理解计算机系统 第二版 课后习题答案 pdf.pdf

深入理解计算机系统 第二版 课后习题答案 pdf.pdf

ID:52428992

大小:325.16 KB

页数:89页

时间:2020-03-27

深入理解计算机系统 第二版 课后习题答案 pdf.pdf_第1页
深入理解计算机系统 第二版 课后习题答案 pdf.pdf_第2页
深入理解计算机系统 第二版 课后习题答案 pdf.pdf_第3页
深入理解计算机系统 第二版 课后习题答案 pdf.pdf_第4页
深入理解计算机系统 第二版 课后习题答案 pdf.pdf_第5页
资源描述:

《深入理解计算机系统 第二版 课后习题答案 pdf.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、ComputerSystems:AProgrammer'sPerspectiveInstructor'sSolutionManual1RandalE.BryantDavidR.O'HallaronDecember4,20031Copyrightc2003,R.E.Bryant,D.R.O'Hallaron.Allrightsreserved.2Chapter1SolutionstoHomeworkProblemsThetextusestwodifferentkindsofexercises:PracticeProblems.Theseareproblems

2、thatareincorporateddirectlyintothetext,withexplanatorysolutionsattheendofeachchapter.Ourintentionisthatstudentswillworkontheseproblemsastheyreadthebook.Eachonehighlightssomeparticularconcept.HomeworkProblems.Thesearefoundattheendofeachchapter.Theyvaryincomplexityfromsimpledrillstom

3、ulti-weeklabsandaredesignedforinstructorstogiveasassignmentsortouseasrecitationexamples.Thisdocumentgivesthesolutionstothehomeworkproblems.1.1Chapter1:ATourofComputerSystems1.2Chapter2:RepresentingandManipulatingInformationProblem2.40Solution:Thisexerciseshouldbeastraightforwardvari

4、ationontheexistingcode.code/data/show-ans.c1voidshow_short(shortintx)2{3show_bytes((byte_pointer)&x,sizeof(shortint));4}56voidshow_long(longintx)7{8show_bytes((byte_pointer)&x,sizeof(long));9}12CHAPTER1.SOLUTIONSTOHOMEWORKPROBLEMS1011voidshow_double(doublex)12{13show_bytes((byte_poi

5、nter)&x,sizeof(double));14}code/data/show-ans.cProblem2.41Solution:Therearemanywaystosolvethisproblem.Thebasicideaistocreatesomemultibytedatumwithdifferentvaluesforthemostandleast-significantbytes.Wethenreadbyte0anddeterminewhichbyteitis.Inthefollowingsolutionistocreateanintwithvalue

6、1.Wethenaccessitsfirstbyteandconvertittoanint.Thisbytewillequal0onabig-endianmachineand1onalittle-endianmachine.code/data/show-ans.c1intis_little_endian(void)2{3/*MSB=0,LSB=1*/4intx=1;56/*ReturnMSBwhenbig-endian,LSBwhenlittle-endian*/7return(int)(*(char*)&x);8}code/data/show-ans.cPro

7、blem2.42Solution:Thisisasimpleexerciseinmaskingandbitmanipulation.Itisimportanttomentionthat˜0xFFisawaytogenerateamaskthatselectsallbuttheleastsignificantbytethatworksforanywordsize.(x&0xFF)

8、(y&˜0xFF)Problem2.43Solution:Theseexercisesrequirethinkingaboutthelogicaloperation!inanontrad

9、itionalway.Normally

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。