操作系统习题解析
- 格式:doc
- 大小:51.50 KB
- 文档页数:9
操作系统习题解答1.存储程序式计算机的主要特点是什么?答:主要特点是以顺序计算为基础,根据程序规定的顺序依次执行每一个操作,控制部件根据程序对整个计算机的活动实行集中过程控制,即为集中顺序过程控制。
这类计算是过程性的,实际上这种计算机是模拟人们的手工计算的产物。
即首先取原始数据,执行一个操作,将中间结果保存起来;再取一个数,和中间结果一起又执行一个操作,如此计算下去。
在遇到多个可能同时执行的分支时,也是先执行完一个分支,然后再执行第二个分支,直到计算完毕。
2.批处理系统和分时系统各具有什么特点?答:批处理系统是在解决人—机矛盾以及高速度的中央处理机和低速度的I/O设备这两对矛盾的过程中发展起来的。
它的出现改善了CPU和外设的使用情况,其特点是实现了作业的自动定序、自动过渡,从而使整个计算机系统的处理能力得以提高。
在多道系统中,若采用了分时技术,就是分时操作系统,它是操作系统的另一种类型。
它一般采用时间片轮转的办法,使一台计算机同时为多个任务服务。
对用户都能保证足够快的响应时间,并提供交互会话功能。
它与批处理系统之间的主要差别在于,分时系统是人机交互式系统,响应时间快;而批处理系统是作业自动定序和过渡,无人机交互,周转时间长。
3.实时系统的特点是什么?一个实时信息处理系统和一个分时系统从外表看来很相似,它们有什么本质的区别呢?答:实时系统对响应时间的要求比分时系统更高,一般要求响应时间为秒级、毫秒级甚至微秒级。
将电子计算机应用到实时领域,配置上实时监控系统,便组成各种各样的专用实时系统。
实时系统按其使用方式不同分为两类:实时控制系统和实时信息处理系统。
实时控制是指利用计算机对实时过程进行控制和提供监督环境。
实时信息处理系统是指利用计算机对实时数据进行处理的系统。
实时系统大部分是为特殊的实时任务设计的,这类任务对系统的可靠性和安全性要求很高。
与分时系统相比,实时系统没有那样强的交互会话功能,通常不允许用户通过实时终端设备去编写新的程序或修改已有的程序。
操作系统练习题第一章引言(一单项选择题1 操作系统是计算机系统的一种( 。
A.应用软件B. 系统软件c. 通用软件D.工具软件2.操作系统目的是提供一个供其他程序执行的良好环境,因此它必须使计算机( A.使用方便B. 高效工作C.合理使用资源D.使用方便并高效工作3.允许多个用户以交互方式使用计算机的操作系统是( 。
A.分时操作系统B. 批处理单道系统C.实时操作系统D.批处理多道系统4.下列系统中( 是实时系统。
A.计算机激光照排系统B. 办公自动化系统C.化学反应堆控制系统D.计算机辅助设计系统5.操作系统是一种系统软件,它( 。
A.控制程序的执行B. 管理计算机系统的资源C.方便用户使用计算机D.管理计算机系统的资源和控制程序的执行6.计算机系统把进行( 和控制程序执行的功能集中组成一种软件,称为操作系统A.CPU 管理B.作业管理C.资源管理D.设备管理7.批处理操作系统提高了计算机系统的工作效率,但( 。
A.不能自动选择作业执行B. 无法协调资源分配c.不能缩短作业执行时间D 在作业执行时用户不能直接干预8.分时操作系统适用于( 。
A.控制生产流水线B.调试运行程序c.大量的数据处理D.多个计算机资源共享9.在混合型操作系统中,“前台”作业往往是指( 。
A.由批量单道系统控制的作业B.由批量多道系统控制的作业c.由分时系统控制的作业D.由实时系统控制的作业10.在批处理兼分时的系统中,对( 应该及时响应,使用户满意。
A.批量作业B.前台作业c.后台作业D.网络通信11.实时操作系统对可靠性和安全性要求极高,它( 。
A.十分注重系统资源的利用率B.不强调响应速度c.不强求系统资源的利用率D.不必向用户反馈信息12.分布式操作系统与网络操作系统本质上的不同之处在于( 。
A.实现各台计算机之间的通信B.共享网络个的资源c.满足较大规模的应用D.系统中若干台计算机相互协作完成同一任务13.SPOOL技术用于( 。
第一章操作系统概论1、有一台计算机,具有IMB 内存,操作系统占用200KB ,每个用户进程各占200KB 。
如果用户进程等待I/O 的时间为80 % ,若增加1MB 内存,则CPU 的利用率提高多少?答:设每个进程等待I/O 的百分比为P ,则n 个进程同时等待刀O 的概率是Pn ,当n 个进程同时等待I/O 期间CPU 是空闲的,故CPU 的利用率为1-Pn。
由题意可知,除去操作系统,内存还能容纳4 个用户进程,由于每个用户进程等待I/O的时间为80 % , 故:CPU利用率=l-(80%)4 = 0.59若再增加1MB 内存,系统中可同时运行9 个用户进程,此时:cPu 利用率=l-(1-80%)9 = 0.87故增加IMB 内存使CPU 的利用率提高了47 % :87 %/59 %=147 %147 %-100 % = 47 %2 一个计算机系统,有一台输入机和一台打印机,现有两道程序投入运行,且程序A 先开始做,程序B 后开始运行。
程序A 的运行轨迹为:计算50ms 、打印100ms 、再计算50ms 、打印100ms ,结束。
程序B 的运行轨迹为:计算50ms 、输入80ms 、再计算100ms ,结束。
试说明(1 )两道程序运行时,CPU有无空闲等待?若有,在哪段时间内等待?为什么会等待?( 2 )程序A 、B 有无等待CPU 的情况?若有,指出发生等待的时刻。
答:画出两道程序并发执行图如下:(1)两道程序运行期间,CPU存在空闲等待,时间为100 至150ms 之间(见图中有色部分)(2)程序A 无等待现象,但程序B 有等待。
程序B 有等待时间段为180rns 至200ms 间(见图中有色部分)3 设有三道程序,按A 、B 、C优先次序运行,其内部计算和UO操作时间由图给出。
试画出按多道运行的时间关系图(忽略调度执行时间)。
完成三道程序共花多少时间?比单道运行节省了多少时间?若处理器调度程序每次进行程序转换化时lms , 试画出各程序状态转换的时间关系图。
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 verifiesthe 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 any page-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 physical addresses in hexadecimal. All numbers are given in hexadecimal. (A dash 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 these algorithms on a five-point scale from “bad” to “perfect” according to their page-fault rate. Separate those algorithms that suffer from Belady’s anomaly 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 whether the 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 revolutions per minute and transfers 1 million words per second. The following statistical measurements were obtained from the system:• 1 percent of all instructions executed accessed a page other than the current 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 modified 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:effective access time = 0.99 × (1 sec + 0.008 × (2 sec)+ 0.002 × (10,000 sec + 1,000 sec)+ 0.001 × (10,000 sec + 1,000 sec)= (0.99 + 0.016 + 22.0 + 11.0) sec= 34.0 sec9.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 twoare 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, five, six, or seven frames? Remember all frames are initially empty, so your first 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. O n first 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 the new algorithm optimal? Explain your answer.Answer:No. An optimal algorithm will not suffer from Belady’s anomaly because —by definition—an optimal algorithm replaces the page that will notbe used for the long est time. Belady’s anomaly occurs when a pagereplacement algorithm evicts a page that will be needed in the immediatefuture. An optimal algorithm would not have selected such a page.9.11 Segmentation is similar to paging but uses variable-sized“pages.”Definetwo segment-replacement algorithms based on FIFO and LRU pagereplacement schemes. Remember that since segments are not the samesize, the segment that is chosen to be replaced may not be big enoughto leave enough consecutive locations for the needed segment. Consider strategies for systems where segments cannot be relocated, and thosefor systems where they can.Answer:a. FIFO. Find the first segment large enough to accommodate the incoming 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 first of the list” andwhich can accommodate the new segment. If relocation is possible, rearrange the memory so that the firstNsegments large enough forthe incoming segment are contiguous in memory. Add any leftover space 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 be contiguous in memory and replace those with the new segment.9.12 Consider a demand-paged computer system where the degree of multiprogramming is currently fixed at four. The system was recently measured to determine utilization of CPU and the paging disk. The results are 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 sufficiently high to leave things alone, and increase 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 modified 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 fixed-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 action is 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 fewer pages can 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 asingle-userenvironment? Explain your answer.Answer: In a single-user environment, the I/O queue usually is empty. Requests generally 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 file currently consisting of 100 blocks. Assume that the filecontrol 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 file system to be mounted simultaneously at more than one location?Answer:4344 Chapter 12 File-System ImplementationThere would be multiple paths to the same file, which could confuse users or encourage mistakes (deleting a file with one path deletes thefile in all the other paths).12.3 Why must the bit map for file allocation be kept on mass storage, ratherthan in main memory?Answer:In case of system crash (memory failure) the free-space list would notbe 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 file?Answer:•Contiguous—if file is usually accessed sequentially, if file isrelatively small.•Linked—if file is large and usually accessed sequentially.• Indexed—if file is large and usually accessed randomly.12.5 One problem with contiguous allocation is that the user must preallocate enough space for each file. If the file grows to be larger than thespace allocated for it, special actions must be taken. One solution to this problem is to define a file structure consisting of an initial contiguous area (of a specified size). If this area is filled, the operating system automatically defines an overflow area that is linked to the initialc ontiguous area. If the overflow area is filled, another overflow areais allocated. Compare this implementation of a file 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 moreefficie ntly by storing data from the slower device, temporarily, ina faster device (the cache). Caches are, almost by definition, more expensive than the device they are caching for, so increasing the number or 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:Dynamic tables allow more flexibility in system use growth — tablesare never exceeded, avoiding artificial 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 file systems easily.Answer:VFS introduces a layer of indirection in the file system implementation. In many ways, it is similar to object-oriented programming techniques. System calls can be made generically (independent of file system type). Each file system type provides its function calls and data structuresto the VFS layer. A system call is translated into the proper specific functions for the ta rget file system at the VFS layer. The calling program has no file-system-specific code, and the upper levels of the system call structures likewise are file system-independent. The translation at the VFS layer turns these generic calls into file-system-specific operations.。
操作系统习题与解答(含答案)第⼀章操作系统引论⼀、选择题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.订购机票系统处理各⾃各个终端的服务请求,处理后通过终端回答⽤户,所以它是⼀个()。
操作系统-第3章习题解析第三章习题解析1.⾼级调度不低级调度的主要任务是什么?为什么要引⼊中级调度?答:⾼级调度的主要任务是根据某种算法,把外存上处于后备队列中的那些作业调⼊内存。
低级调度是保存处理机的现场信息,按某种算法先取进程,再把处理器分配给进程。
引⼊中级调度的主要⽬的是为了提⾼内存利⽤率和系统吞吐量。
使那些暂时不能运⾏的进程不再占⽤内存资源,将它们调⾄外存等待,把进程状态改为就绪驻外存状态或挂起状态。
2.处理机调度算法的共同⽬标是什么?批处理系统的调度⽬标⼜是什么?答:共同⽬标:资源利⽤率,公平性,平衡性,策略强制执⾏。
批处理系统的调度⽬标:平均周转时间短,系统吞吐量⾼,处理机利⽤率⾼。
3.何谓作业、作业步和作业流?答:作业包含通常的程序和数据,还配有作业说明书。
系统根据该说明书对程序的运⾏进⾏控制。
批处理系统中是以作业为基本单位从外存调⼊内存。
作业步是指每个作业运⾏期间都必须经过若⼲个相对独⽴相互关联的顺序加⼯的步骤。
作业流是指若⼲个作业进⼊系统后依次存放在外存上形成的输⼊作业流;在操作系统的控制下,逐个作业进程处理,于是形成了处理作业流。
4.在什么情况下需要使⽤作业控制块JCB?其中包含了哪些内容?答:每当作业进⼊系统时,系统便为每个作业建⽴⼀个作业控制块JCB,根据作业类型将它插⼊到相应的后备队列中。
JCB包含的内容通常有:1)作业标识 2)⽤户名称 3)⽤户账户 4)作业类型(CPU繁忙型、I/0芳名型、批量型、终端型) 5)作业状态 6)调度信息(优先级、作业已运⾏) 7)资源要求 8)进⼊系统时间 9)、开始处理时间 10)作业完成时间 11)作业退出时间 12)资源使⽤情况等5.在作业调度中应如何确定接纳多少个作业和接纳哪些作业?答:作业调度每次接纳进⼊内存的作业数,取决于多道程序度。
应将哪些作业从外存调⼊内存,取决于采⽤的调度算法。
最简单的是先来服务调度算法,较常⽤的是短作业优先调度算法和基于作业优先级的调度算法。
第一章绪论1.什么是操作系统的基本功能?答:操作系统的职能是管理和控制汁算机系统中的所有硬、软件资源,合理地组织计算机工作流程,并为用户提供一个良好的工作环境和友好的接口。
操作系统的基本功能包括:处理机管理、存储管理、设备管理、信息管理(文件系统管理)和用户接口等。
2.什么是批处理、分时和实时系统?各有什么特征?答:批处理系统(batchprocessingsystem):操作员把用户提交的作业分类,把一批作业编成一个作业执行序列,由专门编制的监督程序(monitor)自动依次处理。
其主要特征是:用户脱机使用计算机、成批处理、多道程序运行。
分时系统(timesharingoperationsystem):把处理机的运行时间分成很短的时间片,按时间片轮转的方式,把处理机分配给各进程使用。
其主要特征是:交互性、多用户同时性、独立性。
实时系统(realtimesystem):在被控对象允许时间范围内作出响应。
其主要特征是:对实时信息分析处理速度要比进入系统快、要求安全可靠、资源利用率低。
3.多道程序(multiprogramming)和多重处理(multiprocessing)有何区别?答;多道程序(multiprogramming)是作业之间自动调度执行、共享系统资源,并不是真正地同时值行多个作业;而多重处理(multiprocessing)系统配置多个CPU,能真正同时执行多道程序。
要有效使用多重处理,必须采用多道程序设计技术,而多道程序设计原则上不一定要求多重处理系统的支持。
6.设计计算机操作系统时与那些硬件器件有关运算器、控制器、存储器、输入设备、输出设备第二章作业管理和用户接口2.作业由哪几部分组成?各有什么功能?答:作业由三部分组成:程序、数据和作业说明书。
程序和数据完成用户所要求的业务处理工作,作业说明书则体现用户的控制意图。
3.作业的输入方式有哪几种?各有何特点答:作业的输入方式有5种:联机输入方式、脱机输入方式、直接耦合方式、SPOOLING(Simultaneous Peripheral OperationsOnline)系统和网络输入方式,各有如下特点:(1)联机输入方式:用户和系统通过交互式会话来输入作业。
操作系统练习题含参考答案一、单选题(共90题,每题1分,共90分)1、在大多数Linux发行版本中,以下哪个属于块设备(blockdevices)?A、硬盘B、打印机C、串行口D、虚拟终端正确答案:A2、在随机存取方式中,用户以______为单位对文件进行存取和检索。
A、数据项B、字节C、逻辑记录D、字符串正确答案:C3、在UNIX系统中获取帮助信息的命令为()。
A、manB、cdC、catD、help正确答案:A4、如何删除一个非空子目录/tmp?A、del/tmp/*B、rm-Ra/tmp/*C、rm-rf/tmpD、rm-rf/tmp/*正确答案:C5、运行一个脚本,用户不需要什么样的权限?A、browseonthedirectoryB、readC、executeD、write正确答案:D6、下列关于批处理操作系统的叙述中错误的是()。
A、“通道”和“中断”技术的出现,使得输入/输出设备与CPU可并行工作B、批处理系统可分为单道批处理系统和多道批处理系统C、批处理系统具有用户与计算机的直接交互能力,提高了系统资源的利用率D、单道批处理系统是一种单用户操作系统正确答案:C7、采用段式存储管理的系统中,若地址用24位表示,其中8位表示段号,则允许每段的最大长度是()。
A、216B、224C、232D、28正确答案:A8、如果有多个中断同时发生,系统将根据中断优先级响应优先级最高的中断请求。
若要调整中断事件的响应次序,可以利用()。
A、中断屏蔽B、中断向量C、中断嵌套D、中断响应正确答案:A9、把作页地址空间中的逻辑地址变成内存中物理地址的过程称为()。
A、物理化B、重定位C、逻辑化D、加载正确答案:B10、当CPU执行系统程序时,CPU处于()。
A、管态B、目态C、系统态D、A和C正确答案:D11、若一个系统内存有64MB,处理器是32位地址,则它的虚拟地址空间为()字节。
B、4GBC、100KBD、64MB正确答案:B12、操作系统负责为用户和用户程序完成所有()的工作A、硬件有关和应用无直接关系B、硬件无关和应用有直接关系C、硬件有关和应用有直接关系D、硬件无关和应用无直接关系正确答案:A13、使用页式存储管理使处理器执行指令的速度______。
操作系统基础习题解析及实验指导第一篇操作系统基础知识点及习题解答该部分罗列操作系统基础各章节的学习要点,指出学习的重点和难点,在回顾相关知识点的基础上,对典型习题进行分析和解答。
第一章操作系统引论本章学习要点【1】掌握操作系统的概念与作用【2】掌握操作系统的基本类型与特点【3】掌握操作系统的特征与功能【4】深入领会多道程序设计技术本章学习难点【1】多道程序设计技术【2】操作系统的特征知识点回顾一. 操作系统的概念一个完整的计算机系统由计算机硬件系统和计算机软件系统两部分组成。
操作系统是配置在计算机硬件上的第一层软件,是对硬件系统功能的第一次扩充。
图1-1 计算机系统的层次图1.操作系统(Operating System,简称OS)的作用(1)OS作为用户与计算机硬件系统之间的接口OS处于用户与计算机硬件系统之间,用户通过OS来使用计算机系统。
或者说,用户在OS 的帮助下能够方便、快捷、安全、可靠地操纵计算机硬件和运行自己的程序。
(2)OS作为计算机系统资源的管理者这是广为流行的一个关于OS作用的观点。
在一个计算机系统中,通常都包含了各种各样的硬件和软件资源。
归纳起来可将资源分为四类:处理器、存储器、I/O设备以及信息(数据和程序)。
OS的主要功能正是针对这四类资源进行有效的管理。
(3)OS用作扩充机器对于一台完全没有软件配置的计算机系统(裸机),即使功能再强,也必定难于使用。
OS在第 1 页共102 页裸机上分别覆盖I/O设备管理软件、文件管理软件等,此时用户所看到的机器,将是一台比裸机功能更强、使用更方便的机器。
通常把覆盖了软件的机器称为扩充机器或虚机器。
在计算机系统上覆盖上一层软件后,系统功能便增强一级。
由于OS自身包含了若干层软件,因此当在裸机上覆盖上OS后,便可获得一台功能显著增强,使用极为方便的多层扩充机器或多层虚机器。
2.操作系统的概念操作系统是一组控制和管理计算机硬件和软件资源、合理组织计算机的工作流程,方便用户使用的程序的集合。
第二章课后习题一、单项选择题1、在单一处理机上执行程序,多道程序的执行是在()进行的。
A.同一时刻B. 同一时间间隔内C.某一固定时刻D. 某一固定时间间隔内2、引入多道程序技术后,处理机的利用率()。
A.降低了B. 有所改善C.大大提高D. 没有变化,只是程序的执行方便了3、顺序程序和并发程序的执行相比,()。
A.基本相同B. 有点不同C.并发程序执行总体上执行时间快D.顺序程序执行总体上执行时间快4、单一处理机上,将执行时间有重叠的几个程序称为()。
A.顺序程序B. 多道程序C.并发程序D. 并行程序5、进程和程序的本质区别是()。
A.存储在内存和外存B.顺序和非顺序执行机器指C.分时使用和独占使用计算机资源D.动态和静态特征6、进程就是程序在并发环境中的执行过程,它是系统进行资源分配和调度的一个基本单位。
进程具有[1]、[2]、调度性、异步性和结构性等基本特征。
进程是一次执行过程,具有生命期体现了进程的[1]特征。
进程由程序段、[3]、[4]组成,其中[4]是进程在系统中存在的唯一标识。
供选择的答案:[1][2] A、动态性B、静态性C、共行性D、并发性E、可执行性F、易用性[3] A、过程B、数据C、进程标识符D、函数[4] A、FCB B、FIFO C、PCB D、JCB7、进程执行时的间断性,决定了进程可能具有多种状态。
进程的基本状态有三种,在分时系统中,当一个进程拥有的时间片到时,则该进程即由[1]进入[2]。
如果出现因某种原因使得处理机空闲时,则需要从就绪队列中选择一进程,并将处理机分配给它,此时该进程进入[3],这个过程是由[4]来完成。
供选择的答案:[1][2][3] A、就绪状态B、静止状态C、阻塞状态D、运行状态[4] A、进程控制程序B、资源分配程序C、进程调度程序D、处理机分配程序8、为了描述进程的动态变化过程,采用了一个与进程相联系的()系统,根据它而感知进程的存在。
A.进程状态字B. 进程优先数C.进程控制块D. 进程起始地址9、下列进程状态的转换中,哪一个是不正确的()。
A. 就绪->运行B. 运行->就绪C. 就绪->阻塞D. 阻塞->就绪10、下列各项步骤中,哪一个不是创建进程所必须的步骤()。
A. 建立一个进程控制块PCBB. 由CPU调度程序为进程调度CPUC. 为进程分配内存等必要的资源D. 将PCB链入进程就绪队列11、在下列特性中,哪一个不是进程的特性()。
A. 异步性B. 并发性C. 静态性D. 动态性12、在单处理机系统中,处于运行状态的进程()。
A.只有一个B. 可以有多个 C.不能被挂起 D. 必须在执行完后才能被撤下13、如果某一进程在运行时,因某种原因暂停,此时将脱离运行状态,而进入()。
A.自由状态B. 停止状态C.阻塞状态D. 静止状态14、已经获得除()以外的所有运行所需资源的进程处于就绪状态。
A.存储器B. 打印机C. CPUD. 磁盘空间15、一个进程被唤醒意味着()。
A.该进程重新占有了CPU B.进程状态变为就绪C.它的优先权变为最大D.其PCB移至就绪队列的队首16、进程从运行状态变为阻塞状态的原因是()。
A.输入或输出事件发生B.时间片到 C.输入或输出事件完成 D.某个进程被唤醒17、在操作系统中同时存在多个进程,它们()。
A. 不能共享系统资源 B. 不能调用同一段程序代码C. 可以共享允许共享的系统资源D. 可以共享所有的系统资源18、操作系统中有一组常称为特殊系统调用的程序,它不能被系统中断,在操作系统中称为()。
A.初始化程序B. 原语 C.子程序 D. 控制模块19、进程间的基本关系为()。
A.相互独立与相互制约B.同步与互斥C.并行执行与资源共享D. 信息传递与信息缓冲20、进程间的同步与互斥,分别表示了各进程间的()。
A.相互独立与相互制约B.协调与竞争 .不同状态 D. 动态性与独立性21、两个进程合作完成一个任务,在并发执行中,一个进程要等待其合作伙伴发来信息,或者建立某个条件后再向前执行,这种关系是进程间的()关系。
A.同步B. 互斥C.竞争D. 合作22、在一段时间内,只允许一个进程访问的资源称为()。
A. 共享资源B. 临界区C. 临界资源D. 共享区23、在操作系统中,对信号量S的P原语操作定义中,使进程进入相应阻塞队列等待的条件是()。
A. S>0B. S=0C. S<0D. S1024、从下列有关进程管理的叙述中,选出正确的两条叙述。
()()A、进程之间同步,主要源于进程之间的资源竞争,是指对多个相关进程在执行次序上的协调;B、临界资源是指每次仅允许一个进程访问的资源;C、信号量机制是一种有效的实现进程同步与互斥的工具。
信号量只能由P-V操作来改变;D、V操作是对信号量执行加1操作,意味着释放一个单位资源,加1后如果信号量的值小于等于零,则从等待队列中唤醒一个进程,现进程变为等待状态,否则现进程继续进行;二、填空题1、程序的____________执行是现代操作系统的基本特征之一,为了更好地描述这一特征而引入了____________这一概念。
2、进程至少有三种基本状态:____________、____________和____________。
3、进程存在的标志是____________。
4、进程的静态实体由____________、____________和____________三部分组成。
5、进程被创建后,最初处于____________状态,然后经____________选中后进入状态。
6、进程的同步和互斥反映了进程间____________和____________的关系。
7、用于进程控制的原语主要有____________、____________、____________和____________。
8、操作系统中信号量的值与____________的使用情况有关,它的值仅能由____________来改变。
9、每执行一次P操作,信号量的数值S减1。
若S30,则该进程____________;若S<0,则该进程____________。
10、每执行一次V操作,信号量的数值S加1。
若____________,则该进程继续执行;否则,从对应的____________队列中移出一个进程并将____________状态赋予该进程。
11、利用信号量实现进程的____________,应为临界区设置一个信号量mutex,其初值为1,表示该资源尚未使用,临界区应置于____________和____________原语之间。
12、如果系统中有n个进程,则在就绪队列中进程的个数最多为____________。
13、高级进程通信方式大致分为三大类:____________、____________和____________。
14、一般说来,进程队列有三种组织方式,线性方式、____________和____________。
三、简答题1.在操作系统中为什么要引入进程概念?它与程序的差别和关系是怎样的?2.PCB的作用是什么?它是怎样描述进程的动态性质的?3.进程的基本状态有几种?试描绘进程状态转换图。
4.用进程状态转换图(如下)能说明有关处理机管理的大量内容。
试回答:(1)、什么事件引起每次显著的状态变迁?(2)、下列状态变迁因果能否发生?为什么?(A)2—>1 (B)3—>2 (C)4—>15.在UNIXS-5中,表示进程的数据结构是怎样的? 6. PCB表的组织方式主要有那几种?分别予以简要说明。
7.什么是进程的互斥与同步? 8.什么是临界区和临界资源?一进程进入临界区的调度原则是什么? 9.是否所有的共享资源都是临界资源?为什么? 10.简述信号量的定义和作用。
P、V操作原语是如何定义的?四、应用题 1、设系统中只有一台打印机,有三个用户的程序在执行过程中都要使用打印机输出计算结果。
设每个用户程序对应一个进程。
问:这三个进程间有什么样的制约关系?试用P、V操作写出这些进程使用打印机的算法。
2、判断下面的同步问题的算法是否正确?若有错,请指出错误原因并予以改正。
(1)设A、B两进程共用一个缓冲区Q,A向Q写入信息,B则从Q读出信息,算法框图如图所示。
注:信号量S的初值为0 (2)设A、B为两个并发进程,它们共享一临界资源。
其运行临界区的算法框图如图所示。
注:信号量S1、S2的初值均为03、设有一台计算机,有两条I/O通道,分别接一台卡片输入机和一台打印机。
卡片机把一叠卡片逐一输入到缓冲区B1中,加工处理后在搬到缓冲区B2中,并在打印机上印出,问:①系统要设几个进程来完成这个任务?各自的工作是什么?②这些进程间有什么样的相互制约关系?③用P、V操作写出这些进程的同步算法。
进程控制练习题答案一.选择题1.B 2.C 3.C 4.C 5.D 6.⑴A ⑵D ⑶B ⑷C 7.⑴⑵⑶AD ⑷C 8.C 9.C 10.B11.C 12.A 13.C14.C 15.B 16.A 17.C 18.B 19.B 20.B 21.A 22.C 23.C24.BC 二、填空题1.并发进程2.运行态就绪态阻塞态3.PCB 4.程序数据集合PCB 5.就绪进程调度程序6.直接制约间接制约7.进程创建进程终止进程阻塞进程唤醒8.相应资源pv操作、9.进入阻塞队列10.S>0 阻塞就绪11.互斥P(mutex) V(mutex) 12.n-1 13.共享存储器管道文件消息传递14.链接方式索引方式。
三、简答题1.答:在操作系统中,由于多道程序并发执行时共享系统资源,共同决定这些资源的状态,因此系统中各程序在执行过程中就出现了相互制约的新关系,程序的执行出现“走走停停”的新状态。
这些都是在程序的动态过程中发生的。
用程序这个静态概念已不能如实反映程序并发执行过程中的这些特征。
为此,人们引入“进程”这一概念来描述程序动态执行过程的性质。
进程与程序的主要区别是:1、进程是动态的;程序是静态的。
2、进程有独立性,能并发执行;程序不能并发执行。
3、二者无一一对应关系。
4、进程异步运行,会相互制约;程序不具备此特征。
但进程与程序又密切的联系:进程不能脱离具体程序而虚设,程序规定了相应进程所要完成的动作。
2.答:PCB是进程组成中最关键的部分。
每个进程有惟一的进程控制块;操作系统根据PCB对进程实施控制和管理,进程的动态、并发等特征是利用PCB表现出来的;PCB是进程存在的惟一标志。
PCB中有表明进程状态的信息:该进程的状态是运行态、就绪态还是阻塞态,利用状态信息来描述进程的动态性质。
3.答:进程的基本状态有运行态、就绪态和阻塞态(或等待态)。