(完整word版)操作系统概念_第六版_重点部分_中文答案(word文档良心出品)

上传人:h****M 文档编号:57386748 上传时间:2022-02-23 格式:DOC 页数:15 大小:389.50KB
收藏 版权申诉 举报 下载
(完整word版)操作系统概念_第六版_重点部分_中文答案(word文档良心出品)_第1页
第1页 / 共15页
(完整word版)操作系统概念_第六版_重点部分_中文答案(word文档良心出品)_第2页
第2页 / 共15页
(完整word版)操作系统概念_第六版_重点部分_中文答案(word文档良心出品)_第3页
第3页 / 共15页
资源描述:

《(完整word版)操作系统概念_第六版_重点部分_中文答案(word文档良心出品)》由会员分享,可在线阅读,更多相关《(完整word版)操作系统概念_第六版_重点部分_中文答案(word文档良心出品)(15页珍藏版)》请在装配图网上搜索。

1、11.1What are the three main purposes of an operating system?1 To provide an environment for a computer user to execute programs on computer hardware in a convenient and ef ?cient manner.2 To allocate the separate resources of the computer as needed to solve the problem given. The allocation process

2、should be as fair and ef ?cient as possible.3 As a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) manage-ment of the operation and control of I/O devices.环境提供者,为计算机用户提供一个环境,使得能够在计算机硬件上方便、高效的

3、执行程序资源分配者,为解决问题按需分配计算机的资源,资源分配需尽可能公平、高效控制程序监控用户程序的执行,防止出错和对计算机的不正当使用管理 I/O 设备的运行和控制1.2 List the four steps that are necessary to run a programon a completely dedicatedmachine. Answer: Generally, operating systems for batch systems have simpler requirements than for personal computers. Batch systems

4、do not have to be concerned with interacting with a user as much as a personal computer. As a result, an operating system for a PC must be concerned with response time for an interactive user. Batch systems do not have such requirements. A pure batch system also may have not to handle time sharing,w

5、hereas an operating systemmust switch rapidly between different jobs.木有找到中文答案1.6 Define the essential properties of the following types of operating systems:a. Batchb. Interactivec. Time sharingd. Real timee. Networkf. Distributeda. Batch. Jobs with similar needs are batched together and run through

6、 the computer as a group by an operator or automatic job sequencer. Performance is increased by attempting to keep CPU and I/O devices busy at all times through buffering, off-line operation, spooling, and multiprogramming. Batch is good for executing large jobs that need little interaction; it can

7、be submitted and picked up later.b. Interactive. This system is composed of many short transactions where the results of the next transactionmay be unpredictable. Response time needs to be short (seconds) since the user submits and waits for the result.c. Time sharing.Thissystemsuses CPU scheduling

8、and multiprogramming to provide economical interactive use of a system. The CPU switches rapidly from one user toanother. Instead of having a job de ?ned by spooled card images, each program readsits next control card from the terminal, and output is normally printed immediatelyto the screen.d. Real

9、 time. Often used in a dedicated application, this system reads information from sensors and must respond within a ?xed amount of time to ensure correct perfor-mance.e. Network.2f. Distributed.This system distributes computation among several physical processors. The processors do not share memory o

10、r a clock. Instead, each processor has its own local memory. They communicate with each other through various communication lines, such as a high-speed bus or telephone line.a. Batch相似需求的 Job分批、成组的在计算机上执行,Job由操作员或自动Job程序装置装载;可以通过采用 buffering, off-line operation, spooling, multiprogramming 等技术使 CPU 和

11、 I/O 不停忙来提高性能批处理适合于需要极少用户交互的Job。b. Interactive由许多短交易组成,下一次交易的结果可能不可预知需要响应时间短c. Time sharing使用 CPU调度和多道程序提供对系统的经济交互式使用,CPU快速地在用户之间切换一般从终端读取控制,输出立即打印到屏幕d. Real time在专门系统中使用,从传感器读取信息,必须在规定时间内作出响应以确保正确的执行e. Network在通用 OS上添加联网、通信功能远程过程调用文件共享f. Distributed具有联网、通信功能提供远程过程调用提供多处理机的统一调度调度统一的存储管理分布式文件系统1.7 We

12、 have stressed the need for an operating system to make efficient use of the computinghardware. When is it appropriate for the operating system to forsake this principle and to “ w resources? Why is such a system not really wasteful?We have stressed the need for an operating system to make ef?cient

