操作系统答案解析
计算机操作系统课后题答案(高等教育出版社)

练习题(一)Ⅰ问答题1. 操作系统的两个主要目标是什么?答:方便性与有效性。
2. 试说明操作系统与硬件、其它系统软件以及用户之间的关系?答:与硬件的关系:操作系统是位于硬件层上的第一层软件,它直接管理着计算机的硬件,合理组织计算机工作流程,并提高了硬件的利用率。
与其他系统软件的关系:操作系统是系统软件,但它不同于其它系统软件和应用软件,它为其它系统软件和应用软件提供接口。
应用软件要使用操作系统所提供的服务方可方便使用计算机。
与用户之间的关系:操作系统是为改善人机界面、提供各种服务,为用户使用计算机提供良好运行环境的一种系统软件。
3. 试论述操作系统是建立在计算机硬件平台上的虚拟计算机系统。
答:没有任何软件支持的计算机称为裸机,即使其硬件功能再强,也必定是难于使用的。
而实际呈现在用户面前的计算机系统是经过若干层软件改造的计算机。
裸机位于最里层,它的外面是操作系统,经过操作系统提供的资源管理功能和方便用户的各种服务功能,将裸机改造成功能更强、使用更方便的机器,通常把覆盖了软件的机器称为扩充机器,又称之为虚拟机(Virtual Machine ),这样的计算机系统是概念上和逻辑上的计算机,不是物理上的真实计算机。
4. 什么是操作系统?它有哪些基本功能与基本特征?答:操作系统是位于硬件层之上,所有其它软件层之下的一种系统软件,它控制和管理计算机系统资源、合理组织计算机工作流程、提供用户与计算机系统之间的接口。
操作系统的基本功能有:处理器管理、存储器管理、设备管理、文件管理和提供用户接口。
操作系统的基本特征有:并发性、共享性、虚拟性和不确定性。
5. 请叙述并发和并行两个概念的区别?答:并发性是指两个或多个程序在同一时间段内同时执行,是宏观上的同时。
而并行性是从硬件意义上考虑,是不同硬件部件(如CPU与I/O)在同一时刻的并行,即微观上,多个程序也是同时执行的。
6. 什么是多道程序设计? 在操作系统中使用这种技术有什么好处?答:多道程序设计是指在计算机内存中同时存放若干道已开始运行尚未结束的程序,它们交替运行,共享系统中的各种硬、软件资源,从而使处理机得到充分利用。
操作系统课后部分习题及答案

第2章操作系统的运行环境2.2 现代计算机为什么设置目态/管态这两种不同的机器状态?现在的lntel80386设置了四级不同的机器状态(把管态又分为三个特权级),你能说出自己的理解吗?答:现在的Intel 80386把执行全部指令的管态分为三个特权级,再加之只能执行非特权指令的目态,这四级不同的机器状态,按照系统处理器工作状态这四级不同的机器状态也被划分管态和目态,这也完全符合处理器的工作状态。
2.6 什么是程序状态字?主要包括什么内容?答:如何知道处理器当前处于什么工作状态,它能否执行特权指令,以及处理器何以知道它下次要执行哪条指令呢?为了解决这些问题,所有的计算机都有若干的特殊寄存器,如用一个专门的寄存器来指示一条要执行的指令称程序计数器PC,同时还有一个专门的寄存器用来指示处理器状态的,称为程序状态字PSW。
主要内容包括所谓处理器的状态通常包括条件码--反映指令执行后的结果特征;中断屏蔽码--指出是否允许中断,有些机器如PDP-11使用中断优先级;CPU的工作状态--管态还是目态,用来说明当前在CPU上执行的是操作系统还是一般用户,从而决定其是否可以使用特权指令或拥有其它的特殊权力。
2.11 CPU如何发现中断事件?发现中断事件后应做什么工作?答:处理器的控制部件中增设一个能检测中断的机构,称为中断扫描机构。
通常在每条指令执行周期内的最后时刻中扫描中断寄存器,询为是否有中断信号到来。
若无中断信号,就继续执行下一条指令。
若有中断到来,则中断硬件将该中断触发器内容按规定的编码送入程序状态字PSW的相应位(IBM-PC中是第16~31位),称为中断码。
发现中断事件后应执行相中断处理程序,先由硬件进行如下操作:1、将处理器的程序状态字PSW压入堆栈2、将指令指针IP(相当于程序代码段落的段内相对地址)和程序代码段基地址寄存器CS的内容压入堆栈,以保存被子中断程序的返回地址。
3、取来被接受的中断请求的中断向量地址(其中包含有中断处理程序的IP,CS的内容),以便转入中断处理程序。
操作系统第九版部分课后作业习题答案分析解析

