操作系统复习题1-Eli.doc_第1页
操作系统复习题1-Eli.doc_第2页
操作系统复习题1-Eli.doc_第3页
操作系统复习题1-Eli.doc_第4页
操作系统复习题1-Eli.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Multiple Choice1. What are the major activities of an operating system?A:User managementB:Main Memory management(存储管理)C:I/O system management设备管理 D:File management文件管理Answer:BCD2. The way that operating system components are interconnected and modeled into a kernel can be?A:Simple structureB:Micro kernelsC:Layered approachD:Prototype approachAnswer:ABC3. What state is a process in when it can not run because it needs a resource to become available?A:ReadyB:InterruptC:BlockedD:RunningAnswer:C4. Which are the major differences between user-level threads and kernel-level threads?A:User-level threads are unknown by the kernel, whereas the kernel is aware of kernel threads.B:User threads are scheduled by the thread library and the kernel schedules kernel threads.C:Kernel threads need not be associated with a process whereas every user thread belongs to a process.D:One user-level thread can be only mapped by one kernel thread.Answer:ABC5. Which of the following free-space management strategies are supported by an operating system?A:Bit VectorB:Linked listC:Grouping D:CountingAnswer:ABCD6. What refers to the page replacement algorithm which replaces the page that has not been used for the longest period of time?A:FIFOB:LRUC:OPTD:LFUAnswer:B7. Which of the followings is a condition for deadlock?A:Starvation B:Circular WaitC:No PreemptionD:Mutual ExclusionAnswer:BCD8. The basic function of the file system is accessing files by names. The function can be realized by A directory-management B boosting the speed of the file-accessingC file-protectingD improving the utilization of storage9. A main memory space B cpu managementC I/O system managementD Tape management10.Which of the following strategies need base register and length register?A:pagingB:segmentationC:segmentation with pagingD:fixed sized partitions memory managementAnswer:ABCConcept Explanations 1.System call系统调用。获取操作系统所提供的服务的接口。系统调用的类型:进程控制文件管理设备管理信息维护通信。2. Critical section临界区。假如某个系统有n个进程P0,P1,,Pn。每个进程有一个代码段称为临界区,在该区中进程可能改变共同变量、更新一个表、写一个文件等。没有两个进程可同时在临界区内执行。3.Directory计算机的文件系统可以非常大。为了管理这些数据,需要组织它们。这种管理涉及使用目录。目录记录一个分区中所有文件的的信息,如名称、位置、大小和类型等。目录可看做符号表。它将文件名称转换成目录条目。4.Overlay覆盖:一个作业的若干程序段,或几个作业的某些部分共享某一个存储空间。引入:在多道程序环境下扩充内存的方法,用以解决在较小的存储空间中运行较大程序时遇到的问题。原理:一个程序的几个代码段和数据段,按照时间先后来占用公共的内存空间。(并不是作业的每一部分都是时时要用的)。 把程序划分为若干个功能上相互独立的程序段,按照其自身的逻辑结构将那些不会同时执行的程序段共享同一块内存区域。 程序段先保存在磁盘上,当有关程序段的前一部分执行结束后,把后续程序段调入内存,覆盖前面的程序段。Brief Answers1. What is the difference between process and program? What is the difference between process and thread?1.1 程序和进程的区别:程序是完成所需求的功能时,所应采取的顺序步骤,是执行指令的有序集合。进程是执行中的程序,包括程序计数器,进程栈和数据段,还可能包括堆。程序和进程的区别:程序本身不是进程。程序只是被动实体,如存储在磁盘上的可执行文件。进程是活动实体,不只是程序代码,还包括当前活动。随程序的执行而发生,随程序的结束而消亡。.多个进程可与同一程序相关。并且这些进程被当做独立的执行序列。静止状态的程序和数据是相互独立的信息集合,进程中的程序和数据是一个不可分割的实体。1.2 线程与进程的区别线程是CPU使用的基本单元,进程是系统工作的基本单元,资源分配的最小单位。线程划分的尺度小,所以并发性高,而进程划分的尺度相对较大。线程是CPU执行的基本单元,而进程是内存分配的基本单元。进程是运行中的程序,是一个动态的概念,获得了计算机资源,执行了任务。而线程是进程中的一个单一的组成部分,一叫做轻量级进程,是程序执行的最小单位。2. What is the cause of trashing? How does the system detect thrashing? Once it detects thrashing, what can the system do to eliminate this problem? 颠簸,频繁的页调度行为。一个进程在换页上用的时间要多于执行的时间,那么这个进程就在颠簸。颠簸的原因:进程总的需求大于可用帧的数量。那么有的进程就会得不到足够的帧,从而出现颠簸。系统怎么探测颠簸?系统可通过对比多道程序的程度来估计CPU利用率的程度,以此来检测颠簸。怎么消除?降低多道程序的程度可以消除颠簸。3. What is spooling? Describe how spooling works using printer as an example 假脱机是用来保存设备输出的缓冲区。这些设备不能接受交叉的数据流。它是OS用来协调并发输出的一种方法。 从一个应用软件打印文稿时,应用程序的输出先是假脱机到一个独立的磁盘文件上,当这个假脱机文件创建完毕,OS就将控制权交给应用程序,然后,这个假脱机文件将在后台被送往打印机打印出来。Consider a system consisting of 4 resources of the same type that are shared by three processes,each of which needs at most 2 resources. Show that the system is deadlock free. 发生死锁的条件假设该系统陷入死锁。这意味着,每一个进程只持有一个资源,并且正等待另一个资源。因为有3个进程和4个资源,有一个进程必须获取2个资源,该进程并不需要更多的资源。不满足死锁产生的占有并等待条件。Comprehensive1. Consider a memory management system with paging.There are three jobs, J1, J2, J3 , are in the memory now. J2 has 4 pages,which are stored in the 3rd ,4rh ,6rh and 8 rh block of the main memory respectively.Suppose the page size is 1024 bytes, and the main is 10K bytes, please answer the following two questions:(1)Draw the page table of J2;2100/1024=2, 2对应的帧号为6,2100%1024=52,页偏移为52物理地址为:6*1024+52=6196J2的页表:03142638(2)If J2 meets the instruction “MOV2100,3100” at its logical address 500(decimal),give the physical addresses of the two operands above. 2.Consider the following snapshot of a system:AllocationMaxAvailable R1 R2 R3 R4 R1 R2 R3 R4 R1 R2 R3 R4 P0 0 0 1 2 0 0 1 2 2 1 0 0 P1 2 0 0 0 2 7 5 0 P2 0 0 3 4 6 6 5 6 P3 2 3 5 4 4 3 5 6 P4 0 3 3 2 0 6 5 21. How many instances of each resource type in the system?2. What is the content of the matrix need?3. Is the system in a safe state? Why?4. If a request from process P2 arrives for (0,1,0,0), can the request be granted immediately?Answer:1. 各种资源的实例数量总数等于各个进程所分配的各种资源的实例数量与各种资源现有的实例数量之和。即(R1,R2,R3,R4)=(6,7,12,12)2. Need矩阵中的各个资源的数值等于每个进程的最大需求Max矩阵-每个进程现在所分配的各个资源实例数量Allocation矩阵,即 Need R1 R2 R3 R4 P0 0 0 0 0 P1 0 7 5 0 P2 6 6 2 2 P3 2 0 0 2 P4 0 3 2 0 3. 如果可以找到一个安全序列,那么该系统就处于安全状态,否则,系统就处于不安全状态。因为找到序列满足安全要求,所以系统安全。4. P2的Request2 =(0,1,0,0)。首先检测Request2 Need2, 其值为真,然后检测 Request2 Available,其值为真。接着假定这个请求被满足,会产生如下新状态:Allocation NeedAvailable R1 R2 R3 R4 R1 R2 R3 R4 R1 R2 R3 R4 P0 0 0 1 2 0 0 1 2 2 0 0 0 P1 2 0 0 0 2 7 5 0 P2 0 1 3 4 6 5 2 2P3 2 3 5 4 4 3 5 6P4 0 3 3 2 0 6 5 2必须确定此状态是否安全,为此,执行安全算法。找不到一安全序列,故不能立即允许进程P2的这个请求。3. Consider the following page reference string:2、3、4、5、3、4、1、2、3、5、1、4、2、4、5、1、3、2、1、3. Please write processes of the following replacement algorithms and give the number of page faults, assuming 3 frames? Remember all frames are initially empty, so your first unique pages will all cost one fault each.1. FIFO replacement:先进先出页置换 置换最旧的页2. LRU replacement:最近最少使用页置换 置换最长时间没有使用的页3. Optimal replacement:最优页置换 置换将来最长时间不使用的页Answer:FIFO: 2 3 4 5 3 4 1 2 3 5 1 4 2 4 5 1 3 2 1 3 2 2 2 5 5 5 3 3 3 4 4 4 1 1 1 3 3 3 1 1 1 5 5 5 2 2 2 3 3 4 4 4 2 2 2 1 1 1 5 5 5 2页错误次数:15LRU: 2 3 4 5 3 4 1 2 3 5 1 4 2 4 5 1 3 2 1 3 2 2 2 5 1 1 1 5 5 5 2 2 1 1 1 3 3 3 3 2 2 2 1 1 1 5 5 5 2 4 4 4 4 3 3 3 4 4 4 4 3 3页错误次数:15OPT: 2 3 4 5 3 4 1 2 3 5 1 4 2 4 5 1 3 2 1 3 2 2 2 5 5 5 5 5 1 1 3 3 3 3 3 1 4 4 3 4 4 1 2 2 2 2 2页错次数:10 运用FIFO4.Consider the following set of processes, with the length of

温馨提示

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

评论

0/150

提交评论