13、use of the computinghardware. When is it appropriate for the operating system to forsake this principle and to “ waste” resources? Why is such a system not really wasteful?Answer: Single-user systems should maximize use of the system for the user. A GUI might “ waste” CPU cycles, but it optimizes th

14、e user s interaction with the system.木有中文答案2.2 How does the distinction between monitor mode and user mode function as a rudimentary form of protection (security) system?Answer: By establishing a set of privileged instructions that can be executed only whenin the monitor mode, the operating system i

15、s assured of controlling the entire system at all Times.3通过建立一组只能在monitor mode 才能执行的特权指令集,OS能够确保总是能控制整个系统。2.3 What are the differences between a trap and an interrupt? What is the use of each function?Answer: An interrupt is a hardware-generated change-of- ?ow within the system. Aninterrupt handler

16、is summoned to deal with the cause of the interrupt; control is then re-turned to the interrupted context and instruction. A trap is a software-generated interruptAn interrupt can be used to signal the completion of an I/O to obviate the need for device polling. A trap can be used to call operating

17、system routines or to catch arithmetic errors.An interrupt 是硬件产生的系统内的流的改变A trap 是软件产生的“中断” 。interrupt 可以被 I/O 用来产生完成的信号,从而避免 CPU对设备的轮询 A trap 可以用来调用 OS的例程或者捕获算术错误2.5 Which of the following instructions should be privileged?a. Set value of timer.b. Read the clock.c. Clear memory.d. Turn off interrupt

18、s.e. Switch from user to monitor mode.Answer: The following instructions should be privileged:a. Set value of timer.b. Clear memory.c. Turn off interrupts.d. Switch from user to monitor mode.2.8 Protecting the operating system is crucial to ensuring that the computer system operates correctly. Provi

19、sion of this protection is the reason behind dual-mode operation, memory protection, and the timer. To allow maximum flexibility, however, we would also like to place minimal constraints on the user.The following is a list of operations that are normally protected. What is the minimal set of instruc

20、tions that must be protected?a. Change to user mode.b. Change to monitor mode.c. Read from monitor memory.d. Write into monitor memory.e. Fetch an instruction from monitor memory.f. Turn on timer interrupt.g. Turn off timer interrupt.Answer: The minimal set of instructions that must be protected are

21、:a. Change to monitor mode.b. Read from monitor memory.c. Write into monitor memory.d. Turn off timer interrupt.3.6 List five services provided by an operating system. Explain how each provides convenience to the users. Explain also in which cases it would be impossible for user-level programs to pr

22、ovide these services.Answer:Program execution. The operating system loads the contents (or sections) of a ?le into memory and begins its execution. A user-level program could not be trusted to4properly allocate CPU time.I/O operations. Disks, tapes, serial lines, and other devices must be communicat

23、ed with at a very low level. The user need only specify the device and the operation to performon it, while the system converts that request into device- or controller-specic commands. User-level programs cannot be trusted to only access devices they should have access to and to only access them whe

24、n they are otherwise unused.File-systemmanipulation. There are many details in ?le creation, deletion, allocation, and naming that users should not have to perform. Blocks of disk space are used by ?les and must be tracked. Deleting a ?le requires removing the name ?le information and freeing the al

25、located blocks. Protections must also be checked to assure proper ?le access. User programs could neither ensure adherence to protection methods nor be trusted to allocate only free blocks and deallocate blocks on ?le deletion. Communications. Message passing between systems requires messages be tur

26、ned into packets of information, sent to the network controller, transmitted across a com-munications medium, and reassembled by the destination system. Packet ordering and data correction must take place. Again, user programs might not coordinate ac-cess to the network device, or they might receive

27、 packets destined for other processes.Error detection. Error detection occurs at both the hardware and software levels. At the hardware level, all data transfers must be inspected to ensure that data have not been corrupted in transit. All data on media must be checked to be sure they have not chang

28、ed since they were written to the media. At the software level, media must be checked for data consistency; for instance, do the number of allocated and unallocated blocks of storage match the total number on the device. There, errors are frequently process-independent (for instance, the corruption

29、of data on a disk), so theremust be a global program(the operating system) that handles all types of errors. Also, by having errors processed by the operating system, processes need not contain code to catch and correct all the errors possible on a system.3.7 What is the purpose of system calls?Answ

30、er: System calls allow user-level processes to request services of the operating sys-Tem.让用户级进程可以请求操作系统所提供的服务3.10 What is the purpose of system programs?Answer: System programs can be thought of as bundles of useful system calls. They provide basic functionality to users and so users do not need to