CHAPTER 9 Virtual Memory Practice Exercises9.1 Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs.Answer:A page fault occurs when an access to a page that has not beenbrought into main memory takes place. The operating system veri?esthe memory access, aborting the program if it is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the process table and page table are updated and the instruction is restarted.9.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;n distinct page numbers occur in it. Answer these questions for anypage-replacement algorithms:a. What is a lower bound on the number of page faults?b. What is an upper bound on the number of page faults?Answer:a. nb. p9.3 Consider the page table shown in Figure 9.30 for a system with 12-bit virtual and physical addresses and with 256-byte pages. The list of freepage frames is D, E, F (that is, D is at the head of the list, E is second,and F is last).Convert the following virtual addresses to their equivalent physicaladdresses in hexadecimal. All numbers are given in hexadecimal. (Adash for a page frame indicates that the page is not in memory.)? 9EF? 1112930 Chapter 9 Virtual Memory? 700? 0FFAnswer:? 9E F - 0E F? 111 - 211? 700 - D00? 0F F - EFF9.4 Consider the following page-replacement algorithms. Rank thesealgorithms on a ?ve-point scale from “bad” to “perfect” according to the page-fault rate. Separate those algorithms that suffer from Belady’sanomaly from those that do not.a. LRU replacementb. FIFO replacementc. Optimal replacementd. Second-chance replacementAnswer:Rank Algorithm Suffer from Belady’s anomaly1 Optimal no2 LRU no3 Second-chance yes4 FIFO yes9.5 Discuss the hardware support required to support demand paging. Answer:For every memory-access operation, the page table needs to be consulted to check whether the corresponding page is resident or not and whetherthe program has read or write privileges for accessing the page. These checks have to be performed in hardware. A TLB could serve as a cache and improve the performance of the lookup operation.9.6 An operating system supports a paged virtual memory, using a central processor with a cycle time of 1 microsecond. It costs an additional 1 microsecond to access a page other than the current one. Pages have 1000 words, and the paging device is a drum that rotates at 3000 revolutionsper minute and transfers 1 million words per second. The following statistical measurements were obtained from the system:page other than the? 1 percent of all instructions executed accessed acurrent page.?Of the instructions that accessed another page, 80 percent accesseda page already in memory.Practice Exercises 31?When a new page was required, the replaced page was modi?ed 50 percent of the time.Calculate the effective instruction time on this system, assuming that the system is running one process only and that the processor is idle during drum transfers.Answer:(2 sec)(1sec + 0.008 ×effective access time = 0.99 ×(10,000 sec + 1,000 sec)+ 0.002 ×(10,000 sec + 1,000 sec)+ 0.001 ×9.7 Consider the two-dimensional array A:int A[][] = new int[100][100];where A[0][0] is at location 200 in a paged memory system with pages of size 200. A small process that manipulates the matrix resides in page 0 (locations 0 to 199). Thus, every instruction fetch will be from page 0. For three page frames, how many page faults are generated bythe following array-initialization loops, using LRU replacement andassuming that page frame 1 contains the process and the other two are initially empty?a. for (int j = 0; j < 100; j++)for (int i = 0; i < 100; i++)A[i][j] = 0;b. for (int i = 0; i < 100; i++)for (int j = 0; j < 100; j++)A[i][j] = 0;Answer:a. 5,000b. 509.8 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, ?ve, six, or seven frames? Remember all frames are initially empty, so your ?rst unique pages will all cost one fault each.?LRU replacement? FIFO replacement?Optimal replacement32 Chapter 9 Virtual MemoryAnswer:Number of frames LRU FIFO Optimal1 20 20 202 18 18 153 15 16 114 10 14 85 8 10 76 7 10 77 77 79.9 Suppose that you want to use a paging algorithm that requires a referencebit (such as second-chance replacement or working-set model), butthe hardware does not provide one. Sketch how you could simulate a reference bit even if one were not provided by the hardware, or explain why it is not possible to do so. If it is possible, calculate what the cost would be.Answer:You can use the valid/invalid bit supported in hardware to simulate the reference bit. Initially set the bit to invalid. On ?rst reference a trap to the operating system is generated. The operating system will set a software bit to 1 and reset the valid/invalid bit to valid.9.10 You have devised a new page-replacement algorithm that you thinkmaybe optimal. In some contorte d test cases, Belady’s anomaly occurs. Is thenew algorithm optimal? Explain your answer.Answer:No. An optimal algorithm will not suffer from Belady’s anomaly beca an optimal algorithm replaces the page that will not—by de?nition—be used for the longest time. Belady’s anomaly occurs when a pagereplacement a lgorithm evicts a page that will be needed in theimmediatefuture. An optimal algorithm would not have selected such a page.9.11 Segmentation is similar to paging but usesnevariable-sized“pages.”De?two segment-replacement algorithms based on FIFO and LRU pagereplacement s chemes. Remember that since segments are not thesamesize, the segment that is chosen to be replaced may not be big enoughto leave enough consecutive locations for the needed segment. Considerstrategies for systems where segments cannot be relocated, and thosefor systems where they can.Answer:a. FIFO. Find the ?rst segment large enough to accommodate theincoming segment. If relocation is not possible and no one segmentis large enough, select a combination of segments whose memoriesare contiguous, which are “closest to the ?rst of the list” and which can accommodate the new segment. If relocation is possible,rearrange the memory so that the ?rstNsegments large enough forthe incoming segment are contiguous in memory. Add any leftoverspace to the free-space list in both cases.Practice Exercises 33b. LRU. Select the segment that has not been used for the longestperiod of time and that is large enough, adding any leftover spaceto the free space list. If no one segment is large enough, selecta combination of the “oldest” segments that are contiguous inmemory (if relocation is not available) and that are large enough.If relocation is available, rearrange the oldest N segments to becontiguous in memory and replace those with the new segment.9.12 Consider a demand-paged computer system where the degree of multiprogramming is currently ?xed at four. The system was recentlymeasured to determine utilization of CPU and the paging disk. The resultsare one of the following alternatives. For each case, what is happening?Can the degree of multiprogramming be increased to increase the CPU utilization? Is the paging helping?a. CPU utilization 13 percent; disk utilization 97 percentb. CPU utilization 87 percent; disk utilization 3 percentc. CPU utilization 13 percent; disk utilization 3 percentAnswer:a. Thrashing is occurring.b. CPU utilization is suf?ciently high to leave things alone, andincrease degree of multiprogramming.c. Increase the degree of multiprogramming.9.13 We have an operating system for a machine that uses base and limit registers, but we have modi?ed the ma chine to provide a page table.Can the page tables be set up to simulate base and limit registers? How can they be, or why can they not be?Answer:The page table can be set up to simulate base and limit registers provided that the memory is allocated in ?xed-size segments. In this way, the base of a segment can be entered into the page table and the valid/invalid bit used to indicate that portion of the segment as resident in the memory. There will be some problem with internal fragmentation.9.27.Consider a demand-paging system with the following time-measured utilizations:CPU utilization 20%Paging disk 97.7%Other I/O devices 5%Which (if any) of the following will (probably) improve CPU utilization? Explain your answer.a. Install a faster CPU.b. Install a bigger paging disk.c. Increase the degree of multiprogramming.d. Decrease the degree of multiprogramming.e. Install more main memory.f. Install a faster hard disk or multiple controllers with multiple hard disks.g. Add prepaging to the page fetch algorithms.h. Increase the page size.Answer: The system obviously is spending most of its time paging, indicating over-allocationof memory. If the level of multiprogramming is reduced resident processeswould page fault less frequently and the CPU utilization would improve. Another way toimprove performance would be to get more physical memory or a faster paging drum.a. Get a faster CPU—No.b. Get a bigger paging drum—No.c. Increase the degree of multiprogramming—No.d. Decrease the degree of multiprogramming—Yes.e. Install more main memory—Likely to improve CPU utilization as more pages canremain resident and not require paging to or from the disks.f. Install a faster hard disk, or multiple controllers with multiple hard disks—Also animprovement, for as the disk bottleneck is removed by faster response and morethroughput to the disks, the CPU will get more data more quickly.g. Add prepaging to the page fetch algorithms—Again, the CPU will get more datafaster, so it will be more in use. This is only the case if the paging actionis amenableto prefetching (i.e., some of the access is sequential).h. Increase the page size—Increasing the page size will result in fewer page faults ifdata is being accessed sequentially. If data access is more or less random, morepaging action could ensue because f ewer pages c an be kept in memory and moredata is transferred per page fault. So this change is as likely to decrease utilizationas it is to increase it.10.1、Is disk scheduling, other than FCFS scheduling, useful in a single-userenvironment? Explain your answer.Answer: In a single-user environment, the I/O queue usually is empty. Requests g enerally arrive from a single process for one block or for a sequence of consecutive blocks. In these cases, FCFS is an economical method of disk scheduling. But LOOK is nearly as easy to program and will give much better performance when multiple processes are performing concurrent I/O, such as when aWeb browser retrieves data in the background while the operating system is paging and another application is active in the foreground.10.2.Explain why SSTF scheduling tends to favor middle cylindersover theinnermost and outermost cylinders.The center of the disk is the location having the smallest average distance to all other tracks.Thus the disk head tends to move away from the edges of the disk.Here is another way to think of it.The current location of the head divides the cylinders into two groups.If the head is not in the center of the disk and a new request arrives,the new request is more likely to be in the group that includes the center of the disk;thus,the head is more likely to move in that direction.10.11、Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143, and the previous request was at cylinder 125. The queue of pending requests, in FIFO order, is86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests, for each of the following disk-scheduling algorithms?a. FCFSb. SSTFc. SCANd. LOOKe. C-SCANAnswer:a. The FCFS schedule is 143, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130. The total seek distance is 7081.b. The SSTF schedule is 143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774. The total seek distance is 1745.c. The SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86. The total seek distance is 9769.d. The LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86. The total seek distance is 3319.e. The C-SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 86, 130. The total seek distance is 9813.f. (Bonus.) The C-LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 86, 130. The total seek distance is 3363.12CHAPTERFile-SystemImplementationPractice Exercises12.1 Consider a ?le currently consisting of 100 blocks. Assume that the?lecontrol block (and the index block, in the case of indexed allocation)is already in memory. Calculate how many disk I/O operations are required for contiguous, linked, and indexed (single-level) allocation strategies, if, for one block, the following conditions hold. In the contiguous-allocation case, assume that there is no room to grow atthe beginning but there is room to grow at the end. Also assume thatthe block information to be added is stored in memory.a. The block is added at the beginning.b. The block is added in the middle.c. The block is added at the end.d. The block is removed from the beginning.e. The block is removed from the middle.f. The block is removed from the end.Answer:The results are:Contiguous Linked Indexeda. 201 1 1b. 101 52 1c. 1 3 1d. 198 1 0e. 98 52 0f. 0 100 012.2 What problems could occur if a system allowed a ?le system to be mounted simultaneously at more than one location?Answer:4344 Chapter 12 File-System ImplementationThere would be multiple paths to the same ?le, which could confuse users or encourage mistakes (deleting a ?le with one path deletes the?le in all the other paths).12.3 Why must the bit map for ?le allocation be kept on mass storage, ratherthan in main memory?Answer:In case of system crash (memory failure) the free-space list would not be lost as it would be if the bit map had been stored in main memory.12.4 Consider a system that supports the strategies of contiguous, linked, and indexed allocation. What criteria should be used in deciding which strategy is best utilized for a particular ?le?Answer:?Contiguous—if ?le is usually accessed sequentially, if ?le isrelatively small.?Linked—if ?le is large and usually accessed sequentially.? Indexed—if ?le is large and usually accessed randomly.12.5 One problem with contiguous allocation is that the user must preallocate enough space for each ?le. If the ?le grows to be larger than thespace allocated for it, special actions must be taken. One solution to this problem is to de?ne a ?le structure consisting of an initial contiguousarea (of a speci?ed size). If this area is ?lled, the operating system automatically de?nes an over?ow area that is linked to the initial contiguous area. If the over?ow area is ?lled, another over?ow areais allocated. Compare this implementation of a ?le with the standard contiguous and linked implementations.Answer:This method requires more overhead then the standard contiguousallocation. It requires less overheadthan the standard linked allocation.12.6 How do caches help improve performance? Why do systems not use more or larger caches if they are so useful?Answer:Caches allow components of differing speeds to communicate moreef?ciently by storing data from the slower device, temporarily, ina faster device (the cache). Caches are, almost by de?nition, moreexpensive than the device they are caching for, so increasing the numberor size of caches would increase system cost.12.7 Why is it advantageous for the user for an operating system to dynamically allocate its internal tables? What are the penalties to the operating system for doing so?Answer:tablesDynamic tables allow more ?exibility in system use growth —are never exceeded, avoiding arti?cial use limits. Unfortunately, kernel structures and code are more complicated, so there is more potentialfor bugs. The use of one resource can take away more system resources (by growing to accommodate the requests) than with static tables.Practice Exercises 4512.8 Explain how the VFS layer allows an operating system to support multiple types of ?le systems easily.Answer:VFS introduces a layer of indirection in the ?le system implementation. In many ways, it is similar to object-oriented programming techniques. System calls can be made generically (independent of ?le system type). Each ?le system type provides its function calls and data structuresto the VFS layer. A system call is translated into the proper speci?c functions for the target ?le system at the VFS layer. The calling program has no ?le-system-speci?c code, and the upper levels of the system call structures likewise are ?le system-independent. The translation at the VFS layer turns these generic calls into ?le-system-speci?c operations.。
操作系统课后习题答案

1.什么是操作系统?其主要功能是什么?操作系统是控制和管理计算机系统内各种硬件和软件资源,有效组织多道程序运行的系统软件(或程序集合),是用户和计算机直接的程序接口.2.在某个计算机系统中,有一台输入机和一台打印机,现有两道程序投入运行,程序A、B 同时运行,A略早于B。
A的运行轨迹为:计算50ms、打印100ms、再计算50ms、打印100ms,结束。
B的运行轨迹为:计算50ms、输入80ms、再计算100ms,结束。
试说明:(1)两道程序运行时,CPU是否空闲等待?若是,在那段时间段等待?(2)程序A、B是否有等待CPU的情况?若有,指出发生等待的时刻。
0 50 100 150 200 250 30050 100 50 10050 100 20 100(1) cpu有空闲等待,在100ms~150ms的时候.(2) 程序A没有等待cpu,程序B发生等待的时间是180ms~200ms.1.设公共汽车上,司机和售票员的活动如下:司机的活动:启动车辆;正常行车;到站停车。
售票员的活动:关车门;售票;开车门。
在汽车不断的到站、停车、行驶过程中,用信号量和P、V操作实现这两个活动的同步关系。
semaphore s1,s2;s1=0;s2=0;cobegin司机();售票员();coendprocess 司机(){while(true){P(s1) ;启动车辆;正常行车;到站停车;V(s2);}}process 售票员(){while(true){关车门;V(s1);售票;P(s2);开车门;上下乘客;}}2.设有三个进程P、Q、R共享一个缓冲区,该缓冲区一次只能存放一个数据,P进程负责循环地从磁带机读入数据并放入缓冲区,Q进程负责循环地从缓冲区取出P进程放入的数据进行加工处理,并把结果放入缓冲区,R进程负责循环地从缓冲区读出Q进程放入的数据并在打印机上打印。
请用信号量和P、V操作,写出能够正确执行的程序。
操作系统习题与解答(含答案)

操作系统习题与解答(含答案)第⼀章操作系统引论⼀、选择题1.在计算机系统中配置操作系统的主要⽬的是(),操作系统的主要功能是管理计算机系统中的(),其中包括()管理和()管理,以及设备管理和⽂件管理。
这⾥的()管理主要是对进程进⾏管理。
(1)A.增强计算机系统的功能;B.为了使⽤系统的资源;C.提⾼系统的运⾏速度;D.提⾼系统使⽤效率,合理地组织系统的⼯作流程,以提⾼系统吞吐量。
(2)A.程序和数据;B.进程;C.资源;D.作业;E.任务。
(3)(4)A.存储器;B.虚拟存储器;C.运算器;D.处理机;E.控制器。
2.操作系统有多种类型:(1)允许多个⽤户以交互⽅式使⽤计算机的操作系统,称为();(2)允许多⽤户将若⼲个作业提交给计算机系统集中处理的操作系统称为();(3)在()的控制下,计算机系统能及时处理由过程控制反馈的数据,并做出响应。
A.批处理操作系统;B.分时操作系统;C.实时操作系统;D.微机操作系统;E.多处理机操作系统。
3.在下列性质中,哪⼀个不是分时系统的特征。
()A.交互性B.多路性C.成批性D.独占性4.实时操作系统追求的⽬标是()。
A.⾼吞吐率B.充分利⽤内存C.快速响应D.减少系统开销5. 现代操作系统的两个基本特征是()和资源共享A.多道程序设计B.中断处理C.程序的并发执⾏D.实现分时与实时处理6.引⼊多道程序的⽬的在于()。
A.有利于代码共享,减少主、辅存信息交换量。
B.提⾼实时响应速度。
C.充分利⽤CPU,减少CPU等待时间D.充分利⽤存储器7.操作系统是⼀组().A.⽂件管理程序B.中断处理程序C.资源管理程序D.设备管理程序8.()不是操作系统关⼼的主要问题.A.管理计算机裸机B.设计、提供⽤户程序与计算机硬件系统的界⾯C.管理计算机系统资源D.⾼级程序设计语⾔的编译器9.⽤户在⼀次计算机过程中,或者⼀次事物处理中,要求计算机完成所做的⼯作的集合,这是指().A.进程B.程序C.作业D.系统调⽤10.订购机票系统处理各⾃各个终端的服务请求,处理后通过终端回答⽤户,所以它是⼀个()。
操作系统练习试卷6(题后含答案及解析)

操作系统练习试卷6(题后含答案及解析)题型有:1. 选择题选择题(每小题1分,共60分)下列各题A、B、C、D四个选项中,只有一个选项是正确的,请将正确选项涂写在答题卡相应位置上。
1.以下有关强迫性中断事件的叙述中,哪一个是不正确的? ( )A.输入输出中断是来自通道或者各种外部设备的中断,用于反映通道或设备的工作情况B.硬件故障中断是机器发生错误时产生的中断C.时钟中断是软件时钟到时而引起的中断D.程序性中断是正在运行程序中有意安排而引起的中断正确答案:D 涉及知识点:操作系统2.文件的存取方式是由文件的性质和用户使用文件的情况而确定的,一般有两种存取方式,它们是( )。
A.直接存取和间接存取B.顺序存取和随机存取C.只读存取和读写存取D.顺序存取和链接存取正确答案:B 涉及知识点:操作系统3.文件系统的多级目录结构是一种( )。
A.线性结构B.树形结构C.散列结构D.双链表结构正确答案:B 涉及知识点:操作系统4.若构成文件的基本单位是字符,这一类文件称为( )。
A.流式文件B.记录式文件C.顺序文件D.索引文件正确答案:A 涉及知识点:操作系统5.操作系统是计算机系统的一种系统软件,是配置在计算机硬件上的第一层软件,为用户与计算机硬件系统之间提供接口,同时管理着系统的( )。
A.硬件B.软件C.设备D.资源正确答案:D 涉及知识点:操作系统6.分时操作系统在系统性能方面希望达到的目标是( )。
A.高吞吐率B.充分利用内存C.及时响应D.减少系统开销正确答案:C 涉及知识点:操作系统7.CPU状态分为目态和管态两种,从目态转换到管态的惟一途径是( )。
A.运行进程修改程序状态字B.中断屏蔽C.中断D.进程调度程序正确答案:C解析:可以将CPU设置两种状态,管态是指程序执行时可使用包括特权指令在内的一切指令。
目态是指程序执行时不可使用特权指令。
目态转换为管态是依赖于中断机制,管态转换为目态可通过修改程序状态字实现。
操作系统练习题及答案知识讲解

一、填空P15 填空题1.设计现代OS的主要目的是提高资源利用率和方便用户。
2.单道批处理系统是在解决人机矛盾和CPU与I/O设备速度不匹配的矛盾中发展起来的。
3.在单处理机环境下的多道程序设计具有多道、宏观上同时运行和微观上交替运行的特点。
4.现在操作系统的两个最基本的特征是并发和资源共享,除此之外,它还具有虚拟性和异步性的特征。
5.从资源管理的角度看,操作系统具有四大功能:处理机管理、存储器管理、设备管理和文件管理;为了方便用户,操作系统还必须提供友好的用户接口。
6.操作系统的基本类型主要有批处理系统、分时系统和实时系统。
7.批处理系统的主要优点是资源利用率高和系统吞吐量大;主要缺点是无交互作用能力和作业平均周转时间长。
8.实现分时系统的关键问题他是人机交互,为此必须引入时间片的概念,并采用时间片轮转调度算法。
9.分时系统的基本特征是多路性、独立性、交互性和及时性。
10.若干事件在同一时间间隔内发生称为并发;若干事件在同一时刻发生称为并行。
11.实时系统可分为实时信息处理系统和实时控制系统两种类型;民航销售系统属于实时信息处理系统;而导弹飞行控制系统则属于实时控制系统。
12.为了使实时系统高度可靠和安全,通常不强求资源利用率。
13.当前比较流行的微内核的操作系统结构,是建立在层次化结构的基础上的,而且还采用了客户机/服务器模式和面向对象程序设计技术。
P56 填空题1.在单用户单任务环境下,用户独占全机,此时机内资源的状态,只能由运行程序的操作加以改变,此时的程序执行具有封闭性和可再现性特征。
2.并发程序之间的相互制约,是由于它们的共享资源和相互合作而产生的,因而导致程序在并发执行时具有间断性或异步性特征。
3.程序并发执行与顺序执行时相比产生了一些新特征,分别是间断性、失去封闭性和不可再现性。
4.引入进程的目的是使程序能正确地并发执行,以提高资源利用率和系统吞吐量,而引入线程的目的是减少并发执行的开销,提高程序执行的并发程度。
操作系统(第二版)课后习题答案

故需要一次间接寻址,就可读出该数据
如果要求读入从文件首到263168Byte处的数据(包括这个数据),读岀过程:首先根据直接寻
址读出前10块;读出一次间接索引指示的索引块1块;将索引下标从0〜247对应的数据块全部 读入。即可。共读盘块数10+1+248=259块
3.某文件系统采用索引文件结构,设文件索引表的每个表目占用3Byte,存放盘块的块号,盘块 的大小为512Byte。此文件系统采用直接、一次间接、二次间接、三次间接索引所能管理的最大
(1)|100-8|+|18-8|+|27-18|+|129-27|+|110-129|+|186-110|+|78-186|+|147-78|+|41-147|+ |10-47|+|64-10|+|12-64|=728
8:00
10:00
120mi n
1
2
8:50
50min
10:00
10:50
120mi n
3
9:00
10mi n
10:50
11:00
120mi n
12
4
9:50
20mi n
11:00
11:20
90mi n
平均周转时间T=,平均带权周转时间W=
②SJF短作业优先法)
作业
到达时间
运行时间
开始时间
完成时间
周转时间
页面长度为4KB,虚地址空间共有土)个页面
3.某计算机系统提供24位虚存空间,主存空间为218Byte,采用请求分页虚拟存储管理,页面尺
寸为1KB。假定应用程序产生虚拟地址(八进制),而此页面分得的块号为100(八进制),说明
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1.1什么是操作系统?用自己的话谈谈你对操作系统概念的认识与理解。
一、我的定义:计算机系统可分为四个部分:硬件、操作系统、应用程序和用户,操作系统是其中最重要的一部分。
此外,操作系统也是系统软件中的第一软件。
它管理和控制计算机系统中的硬件及软件资源、合理的组织计算机工作流程,以便有效利用这个资源为用户提供一个功能强大、使用方便和可扩充的工作环境,从而在计算机和用户之间起到接口作用。
操作系统在计算机系统中充当计算机硬件系统与应用程序之间的界面,所以,操作系统既面向系统资源又面向用户。
面向系统资源,操作系统必须尽可能提高资源利用率;面向用户,操作系统必须提供方便易用的用户界面。
(1)系统方面:操作系统是对计算机资源管理;这些资源包括硬件和软件。
操作系统向用户提供了高级而调用简单的服务,掩盖了绝大部分硬件设备复杂的特性和差异,使得用户可以免除大量的乏味的杂务,而把精力集中在自己所要处理的任务上。
(2)软件方面:操作系统是程序和数据结构的集合。
操作系统是直接和硬件相邻的第一层软件,它是大量极其复杂的系统程序和众多的数据结构集成的。
(3)用户方面:操作系统是用户使用计算机的界,是用户与计算机硬件之间的接口,一般可以分为三种:命令方式,系统调用,图形界面。
二、它的功能:操作系统具有五大管理功能,即文件管理、存储管理、
信息管理、设备管理和处理机管理此外,操作系统还具有提供良好用户界面的功能,因为操作系统是计算机与用户之间的接口,最终是用户在使用计算机,所以它必须为用户提供一个良好的用户界面。
用户界面的好坏是直接关系到操作系统能否得到用户认可的一个不容忽略的关键问题。
界面主要有三种:命令界面、程序界面和图形界面。
1.文件管理
操作系统的文件管理子系统是最接近用户的部分,它给用户提供一个方便、快捷、可以共享、同时又提供保护的对文件的使用环境。
2.存储管理
存储管理涉及系统另一个紧俏资源——内存,它一方面要为系统进程及各个用户进程提供其运行所需要的内存空间,另一方面还要保证各用户
进程之间互不影响,此外,还要保证用户进程不能破坏系统进程,提供内
存保护。
3.信息管理
主要解决内存分配、保护和扩充的问题;
4.设备管理
主要是对计算机系统中的输入输出等各种设备的分配、回收、调度和控制,以及输入输出等操作;
5.处理机管理
操作系统处理机管理模块的主要任务是确定对处理机的分配策略,实施对进程或线程的调度和管理。
三、它的种类:计算机上使用的操作系统的种类很多,但基本
类型可划分为三类:批处理操作系统、分时操作系统、实时操作系统。
此外还有网络操作系统、分布式操作系统、个人操作系统等等
四、它的特性:操作系统有以下五方面特性
1.可靠性
系统可靠性是指系统发现、诊断、恢复硬件或软件故障的能力,也包括对用户误操作的容错能力。
可靠性是用户所看重的重要性能。
2.方便性
随着计算机的普及,人们对易用性要求越来越重视,它涉及计算机系统使用的简单性、可操作性、可携带性等等。
系统的人性化设计越来越受到人们的重视。
3.高效率
追求高效率和方便用户是操作系统的宗旨,操作系统应使系统资源尽可能高效地得到应用。
4.可扩充性
操作系统的功能应该不断被加强、被改进、被完善。
在引进新的系统组件时不应干扰现有的服务能力,从而能够适应不断发展的应用需求。
5.开放性
为了能够集成不同厂家生产的计算机及其设备,且能正确有效地协同工作,支持应用程序的可移植性和互操作性,要求操作系统具有开放性。
五、它的分层原则:
1.被调用功能在低层:如文件系统管理--设备管理--设备驱动程
序
2.活跃功能在低层:提高运行效率
3.资源管理的公用模块放在最低层:如缓冲区队列、堆栈操作
4.存储器管理放在次低层:便于利用虚拟存储功能
5.最低层的硬件抽象层:与机器特点紧密相关的软件放在最低层。
如
Windows NT中的HAL--单处理、多处理
6.资源分配策略和外壳放在最外层,便于修改或适应不同环境
(完)。