OS操作系统复习资料.docx
OS操作系统复习资料一选择题 1. Generally speaking, which one is not the major concern for a operating system in the following four options?( D ) A.Manage the computer B.Manage the system resources C.Design and apply the interface between user's program and computer hardware system D.High-level programming language complier 2. The main disadvantage of batch system is ( C ) A.CPU utilization is low B.Can not concurrent C.Lack of interaction D.Low degree of automation 3. A process transforms from waiting state to ready state is caused by the ( B ) A.Interrupt event B.Process scheduling C.Create a process for a program D.Waiting for some events 4. The concurrent process is refers to ( C ) A.The process can be run in parallel B.The process can be run in order C.The process can be run in the same time D.The process can not be interrupted 5. In multi-process system, in order to ensure the integrity of public variables, the processes should be mutually exclusive access to critical areas. The so-called critical area is ( D ) A.A buffer B.A date area C.Synchronization mechanism D.A program 6. The orderly use of resources allocation strategy can destroy the condition ( D ) to avoid deadlock. A.Mutual exclusive B.Hold and wait C.No preemption D.Circular wait 7. User's applications use the system resources to complete its operation by the support and services of ( C ) A.clicking the mouse B.Keyboard command C.System call D.Graphical user interface 8. There are four jobs arrived at the same time and the execution time of each job is 2h. Now they run on one processor at single channel,then the average turnaround time is ( B ) A.1h B.5h C.2.5h D.8h 9. Among the job scheduling algorithms, ( B ) is related to the job's estimated running time. A.FCFS scheduling algorithm B.Short-job-first scheduling algorithm C.High response ratio algorithm D.Balanced scheduling 10.In memory management, the purpose of using the overlay and swapping is ( C ) A.Sharing main memory B.Expanding main memory physically C.Saving main memory space D.Improving CPU utilization 11.In the page-replacement algorithm,which one can cause the Belady phenomenon? ( A ) A.FIFO B.LRU C.CLOCKING D.OPT 12. The following description of the system in safe state,which one is correct?( B ) A.It must cause deadlock if the system is in insecure state B.It may cause deadlock if the system is in insecure state C.It may cause deadlock if the system is in secure state D.All are wrong 13.Generally, when we talk about"Memory Protection", the basic meaning is ( C ) A.Prevent hardware memory from damaging B.Prevent program from losing in memory C.Prevent the cross-border call between programs D.Prevent the program from being peeped 14.The actual capacity of virtual memory is equal to ( B ) A.The capacity of external memory(disk) B.The sum of the capacity of external memory and main memory C.The space that the CPU logical address gives D.The smaller one between the option B and C 15.Physical file's organization is determined by ( D ) A.Applications B.Main memory capacity C.External memory capacity D.Operating system 16.A computer system is configured with two plotters and three printers,in order to properly drive these devices,system should provide ( C ) device driver program. A.5 B.3 C.2 D.1 17.When there are fewer number of channels in system ,it may cause "bottlenecks".To solve this problem,which of the follow options is not the effective way?( A ) A.improving the speed of CPU B.Using the virtual device technology C.Adding some hardware buffer on the devices D.Increasing the path between devices and channels 18.When I/O devices and main memory are exchanging data, it can be achieved without CPU's frequently intervention,this way of exchanging data is called ( C ) A.Polling B.Interrupts C.Direct memory access D.None of them 19. The following description of device management, which one is not correct?( B ) A.All external devices are managed by the system in uniform B.Channel is a software of controlling input and output C.The I/O interrupt events from the I/O channel are managed by device management D.One of the responsibility of the operating system is to use the hardware effectively 20.The operating system used ( A ), it realized a mechanism that we can use more space to save more time. A.SPOOLING B.Virtual storage C.Channel D.Overlay 二填空题 1.Software may trigger an interrupt by executing a special operation called a system call .(P7) 2.If there is only one general-purpose CPU,then the system is a single-processor system.(p12) 3. A process can be thought of as a program in execution. (p79) 4.As a process executes,it changes state.Each process may be in one of the following states:new,running,waiting,ready or terminated .(p83) 5.Long-term(job) scheduling is the selection of processes that will beallowed to contend for the CPU.And Short-term(CPU) scheduling is the selection of one process from the ready queue. (p116) 6.The process executing in the operating system may be either independent processes or cooperating processes. Cooperating processes require an interprocess communication mechanism to communicate with each other.Principally,communication is achieved through two schemes: share memory and message passing. (p116) 7.In modern operating systems, resource allocation unit is process, processor scheduling unit is thread .(p127) 8.Most modern operating systems provide kernel support for threads;among these are Windows,as well as Solaris and Linux .(p146) 9.CPU scheduling is the basis of multiprogrammed operating systems.(p153) 10.The FCFS algorithm is nonpreemptive;the RR algorithm is preemptive. 11.Sometimes,a waiting process is never again able to change state,because the resources it has requested are held by other waiting processes.This situation is called deadlock . (p245) 12.The main purpose of a computer system is to execute programs.These programs,together with the data they access,must be in main memory(at least partially) during execution.(P274) 13. The various memory-management algorithms differ in may aspects.In comparing different memory-management strategies,we use the follow considerations:Hardware support,Performance,Fragmentation,Relocation, Swapping,Sharing and protection . (p310) 14.A process is thrashing if it is spending more time paging than executing. 15.Virtual memory is a technique that enables us to map a large logical address space onto a smaller physical memory.(p365) 16.When we solve the major problems of page replacement and frame allocation,the proper design of a paging system requires that we consider page size,I/O,locking,process creation,program structure,and other issues.(p366) 17.The operating system abstracts from the physical properties of its storage devices to define a logical storage unit,the file . (p373) 18.Since files are the main information-storage mechanism in most computer system,file protection is needed.(p408) 19.The seek time is the time for the disk arm to move the heads to the cylinder containing the desired sector.(P457) 20.The hardware mechanism that enables a device to notify the CPU is called an interrupt .(p499) 三简答题 1.What is the operating system?What role does the operating system play in a computer? 开放题,解释操作系统概念,操作系统可以实现哪些基本功能? 关键词:a.管理系统资源,控制程序运行,改善人机界面,为其他应用软件提供支持。b.基本功能:进程与处理机管理、作业管理、存储管理、设备管理、文件管理。 2.There are five jobs A,B,C,D,E to be running, each of the estimated running time of A,B,C,D,E is 9 ,6 ,3 ,5 ,x. Write down their running order which has the shortest average waiting time? 由于短作业优先调度算法可以使作业的平均周转时间最短,同样使平均等待时间最短,所以采用段作业优先算法。 下面对x的取值进行讨论: 当0<x<=3时,作业的运行顺序应该为E,C,D,B,A; 当3<x<5时,作业的运行顺序应该为C,E,D,B,A; 当5<=x<=6时,作业的运行顺序应该为C,D,E,B,A; 当6<x<=9时,作业的运行顺序应该为C,D,B,E,A; 当x>9时,作业的运行顺序应该为C,D,B,A,E 3.What is the criteria of selecting a proper process scheduling algorithm? 由于各种调度算法都有自己的特性,因此,很难评价哪种算法是最好的。一般说来,选择算法时可以考虑如下一些原则: CPU利用率(CPU utilization); 吞吐量(Throughput); 等待时间(waiting time); 响应时间(response time)。 周转时间(Turnaround time) 在选择调度算法前,应考虑好采用的准则,当确定准则后,通过对各种算法的评估,从中选择出最合适的算法。 4.Explain the following terms: 1)System calls 2)Virtual memory 3)Address relocation 1)系统调用提供了应用程序和操作系统的接口。系统调用把应用程序的请求传给内核,调用相应的的内核函数完成所需的处理,将处理结果返回给应用程序。 2)虚拟存储器是指一种实际上并不存在的虚假存储器,它是系统为了满足应用对存储器容量的巨大需求而构造的一个非常大的地址空间,从而使用户在编程时无须担心存储器的不足,就好像有一个无限大的存储器供其使用一样。 3)指当程序装入到与其逻辑地址不同的主存空间时,将程序地址空间的逻辑地址变换为主存空间的物理地址的变换过程。 5.What functions do you think the file system can realize?Please use your own words. (1)提供方便的文件系统应用接口; (2)将逻辑文件映射为物理文件; (3)管理文件存储空间的使用; (4)保证文件存储的安全性和可靠性。 四应用题 1.There is a ticket hall can accommodate 100 people.If it is less than 100 people in the hall, buyers can go into and buy tickets ,then leave the hall. If there has 100 people, then buyers should wait outside the hall.Now please answer the following questions: (1)Is it synchronization or mutual exclusion between the buyers? (2)Describe the process of buyers with wait and signal operation. A: (1)购票者直接是互斥关系。 (2)一个售票厅可容纳100人购票,说明最多允许100人共享售票厅;可引入一个信号量empty,初值为100.由于购票者必须是互斥地进行购票,故应再设一个mutex,初值为1。用 wait 和signal 表达如下: empty,mutex:semaphore; empty:=100;mutex:=1; begin: wait; wait; 进入购票,购票后退出 signal; signal; end 2.In a computer system,there is one CPU and two external devices IO1 and IO2, now three jobs J1,J2 and J3 are already in the main memory to be run,the priority of them is J1>J2>J3.The order and time they use the CPU and devices are as following: J1:IO2(30ms),CPU(10ms),IO1(30ms),CPU(10ms). J2:IO1(20ms),CPU(20ms),IO2(40ms). J3:CPU(30ms),IO1(20ms). Now they run at the same time and the use of resources is preemptive,please answer the following questions(you need not to consider other operating time): (1)Calculate the time J1,J2,J3 cost from start to finish separately. (2)What is the CPU utilization when three jobs are finishing? (3)What is the IO1's utilization when three jobs are finishing? A: (1)J1占用完IO2 30ms之后,抢占J2的CPU,运行10ms,再占用IO1 30ms,然后占用CPU 10ms,完成。所用时间为30+10+30+10=80ms。 J2占用IO1 20ms,抢占了J3的CPU,运行10ms后,被J1抢占CPU,等待10ms,之后再次得到CPU,运行10ms,之后占用IO2 40ms,所用时间为20+10+10+10+40=90ms。 J3占用CPU 20ms被J2抢占,等待30ms,再运行10ms,等待10ms,再占用IO1 20ms,所用时间为20+30+10+10+20=90ms。 (2)三个作业全部完成时CPU利用率为:(10+20+30+10)/90=7/9=78%。 (3)三个作业全部完成时IO1利用率为:(20+30+20)/90=7/9=78%。 3.In a page virtual storage system, each process has 4 memory allocation memory block.When the process begins executing ,data area is empty. If now it calls the pages in the program with this sequence: 5 , 3 , 6 , 4 , 3 , 5 , 1 , 4 , 2 , 5 , 6 , 4 , 2 , 5 , 1 Write down the number of page faults when using the following page-replacement algorithms and draw the Page trend graph. (1)FIFO page-replacement algorithm (2)LRU page-replacement algorithm (3)OPT page-replacement algorithm (1)系统采用先进先出淘汰算法,总共缺页10次 5 3 6 4 3 5 1 4 2 5 6 4 2 5 1 5 3 6 4 4 4 1 1 2 5 6 4 4 4 1 5 3 6 6 6 4 4 1 2 5 6 6 6 4 5 3 3 3 6 6 4 1 2 5 5 5 6 5 5 5 3 3 6 4 1 2 2 2 5 f f f f f f f f f f (2)系统采用LRU(最少使用)淘汰算法,总共缺页8次 5 3 6 4 3 5 1 4 2 5 6 4 2 5 1 5 3 6 4 3 5 1 4 2 5 6 4 2 5 1 5 3 6 4 3 5 1 4 2 5 6 4 2 5 5 3 6 4 3 5 1 4 2 5 6 4 2 5 5 6 4 3 5 1 4 2 5 6 4 f f f f f f f f (3)系统采用OPT淘汰算法,总共缺页7次 5 3 6 4 3 5 1 4 2 5 6 4 2 5 1 5 3 6 4 4 4 4 4 4 4 4 4 4 4 4 5 3 6 6 6 6 6 6 6 6 6 6 6 1 5 3 3 3 1 1 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5 5 5 5 5 f f f f f f f