31、write their own programs to solve common problems.为程序开发和运行提供了方便的环境给用户提供基本的公共功能函数,为用户在不用自己写代码的情况下解决公用问题4.1 MS-DOS provided no means of concurrent processing. Discuss three major complications5that concurrent processing adds to an operating system.Answer:A method of time sharing must be implemented to

32、 allow each of several processes to have access to the system. This method involves the preemption of processes that do not voluntarily give up the CPU (by using a system call, for instance) and the kernel being reentrant (somore than one processmay be executing kernel code concurrently).Processes a

33、nd system resources must have protections and must be protected from each other. Any given process must be limited in the amount of memory it can use and the operations it can perform on devices like disks.Caremust be taken in the kernel to prevent deadlocks between processes, so processes arent wai

34、ting for each other s allocated resources.4.6 The correct producer consumer algorithm in Section 4.4 allows only n-1 buffers to be full at any one time. Modify the algorithm to allow all buffers to be utilized fully.Answer: No answer.5.1 Provide two programming examples of multithreading giving impr

35、ove performance over a single-threaded solution.Answer: (1) A Web server that services each request in a separate thread. (2) A paral-lelized application such as matrix multiplication where different parts of the matrix may be worked on in parallel. (3) An interactive GUI program such as a debugger

36、where a thread is used to monitor user input, another thread represents the running application, And at third thread monitors performance.可以并发的多任务Web浏览器,数据可并行处理5.3 What are two differences between user-level threads and kernel-level threads? Under what circumstances is one type better than the other

37、?Answer: (1) User-level threads are unknown by the kernel, whereas the kernel is aware of kernel threads. (2) User threads are scheduled by the thread library and the kernel schedules kernel threads. (3) Kernel threads need not be associatedwith a process whereas every user thread belongs to a proce

38、ss.内核可知与不可知调度者不同与进程的关系6.3 Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:ProcessBurstTime PriorityP1103P211P323P414P552The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts illustratin

39、g the execution of these processes using FCFS, SJF, a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1) scheduling.b. What is the turnaround time of each process for each of the scheduling algorithms in6part a?c. What is the waiting time of each proce

40、ss for each of the scheduling algorithms in part a?d. Which of the schedules in part a results in the minimal average waiting time (over all processes)?6.4 Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. In answering

41、the questions, use nonpreemptive scheduling and base all decisions on the information you have at the time the decision must be made.a. What is the average turnaround time for these processes with the FCFS scheduling7algorithm?b. What is the average turnaround time for these processes with the SJF s

42、cheduling algorithm?c. The SJF algorithm is supposed to improve performance, but notice that we chose torun process P1 at time 0 because we did not know that two shorter processes wouldarrive soon. Compute what the average turnaround time will be if the CPU is leftidle for the first 1 unit and then

43、SJF scheduling is used. Remember that processes P1and P2 are waiting during this idle time, so their waiting time may increase. Thisalgorithm could be known as future-knowledge scheduling.a. 10.53 (8-0)+(12-0.4)+(13-1.0)/3 = 10.53b. 9.53 (8-0)+(13-0.4)+(9-1.0)/3 = 9.53c. 6.86 (14-0)+(6-0.4)+(2-1.0)/

44、3 = 6.876.10 Explain the differences in the degree to which the following scheduling algorithms discriminate in favor of short processes:a. FCFSb. RRc. Multilevel feedback queuesa. FCFS discriminates against short jobs since any short jobs arriving after long jobs will have a longer waiting time.b.

45、RR treats all jobs equally (giving them equal bursts of CPU time) so short jobs will be able to leave the system faster since they will ?nish ?rst.c. Multilevel feedback queues work similar to the RR algorithm they discriminate favorably toward short jobs.木有中文答案7.7 Show that, if the wait and signal

46、operations are not executed atomically, then mutual exclusion may be violated.木有答案7.8 The Sleeping-Barber Problem. A barbershop consists of a waiting room with n chairs and thebarber room containing the barber chair. If there are no customers to be served,the barber goes to sleep. If a customer ente

47、rs the barbershop and all chairs are occupied, then the customer leaves the shop.If the barber is busy but chairs are available, then the customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the barber. Write a program to coordinate the barber and the customers.理发师

