深入理解计算机系统第二版家庭作业答案
- 格式:docx
- 大小:526.19 KB
- 文档页数:96
习题一1.什么是操作系统?它的主要功能是什么?答:操作系统是用来管理计算机系统的软、硬件资源,合理地组织计算机的工作流程,以方便用户使用的程序集合;其主要功能有进程管理、存储器管理、设备管理和文件管理功能。
2.什么是多道程序设计技术?多道程序设计技术的主要特点是什么?答:多道程序设计技术是把多个程序同时放入内存,使它们共享系统中的资源;特点:(1)多道,即计算机内存中同时存放多道相互独立的程序;(2)宏观上并行,是指同时进入系统的多道程序都处于运行过程中;(3)微观上串行,是指在单处理机环境下,内存中的多道程序轮流占有CPU,交替执行。
3.批处理系统是怎样的一种操作系统?它的特点是什么?答:批处理操作系统是一种基本的操作系统类型。
在该系统中,用户的作业(包括程序、数据及程序的处理步骤)被成批的输入到计算机中,然后在操作系统的控制下,用户的作业自动地执行;特点是:资源利用率高、系统吞吐量大、平均周转时间长、无交互能力。
4.什么是分时系统?什么是实时系统?试从交互性、及时性、独立性、多路性和可靠性几个方面比较分时系统和实时系统。
答:分时系统:一个计算机和许多终端设备连接,每个用户可以通过终端向计算机发出指令,请求完成某项工作,在这样的系统中,用户感觉不到其他用户的存在,好像独占计算机一样。
实时系统:对外部输入的信息,实时系统能够在规定的时间内处理完毕并作出反应。
比较:(1)交互性:实时系统具有交互性,但人与系统的交互,仅限于访问系统中某些特定的专用服务程序。
它不像分时系统那样向终端用户提供数据处理、资源共享等服务。
实时系统的交互性要求系统具有连续人机对话的能力,也就是说,在交互的过程中要对用户得输入有一定的记忆和进一步的推断的能力。
(2)及时性:实时系统对及时性的要求与分时系统类似,都以人们能够接受的等待时间来确定。
而及时系统则对及时性要求更高。
(3)独立性:实时系统与分时系统一样具有独立性。
每个终端用户提出请求时,是彼此独立的工作、互不干扰。
int int_shifts_are_arithmetic(){int x = -1;return (x>>1) == -1;}2.63对于sra,主要的工作是将xrsl的第w-k-1位扩展到前面的高位。
这个可以利用取反加1来实现,不过这里的加1是加1<<(w-k-1)。
如果x的第w-k-1位为0,取反加1后,前面位全为0,如果为1,取反加1后就全是1。
最后再使用相应的掩码得到结果。
对于srl,注意工作就是将前面的高位清0,即xsra & (1<<(w-k) - 1)。
额外注意k==0时,不能使用1<<(w-k),于是改用2<<(w-k-1)。
int sra(int x, int k){int xsrl = (unsigned) x >> k;int w = sizeof(int) << 3;unsigned z = 1 << (w-k-1);unsigned mask = z - 1;unsigned right = mask & xsrl;unsigned left = ~mask & (~(z&xsrl) + z);return left | right;}int srl(unsigned x, int k){int xsra = (int) x >> k;int w = sizeof(int)*8;unsigned z = 2 << (w-k-1);return (z - 1) & xsra;}INT_MIN);}2.74对于有符号整数相减,溢出的规则可以总结为:t = a-b;如果a, b 同号,则肯定不会溢出。
如果a>=0 && b<0,则只有当t<=0时才算溢出。
如果a<0 && b>=0,则只有当t>=0时才算溢出。
word 文档下载后可自由复制编辑你计算机系统结构清华第 2 版习题解答word 文档下载后可自由复制编辑1 目录1.1 第一章(P33)1.7-1.9 (透明性概念),1.12-1.18 (Amdahl定律),1.19、1.21 、1.24 (CPI/MIPS)1.2 第二章(P124)2.3 、2.5 、2.6 (浮点数性能),2.13 、2.15 (指令编码)1.3 第三章(P202)3.3 (存储层次性能), 3.5 (并行主存系统),3.15-3.15 加 1 题(堆栈模拟),3.19 中(3)(4)(6)(8)问(地址映象/ 替换算法-- 实存状况图)word 文档下载后可自由复制编辑1.4 第四章(P250)4.5 (中断屏蔽字表/中断过程示意图),4.8 (通道流量计算/通道时间图)1.5 第五章(P343)5.9 (流水线性能/ 时空图),5.15 (2种调度算法)1.6 第六章(P391)6.6 (向量流水时间计算),6.10 (Amdahl定律/MFLOPS)1.7 第七章(P446)7.3 、7.29(互连函数计算),7.6-7.14 (互连网性质),7.4 、7.5 、7.26(多级网寻径算法),word 文档下载后可自由复制编辑7.27 (寻径/ 选播算法)1.8 第八章(P498)8.12 ( SISD/SIMD 算法)1.9 第九章(P562)9.18 ( SISD/多功能部件/SIMD/MIMD 算法)(注:每章可选1-2 个主要知识点,每个知识点可只选 1 题。
有下划线者为推荐的主要知识点。
)word 文档 下载后可自由复制编辑2 例 , 习题2.1 第一章 (P33)例 1.1,p10假设将某系统的某一部件的处理速度加快到 10倍 ,但该部件的原处理时间仅为整个运行时间的40%,则采用加快措施后能使整个系统的性能提高多少?解:由题意可知: Fe=0.4, Se=10,根据 Amdahl 定律S n To T n1 (1Fe )S n 1 10.6 0.4100.64 Fe Se 1.56word 文档 下载后可自由复制编辑例 1.2,p10采用哪种实现技术来求浮点数平方根 FPSQR 的操作对系统的性能影响较大。
习题二1.操作系统中为什么要引入进程的概念?为了实现并发进程之间的合作和协调,以及保证系统的安全,操作系统在进程管理方面要做哪些工作?答:(1)为了从变化的角度动态地分析研究可以并发执行的程序,真实地反应系统的独立性、并发性、动态性和相互制约,操作系统中就不得不引入“进程”的概念;(2)为了防止操作系统及其关键的数据结构,受到用户程序有意或无意的破坏,通常将处理机的执行状态分成核心态和用户态;对系统中的全部进程实行有效地管理,其主要表现是对一个进程进行创建、撤销以及在某些进程状态之间的转换控制,2.试描述当前正在运行的进程状态改变时,操作系统进行进程切换的步骤。
答:(1)就绪状态→运行状态。
处于就绪状态的进程,具备了运行的条件,但由于未能获得处理机,故没有运行。
(2)运行状态→就绪状态。
正在运行的进程,由于规定的时间片用完而被暂停执行,该进程就会从运行状态转变为就绪状态。
(3)运行状态→阻塞状态。
处于运行状态的进程,除了因为时间片用完而暂停执行外还有可能由于系统中的其他因素的影响而不能继续执行下去。
3.现代操作系统一般都提供多任务的环境,试回答以下问题。
(1)为支持多进程的并发执行,系统必须建立哪些关于进程的数据结构?答:为支持进程的并发执行,系统必须建立“进程控制块(PCB)”,PCB的组织方式常用的是链接方式。
(2)为支持进程的状态变迁,系统至少应该供哪些进程控制原语?答:进程的阻塞与唤醒原语和进程的挂起与激活原语。
(3)当进程的状态变迁时,相应的数据结构发生变化吗?答:创建原语:建立进程的PCB,并将进程投入就绪队列。
;撤销原语:删除进程的PCB,并将进程在其队列中摘除;阻塞原语:将进程PCB中进程的状态从运行状态改为阻塞状态,并将进程投入阻塞队列;唤醒原语:将进程PCB中进程的状态从阻塞状态改为就绪状态,并将进程从则色队列摘下,投入到就绪队列中。
4.什么是进程控制块?从进程管理、中断处理、进程通信、文件管理、设备管理及存储管理的角度设计进程控制块应该包含的内容。
int saturating_add(int x, int y){int w = sizeof(int)<<3;int t = x + y;int ans = x + y;x>>=(w-1);y>>=(w-1);t>>=(w-1);int pos_ovf = ~x&~y&t;int neg_ovf = x&y&~t;int novf = ~(pos_ovf|neg_ovf);return(pos_ovf & INT_MAX) | (novf & ans) | (neg_ovf & INT_MIN); }2.74对于有符号整数相减,溢出的规则可以总结为:t = a-b;如果a, b 同号,则肯定不会溢出。
如果a>=0 && b<0,则只有当t<=0时才算溢出。
如果a<0 && b>=0,则只有当t>=0时才算溢出。
不过,上述t肯定不会等于0,因为当a,b不同号时:1) a!=b,因此a-b不会等于0。
2) a-b <= abs(a) + abs(b) <= abs(TMax) + abs(TMin)=(2^w - 1)所以,a,b异号,t,b同号即可判定为溢出。
int tsub_ovf(int x, int y){int w = sizeof(int)<<3;int t = x - y;x>>=(w-1);y>>=(w-1);t>>=(w-1);return(x != y) && (y == t);}顺便整理一下汇编中CF,OF的设定规则(个人总结,如有不对之处,欢迎指正)。
t = a + b;CF: (unsigned t) < (unsigned a) 进位标志OF: (a<0 == b<0) && (t<0 != a<0)t = a - b;CF: (a<0 && b>=0) || ((a<0 == b<0) && t<0) 退位标志OF: (a<0 != b<0) && (b<0 == t<0)汇编中,无符号和有符号运算对条件码(标志位)的设定应该是相同的,但是对于无符号比较和有符号比较,其返回值是根据不同的标志位进行的。
2.1.3 Lab: Benchmarking (Optional)Benchmarking, which is the process of running standardized tests upon differing configurations to determine the speed of components or software was briefly mentioned in 2.1.1 Processor Basics. This lab will give you a greater understanding of benchmarks by having you download Fresh Diagnose, an application that allows you to analyze and benchmark your computer system. You will use the software to compare the benchmarking results of your processor with those of your classmates.Note:This lab is to be performed on Intel-based computers running Windows 95/98/NT4/2000/XP/ME.Learning Exercise:∙Download Fresh Diagnose and install it. (1102 kb download)∙Run the application.∙Click on Benchmarks on the left-hand side menu.∙Pick Processor Benchmark and click on Start on the upper-right corner of the application screen.∙Compare your results with those of your classmates.∙Try another benchmark and compare your results with those of your classmates.∙You can also explore your system's properties through the other options on the left-hand side menu.Exercise 2Question 1. Choosing MicroprocessorsThe following processors are made by Intel:A. Mobile Intel® Pentium® 4 Processor with Hyper-Threading Technology Processor speed: 3.2GHzLow power consumptionLevel 2 cache: 512KBSystem bus: 800 MHzB. Mobile Intel Pentium® 4 Processor-MProcessor speed: 2.8GHzLevel 2 512KBSystem bus: 533 MHzC. Intel Celeron®Processor speed: 2.8 GHzLevel 2 128KBSystem bus: up to 400 MHzYou may find the following resources useful:∙Intel Notebook Processors∙The CPU Scorecarda. List the processors described above by their price range (from the cheapest to the most expensive).b. List the processors described above by their performance (from the best to the worst).c. Which of the above processors would be the fastest when used for multi-media production and multi-tasking (running 10 or more applications at the same time)?Unit 1 and Unit 2 Review Materials1. Benchmarksa.With regard to computing, define the term benchmark.The comparison of disparate systems or components via a standardized set of instructions.The comparison is measured on the time it takes to execute these instructionsb.What tasks does benchmarking software perform in order to measurethe system being tested?Benchmarking software has the processor execute a series of tasks, comparing various aspects of system performance. These tasks can test anything from just the processor to video output to system bus speeds.c.How can consumers use benchmarks to help them purchase a computersystem?For a consumer, it can be difficult to compare two systems with different processor chips and video cards to find one with the optimal performance for the style of application that they will be running. Benchmarking computers can compare these two vastly differing systems in a quantifiable way, giving the consumer the ability to purchase the machine that will perform as neededd.How do benchmarks help identify slow points (bottlenecks) in thesystem?Benchmarking software can identify slow points (bottlenecks) by testing the speedsof various components and listing areas where the computer is waiting for data, andwhat is keeping the data for arriving quickly.puter Speeda.One Hz is one _____ per _____. One Hz is one cycle per secondb.Define IPS. IPS is instructions per second which is a rating of how many instructionscan be executed by a processor in a given secondc.Answer the following questions on the relationship of Hz to IPS.i.Which is a better determiner of speed: MHz or IPS? IPSis a better determiner of computer performanceii.Does a high Hz equal a high IPS, and can they beinversely proportional? Explain.A high Hz can indicate thatthe IPS is high, but they are not directly proportional, but can never beinversely proportionaliii.How is it possible for a machine with a lower clockspeed (Hz) to have a higher IPS than a machine with ahigher clock speed?An instruction can take a variable amount of cycles or partial cycles. Thus, a computer can execute instructions more quickly than another computer because of this.d.What is the relationship between the system clock and Hz? The systemclock sends out pulses at regular intervals to set up the timings for all timed systemactivities, such as determining the Hz of a processor14. RAMa.Define RAM. RAM is random access memory. It is the main storage for data, holdingthe data before and after processingb.What is the unit of measurement typically used for the speed of RAM?The speed of RAM is measured in nanosecondsc.What is SDRAM and how does it work? SDRAM is Synchronous Dynamic RAM,a type of DRAM that is fast and relatively inexpensive. It is synchronously clocked to thesystem bus. This means that RAM can send out data to the CPU for each tick of the clockd.Data on hard disk drives is accessed indirectly via the file system.i.How is data in RAM accessed? RAM is accessed directly via itsaddressii.What are the benefits of accessing RAM in this way?Accessing RAM directly increases the speed of information retrievale.With regard to RAM, what is volatility? Volatility means that when the poweris lost the data stored in RAM is also lost。
word 文档下载后可自由复制编辑你计算机系统结构清华第 2 版习题解答word 文档下载后可自由复制编辑1 目录1.1 第一章(P33)1.7-1.9 (透明性概念),1.12-1.18 (Amdahl定律),1.19、1.21 、1.24 (CPI/MIPS)1.2 第二章(P124)2.3 、2.5 、2.6 (浮点数性能),2.13 、2.15 (指令编码)1.3 第三章(P202)3.3 (存储层次性能), 3.5 (并行主存系统),3.15-3.15 加 1 题(堆栈模拟),3.19 中(3)(4)(6)(8)问(地址映象/ 替换算法-- 实存状况图)word 文档下载后可自由复制编辑1.4 第四章(P250)4.5 (中断屏蔽字表/中断过程示意图),4.8 (通道流量计算/通道时间图)1.5 第五章(P343)5.9 (流水线性能/ 时空图),5.15 (2种调度算法)1.6 第六章(P391)6.6 (向量流水时间计算),6.10 (Amdahl定律/MFLOPS)1.7 第七章(P446)7.3 、7.29(互连函数计算),7.6-7.14 (互连网性质),7.4 、7.5 、7.26(多级网寻径算法),word 文档下载后可自由复制编辑7.27 (寻径/ 选播算法)1.8 第八章(P498)8.12 ( SISD/SIMD 算法)1.9 第九章(P562)9.18 ( SISD/多功能部件/SIMD/MIMD 算法)(注:每章可选1-2 个主要知识点,每个知识点可只选 1 题。
有下划线者为推荐的主要知识点。
)word 文档 下载后可自由复制编辑2 例 , 习题2.1 第一章 (P33)例 1.1,p10假设将某系统的某一部件的处理速度加快到 10倍 ,但该部件的原处理时间仅为整个运行时间的40%,则采用加快措施后能使整个系统的性能提高多少?解:由题意可知: Fe=0.4, Se=10,根据 Amdahl 定律S n To T n1 (1Fe )S n 1 10.6 0.4100.64 Fe Se 1.56word 文档 下载后可自由复制编辑例 1.2,p10采用哪种实现技术来求浮点数平方根 FPSQR 的操作对系统的性能影响较大。
计算机操作系统第二版答案习题一1. 1. 什么是操作系统?它的主要功能是什么?什么是操作系统?它的主要功能是什么?答:操作系统是用来管理计算机系统的软、硬件资源,合理地组织计算机的工作流程,以方便用户使用的程序集合;其主要功能有进程管理、存储器管理、设备管理和文件管理功能。
管理功能。
2. 2. 2. 什么是多道程序设计技术?多道程序设计技什么是多道程序设计技术?多道程序设计技术的主要特点是什么?答:多道程序设计技术是把多个程序同时放入内存,使它们共享系统中的资源;特点:多道,即计算机内存中同时存放多道相互独立的程序;宏观上并行,是指同时进入系统的多道程序都处于运行过程中;微观上串行,是指在单处理机环境下,内存中的多道程序轮流占有CPU CPU,交替执行。
,交替执行。
3. 3. 批处理系统是怎样的一种操作系统?它的特点是什批处理系统是怎样的一种操作系统?它的特点是什么?答:批处理操作系统是一种基本的操作系统类型。
在该系统中,用户的作业被成批的输入到计算机中,然后在操作系统的控制下,用户的作业自动地执行;特点是:资源利用率高、系统吞吐量大、平均周转时间长、无交互能力。
长、无交互能力。
4. 4. 4. 什么是分时系统?什么是实时系统?什么是分时系统?什么是实时系统?试从交互性、及时性、独立性、多路性和可靠性几个方面比较分时系统和实时系统。
较分时系统和实时系统。
答:分时系统:一个计算机和许多终端设备连接,每个 答:分时系统:一个计算机和许多终端设备连接,每个用户可以通过终端向计算机发出指令,请求完成某项工作,在这样的系统中,用户感觉不到其他用户的存在,好像独占计算机一样。
计算机一样。
实时系统:对外部输入的信息,实时系统能够在规定的 实时系统:对外部输入的信息,实时系统能够在规定的时间内处理完毕并作出反应。
比较:交互性:实时系统具时间内处理完毕并作出反应。
有交互性,但人与系统的交互,仅限于访问系统中某些特定的专用服务程序。
计算机操作系统第二版课后答案徐甲同1、在演示文稿播放过程中,当幻灯片进入和离开屏幕时,出现溶解盒状展开擦除等切换效果,是因为()。
[单选题] *A. 在一张幻灯片内部设置了播放效果B. 设置了幻灯片的切换效果(正确答案)C. 为幻灯片使用了适当的模板2、C:机器语言编写的程序执行效率最低D:不同型号的CPU具有相同的机器语言下列叙述中,错误的是______。
[单选题] *A:硬盘在主机箱内,它是主机的组成部分(正确答案)B:硬盘属于外部存储器3、在WPS文字中,如果已存在一个名为实验wps的文件,要想将它换名为NEW.docx,可以选择()命令。
[单选题] *A)另存为((正确答案)B)保存(C)全部保存(4、WPS演示文稿提供了多种(),它包含了相应的配色方案母版和字体样式等,可供用户快速生成风格统一的演示文稿。
[单选题] *A.新幻灯片B.模板(正确答案)C.配色方案5、.Windows的窗口分为类,下面()不是Windows的窗口类型。
[单选题] *A. 对话框B. 快捷菜单(正确答案)C. 文档窗口6、计算机系统软件中,最基本、最核心的软件是______。
[单选题] *A:操作系统(正确答案)B:数据库管理系统C:程序语言处理系统D:系统维护工具7、下列说法正确的是______。
[单选题] *A:进程是一段程序B:进程是一段程序的执行过程(正确答案)C:线程是一段子程序D:线程是多个进程的执行过程8、HTTP 是()。
中[单选题] *A.超文本标记语言B.超文本传送协议(正确答案)C.搜索引擎D.文件传输协议9、39.计算机网络是计算机技术和()[单选题] *A.自动化技术的结合B.通信技术的结合(正确答案)C.电缆等传输技术的结合D.信息技术的结合10、计算机中运算器的主要功能是()。
[单选题] * A.存储各种数据和程序B.传输各种信息C.进行算术运算和逻辑运算(正确答案)D.对系统各部件实行控制11、操作系统是()。