48、和顾客同步,理发师必须由顾客唤醒,理发师给一个顾客理发完,要让理发完的顾客退出,让等待顾客进入,顾客互斥的占用n 个位置/ 共享变量semaphore Scuthair, Snumchair;/ Scuthair 制约理发师 , Snumchair 制约顾客 Scuthair=0; Snumchair=0;barber:do wait(Scuthair);/ 检查是否有顾客,无就睡眠给某个顾客理发8signal(Snumchair);/ 让理发完的顾客退出,让等待的一个顾客进入 while (1);Customer i:wait(Snumchair);/ 申请占用椅子signal(Scutha

49、ir);/ 给理发师发一个信号坐在椅子上等着理发/ 共享变量semaphore Scuthair, Mutexchair;/ Scuthair 给理发师 , Mutexchair 制约顾客对椅子的互斥占领 int number = 0;/ 顾客的共享变量,记录已经有的顾客数Scuthair=0; Mutexchair =1;Customer i:wait(Mutexchair);/ 申请对共享变量number 的操作(申请占用椅子)if(number = = n-1)signal(Mutexchair); exit;number = number +1;signal(Scuthair);/ 给

50、理发师发一个信号signal(Mutexchair);等待理发 理发完毕 wait(Mutexchair);/ 申请对共享变量number 的操作number = number -1;signal(Mutexchair);离开理发店barber:do wait(Scuthair);/ 检查是否有顾客,无,就睡眠给某个顾客理发 while (1);8.2 Is it possible to have a deadlock involving only one single process? Explain your answer.No. This follows directly from th

51、e hold-and-wait condition.8.4 Consider the traffic deadlock depicted in Figure 8.11.a. Show that the four necessary conditions for deadlock indeed hold in this example.b. State a simple rule that will avoid deadlocks in this system.98.13Consider the following snapshot of a system:AllocationMaxAvaila

52、bleABCDABCDABCDP0001200121520P110001750P213542356P306320652P400140656Answer the following questions using the banker s algorithm:a. What is the content of the matrix Need?b. Is the system in a safe state?c. If a request from process P1 arrives for (0,4,2,0), can the request be granted immediately?a.

53、 Deadlock cannot occur because preemption exists.b. Yes. A process may never acquire all the resources it needs if they are continuously preempted by a series of requests such as those of process C.a. Need = Max Allocation0000075010020020100642b.安全算法找安全序列c.先请求算法,再安全算法找安全序列,如果安全,请求可以响应。9.5 Given memo

54、ry partitions of 100K, 500K, 200K, 300K, and 600K (in order), how would eachof the First-fit, Best-fit, and Worst-fit algorithms place processes of 212K, 417K, 112K, and 426K (in order)? Which algorithm makes the most efficient use of memory?a. First- ?t:b. 212K is put in 500K partitionc. 417K is pu

55、t in 600K partitiond. 112K is put in 288K partition (new partition 288e. 426K must waitf. Best- ?t:g. 212K is put in 300K partitionh. 417K is put in 500K partitioni. 112K is put in 200K partitionj. 426K is put in 600K partitionk. Worst- ?t:l. 212K is put in 600K partitionm. 417K is put in 500K parti

56、tionn. 112K is put in 388K partitiono. 426K must waitIn this example, Best- ?t turns out to be the best.First fit212 -500(288)417 -600(183)112 -288426 -none Best fit212 -300417 -500112 -200426 -600Worst fit212 -600(388)417 -500112 -388426 -none9.8 Consider a logical address space of eight pages of 1

57、024 words each, mapped onto a physical memory of 32 frames.a. How many bits are there in the logical address?b. How many bits are there in the physical address?a. Logical address: 13 bitsb. Physical address: 15 bits119.16 Consider the following segment table:SegmentBaseLength021960012300142901003132

58、75804195296What are the physical addresses for the following logical addresses?a. 0,430b. 1,10c. 2,500d. 3,400e. 4,112a. 219 + 430 = 649b. 2300 + 10 = 2310c. illegal reference, trap to operating systemd. 1327 + 400 = 1727e. illegal reference, trap to operating systema. 430600, 219+430 = 649b. 10100,

59、 illegald. 40096, illegal10.2 Assume that you have a page reference string for a process with m frames (initially all empty). The page reference string has length p with n distinct page numbers occur in it. For any page-replacement algorithms,a. What is a lower bound on the number of page faults?b.

60、What is an upper bound on the number of page faults?a. nb. p10.11 Consider the following page reference string:1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, six, or seven frames? Remember all frames are initially empty, so your first unique pages will all cost one fault each.LRU replacementFIFO rep

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!