操作系统概念第七版期末考试

合集下载

操作系统期末试题及答案

操作系统期末试题及答案

操作系统期末试题及答案一、选择题1. 操作系统的主要功能包括哪些?A. 进程管理B. 内存管理C. 文件管理D. 网络管理E. 用户管理答案:A、B、C、E2. 进程是指什么?A. 一个程序的执行实例B. 一个正在运行的程序C. 一个存储空间D. 一个输入输出设备答案:A3. 内存管理的主要任务是什么?A. 确保每个程序都能够拥有足够的内存空间B. 分配和回收内存空间C. 保护内存中的数据不被访问和修改D. 提高内存的访问速度答案:A、B4. 什么是虚拟内存?A. 一种通信协议B. 一种文件系统C. 一种内存管理技术D. 一种硬件设备答案:C5. 文件管理的主要功能包括哪些?A. 文件的创建和删除B. 文件的读取和写入C. 文件的共享和保护D. 文件的备份和恢复答案:A、B、C、D二、填空题1. 进程的状态包括______、______、______和______。

答案:创建态、就绪态、运行态和结束态。

2. 操作系统通过______来实现内存空间的分配和回收。

答案:内存管理器。

3. 高级语言的编译过程中会生成______,而不是直接生成可执行文件。

答案:目标文件。

4. 线程的调度由操作系统的______来完成。

答案:线程调度器。

5. 文件管理的基本单位是______。

答案:文件块。

三、简答题1. 请简要介绍操作系统的五大功能。

答案:操作系统的五大功能分别是进程管理、内存管理、文件管理、网络管理和用户管理。

进程管理负责创建和销毁进程,调度和控制进程的执行,以及进程间的通信和同步。

内存管理负责将内存空间分配给进程,并在需要时回收空闲内存。

文件管理负责文件的创建、读取、写入和删除等操作,以及文件的共享和保护。

网络管理负责配置和管理计算机网络,提供网络通信的功能。

用户管理负责管理用户的账号和权限,以及用户与系统之间的交互界面。

2. 什么是进程和线程?它们有什么区别?答案:进程是指一个程序的执行实例,具有独立的资源和控制流程,可以并发执行。

《操作系统概论》期末复习题(30页答案)

《操作系统概论》期末复习题(30页答案)

《操作系统概论》期末复习题年级_____ _专业_ _____学号_ ______姓名___________成绩__ ________一、单项选择题(每小题1分,共30分)(1)~(30)题A),B),C),D)四个选项中,只有一个选项是正确的,请将正确的选项填写在答题纸(卡)相应的格子中,答在试卷上不得分.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.WINDOWS 98属于()操作系统。

A) 单用户单任务B) 单用户多任务C) 多用户单任务 D) 多用户多任务7.同一程序运行在不同的数据集上,创建了()的进程。

A) 不同 B) 相同 C)同步 D) 互斥8.进程在三个基本状态中转换,肯定不会有的转换是()。

A) 运行态→就绪态 B) 等待态→运行态C) 运行态→等待态 D) 等待态→就绪态9. 在单处理机系统中,如果同时存在9个进程,处于等待态的进程最少为()。

A) 9个 B) 1个C) 0个 D) 8个10. 某进程所要求的一次打印输出结束后,其进程的状态将从()。

A) 运行态到就绪态 B) 等待态到就绪态C) 运行态到等待态 D) 就绪态到等待态11.下列不属于进程调度的算法是()。

A) 先来先服务 B) 时间片轮转 C) 最高优先级D) 响应比高者优先12.在任何时刻,一个进程的状态变化()引起另一个进程的状态变化。

A)必定 B) 一定不C) 不一定 D)不可能13.中断装置按预定的顺序来响应同时出现的中断事件,这个预定的顺序是()。

操作系统期末试题及答案

操作系统期末试题及答案

《操作系统》期末试卷姓名一、选择题(15*2分=30分)1、在操作系统中,JCB是指(A )A.作业控制块B.进程控制块C.文件控制块D.程序控制块2、并发进程之间(D)A.彼此无关B.必须同步C.必须互斥D.可能需要同步或互斥3A4?A5、(DA6A7A.8A.C.9、设有。

A.210A.11A12、()AC13A14、(BA.固定分区B.分段C.分页D.可变分区15、在进程管理中,当()时,进程从阻塞状态变为就绪状态。

A.进程被进程调度程序选中B.等待某一事件C.等待的事件发生D.时间片用完二、填空题(20*1分=20分)1、在单用户环境下,用户独占全机,此时程序的执行具有_封闭性______和_可再现性_。

2、对于信号量,在执行一次P操作时信号量-1_;当其值为__<0__时,进程应阻塞。

在执行V操作时信号量的值应当_信号量+1_;当其值为__<=0__时,应唤醒阻塞队列中的进程。

3、进程的三种基本状态分别是、进程的三种基本状态分别是__运行______,_就绪_和__阻塞(等待)__。

4、多道程序环境下的各道程序,宏观上它们是_并行__运行,微观上是_串行_运行。

5、在单CPU系统中有(n>1)个进程,在任一时刻处于就绪的进程最多是__n-1__个,最少是___0____个。

6、分区管理方案不能实现虚存的原因是_作业地址空间不能大于存储空间_。

7、段页式存储管理中,是将作业分_段__,__段_____内分___页____。

分配以__页_____为单位。

在不考虑使用联想存储器快表的情况下,每条访问内存的指令需要____3___访问内存。

其中第_2___次是查作业的页表。

三、简答题(4*5分=20分)(2)????????????进程A???????????????????????????????进程B ???????????...??????????????????????????????????... ????????P(mutex);????????????????????????????P(mutex);????????申请打印机;???????????????????????????申请打印机;????????使用打印机;???????????????????????????使用打印机;????????V(mutex);?????????????????????????????V(mutex);2、两个程序,其中A请求系统服务时间5s,B请求系统服务时间为100s,设第0到第5秒前,CPU运行C进程。

操作系统期末考试试题及答案PDF

操作系统期末考试试题及答案PDF

操作系统期末考试试题及答案PDF一、单项选择题(每题2分,共20分)1. 在现代操作系统中,进程和程序的主要区别是()。

A. 进程是一个动态的概念,程序是一个静态的概念B. 进程是程序的执行过程,程序是进程的代码集合C. 进程是程序的代码和数据的集合,程序是进程的执行过程D. 进程是程序的代码集合,程序是进程的执行过程2. 在操作系统中,进程调度的目的是()。

A. 决定进程的执行顺序B. 提高CPU的利用率C. 保证进程的公平性D. 以上都是3. 下列关于死锁的描述,不正确的是()。

A. 死锁是指两个或多个进程在执行过程中,因争夺资源而造成的一种僵局B. 死锁产生的四个必要条件是互斥、占有和等待、不可剥夺、循环等待C. 死锁的预防方法是破坏占有和等待条件D. 死锁的避免方法是通过银行家算法来实现4. 在操作系统中,虚拟内存的主要作用是()。

A. 提高内存的访问速度B. 提高内存的利用率C. 扩大内存的容量D. 以上都是5. 下列关于文件系统的的说法,不正确的是()。

A. 文件系统是操作系统中负责管理文件的系统B. 文件系统提供了文件的创建、删除、读取和写入等操作C. 文件系统将文件存储在磁盘上,并且可以对文件进行加密D. 文件系统允许多个用户同时访问同一个文件6. 在操作系统中,分页管理方式的主要优点是()。

A. 减少了内存的碎片B. 简化了内存管理C. 提高了内存的利用率D. 以上都是7. 下列关于进程通信的说法,不正确的是()。

A. 进程通信是指进程之间交换信息的过程B. 进程通信的方式有共享内存、消息传递、信号量等C. 进程通信可以提高系统的并发性D. 进程通信会导致进程的阻塞8. 在操作系统中,中断处理程序的主要作用是()。

A. 处理硬件设备发出的中断信号B. 处理用户发出的中断信号C. 处理操作系统发出的中断信号D. 处理进程发出的中断信号9. 下列关于操作系统的用户界面的说法,不正确的是()。

(完整版)操作系统概念第七版习题答案(中文版)完整版

(完整版)操作系统概念第七版习题答案(中文版)完整版

(完整版)操作系统概念第七版习题答案(中文版)完整版1.1 在多道程序和分时环境中,多个用户同时共享一个系统,这种情况导致多种安全问题。

a. 列出此类的问题b.在一个分时机器中,能否确保像在专用机器上一样的安全度?并解释之。

Answer:a.窃取或者复制某用户的程序或数据;没有合理的预算来使用资源(CPU,内存,磁盘空间,外围设备)b.应该不行,因为人类设计的任何保护机制都会不可避免的被另外的人所破译,而且很自信的认为程序本身的实现是正确的是一件困难的事。

1.2 资源的利用问题在各种各样的操作系统中出现。

试例举在下列的环境中哪种资源必须被严格的管理。

(a)大型电脑或迷你电脑系统(b)与服务器相联的工作站(c)手持电脑Answer: (a)大型电脑或迷你电脑系统:内存和CPU 资源,外存,网络带宽(b)与服务器相联的工作站:内存和CPU 资源(c)手持电脑:功率消耗,内存资源1.3 在什么情况下一个用户使用一个分时系统比使用一台个人计算机或单用户工作站更好?Answer:当另外使用分时系统的用户较少时,任务十分巨大,硬件速度很快,分时系统有意义。

充分利用该系统可以对用户的问题产生影响。

比起个人电脑,问题可以被更快的解决。

还有一种可能发生的情况是在同一时间有许多另外的用户在同一时间使用资源。

当作业足够小,且能在个人计算机上合理的运行时,以及当个人计算机的性能能够充分的运行程序来达到用户的满意时,个人计算机是最好的,。

1.4 在下面举出的三个功能中,哪个功能在下列两种环境下,(a)手持装置(b)实时系统需要操作系统的支持?(a)批处理程序(b)虚拟存储器(c)分时Answer:对于实时系统来说,操作系统需要以一种公平的方式支持虚拟存储器和分时系统。

对于手持系统,操作系统需要提供虚拟存储器,但是不需要提供分时系统。

批处理程序在两种环境中都是非必需的。

1.5 描述对称多处理(SMP)和非对称多处理之间的区别。

操作系统期末考试试题和标准答案及评分标准

操作系统期末考试试题和标准答案及评分标准

《操作系统》试题(A卷)(考试时间:90分钟)一、选择题(共20分,每小题1分)1.()不是基本的操作系统。

A.批处理操作系统B.分时操作系统C.实时操作系统D.网络操作系统2.现代OS具有并发性和共享性,是()的引入导致的。

A.单道程序B. 磁盘C. 对象D.多道程序3.一般来说,为了实现多道程序设计,计算机最需要()。

A.更大的内存B.更多的外设C.更快的 CPUD.更先进的终端4.在下面的I/O控制方式中,需要CPU干预最少的方式是()。

A.程序I/O方式B.中断驱动I/O控制方式C.直接存储器访问DMA控制方式D.I/O通道控制方式5.在进程状态转换时,下列()转换是不可能发生的。

A.就绪态→运行态B.运行态→就绪态C.运行态→阻塞态D.阻塞态→运行态6.一个进程执行过程中不可能对应( )。

A.一个PCBB.一个JCBC.多个PCBD.一个程序7.进程调度又称为低级调度,其主要功能是( )。

A.选择一个作业调入内存B.选择一个主存中的进程调出到外存C.选择一个外存中的进程调入到主存D.将一个就绪的进程投入运行8.如果允许不同用户的文件可以具有相同的文件名,通常采用()来保证按名存取的安全。

A.重名翻译机构B.建立索引表C.建立指针D.多级目录结构9.文件控制块不包括()。

A.文件名B.文件访问权限说明C.文件物理位置信息D.磁盘坏块信息10.为了提高设备分配的灵活性,用户申请设备时应指定()号。

A.设备类相对B.设备类绝对C.相对D.绝对11.若进程P一旦被唤醒就能够投入运行,系统可能为( )。

A.在分时系统中,进程P的优先级最高。

B.抢占调度方式,就绪队列上的所有进程的优先级皆比P的低。

C.就绪队列为空队列。

D.抢占调度方式,P的优先级高于当前运行的进程。

12.为了照顾紧迫型作业,应采用()。

A.先来服务调度算法B.短作业优先调度算法C.时间片轮转调度算法D.优先权调度算法13.一作业进入内存后,则所属该作业的进程初始时处于()状态。

操作系统概念第七版答案

操作系统概念第七版答案

操作系统概念第七版答案【篇一:操作系统概念第七版答案(含编程代码)】> chapter 11.1 in a multiprogramming and time-sharing environment, several users share the system simultaneously. this situation can result in various security problems. a. what are two such problems?b. can we ensure the same degree of security in a time-shared machine as in a dedicated machine? explain your answer.answer:a. stealing or copying one’s programs or data; using system resources (cpu, memory, disk space, peripherals) without proper accounting.b. probably not, since any protection scheme devised by humans can inevitably be broken by a human, and the more complex the scheme, the more difficult it is to feel confident of its correct implementation.1.2 the issue of resource utilization shows up in different forms in different types of operating systems. list what resources must be managedcarefully in the following settings: a. mainframe or minicomputer systems b. workstations connected to serversc. handheld computersanswer:a. mainframes:memory and cpu resources, storage, network bandwidth.b. workstations: memory and cpu resoucesc. handheld computers: power consumption, memory resources.1.3 under what circumstances would a user be better off using a timesharing system rather than a pc or single-user workstation?answer: when there are few other users, the task is large, and the hardware is fast, time-sharingmakes sense. the full power of the system can be brought to bear on the user’s problem. the problemcan be solved faster than on a personal computer. another case occurs when lots of other users need resources at the same time.a personal computer is best when the job is small enough to be executed reasonably on it and when performance is sufficient to execute the prog ram to the user’s satisfaction.1.4 which of the functionalities listed below need to be supported by the operating system for the following two settings: (a) handheld devices and (b) real-time systems. a. batch programmingb. virtual memoryc. time sharinganswer: for real-time systems, the operating system needs to support virtual memoryand time sharing in a fair manner. for handheld systems,the operating system needs to provide virtual memory, but does not need to provide time-sharing. batch programming is not necessary in both settings.1.5 describe the differences between symmetric and asymmetric multiprocessing.what are three advantages and one disadvantage of multiprocessor systems?answer: symmetric multiprocessing treats all processors as equals, and i/o can be processed on any cpu. asymmetric multiprocessing has one master cpu and the remainder cpus are slaves. the master distributes tasks among the slaves, and i/o is usually done by the master only.multiprocessors can save money by not duplicating power supplies,housings, and peripherals. they can execute programs more quickly and can have increased reliability. they are also more complex in both hardware and software than uniprocessor systems.1.6 how do clustered systems differ from multiprocessor systems? what is required for two machines belonging to a cluster to cooperate to provide a highly available service?answer: clustered systems are typically constructed by combining multiple computers into a single system to perform a computational task distributed across the cluster. multiprocessor systems on the other hand could be a single physical entity comprising of multiple cpus. a clustered system is less tightly coupled than a multiprocessorsystem.clustered systems communicate using messages, while processors in a multiprocessor system could communicate using shared memory.in order for twomachines to provide a highly available service, the state on the two machines should be replicated and shouldbe consistently updated. when one of the machines fail, the other could then take-over the functionality of the failed machine.1.7 distinguish between the client-server and peer-to-peer models of distributed systems.answer: the client-server model firmly distinguishes the roles of the client and server. under this model, the client requests services that are provided by the server. the peer-to-peer model doesn’t have such strict roles. in fact, all nodes in the system are considered peers and thus may act as either clients or servers - or both. a node may request a service from another peer, or the node may in fact provide such a service to other peers in the system.for example, let’s consider a system of nodes tha t share cooking recipes.under the client-server model, all recipes are stored with the server. if a client wishes to access a recipe, it must request the recipe from the specified server. using the peer-to-peer model, a peer node could ask other peer nodesfor the specified recipe.the node (or perhaps nodes) with the requested recipe could provide it to the requesting node. notice how each peer may act as both a client (i.e. it may request recipes) and as a server (it may provide recipes.)1.8 consider a computing cluster consisting of twonodes running adatabase.describe two ways in which the cluster software can manage access to the data on the disk. discuss the benefits and disadvantages of each.answer: consider the following two alternatives: asymmetric clustering and parallel clustering. with asymmetric clustering, one host runs the database application with the other host simply monitoring it. if the server fails, the monitoring host becomes the active server. this is appropriate for providing redundancy. however, it does not utilize the potential processing power of both hosts. with parallel clustering, the database application can run in parallel on both hosts. the difficulty implementing parallel clusters is providing some form of distributed locking mechanism for files on the shared disk.1.9 how are network computers different from traditional personal computers? describe some usage scenarios in which it is advantageous to use network computers.answer: a network computer relies on a centralized computer for most of its services. it can therefore have a minimal operating system to manage its resources. a personal computer on the other hand has to be capable of providing all of the required functionality in a standalonemanner without relying on a centralized manner. scenarios where administrative costs are high and where sharing leads to more efficient use of resources are precisely those settings where network computers are preferred.1.10 what is the purpose of interrupts? what are the differences between a trap and an interrupt? can traps be generated intentionally by a user program? if so, for what purpose?answer: an interrupt is a hardware-generated change-of-flow within the system. an interrupt handler is summoned to deal with the cause of the interrupt; control is then returned to the interrupted context and instruction. a trap is a software-generated interrupt. an 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 system routines or to catch arithmetic errors.1.11 direct memory access is used for high-speed i/o devices in order to avoid increasing the cpu′s execution load.a. how does the cpu interface with the device to coordinate the transfer?b. how does the cpu know when the memory operations are complete?c. the cpu is allowed to execute other programs while the dma controller istransferring data. does this process interfere with the execution of the user programs? if so, describe what forms of interference are caused.answer: the cpu can initiate a dma operation by writing values into special registers that can be independently accessed by the device.the device initiates the corresponding operation once it receives a command from the cpu. when the device is finished with its operation, it interrupts the cpu to indicate the completion of the operation.both the device and the cpu can be accessing memory simultaneously.the memory controller provides access to the memory bus in a fair manner to these two entities.a cpu might therefore be unable to issue memory operationsat peak speeds since it has to compete with the device in order to obtain access to the memory bus.answer: an operating system for a machine of this type would need to remain in control (or monitor mode) at all times. this could be accomplished by two methods:a. software interpretation of all user programs (like some basic,java, and lisp systems, for example). the software interpreter would provide, in software, what the hardware does not provide.b. require meant that all programs be written in high-level languages so that all object code is compiler-produced. the compiler would generate (either in-line or by function calls) the protection checks that the hardware is missing.1.13 give two reasons why caches are useful.what problems do they solve? what problems do they cause? if a cache canbe made as large as the device for which it is caching (for instance, a cache as large as a disk), why not make it that large and eliminate the device?answer: caches are useful when two or more components need to exchange data, and the components perform transfers at differing speeds.caches solve the transfer problem by providing a buffer of intermediate speed between the components. if the fast device finds the data it needs in the cache, it need not wait for the slower device. the data in the cache must be kept consistent with the data in the components. if a omponent has a data value change, and the datum is also in the cache, the cache must also be updated. this is especially a problem on multiprocessor systemswhere more than one process may be accessing adatum.acomponent may be eliminated by an equal-sized cache, but only if: (a) the cache and the component have equivalent state-saving capacity (that is,if the component retains its data when electricity is removed, the cache must retain data as well), and (b) the cache is affordable, because faster storage tends to be more expensive.1.14 discuss, with examples, how the problem of maintaining coherence of cached data manifests itself in the following processing environments:a. single-processor systemsb. multiprocessor systemsc. distributed systemsanswer: in single-processor systems, the memory needs tobe updated when a processor issues updates to cached values. these updates can be performed immediately or in a lazy manner. in amultiprocessor system,different processors might be caching the same memory location in its local caches. when updates are made, the other cached locations need to be invalidated or updated. in distributed systems, consistency of cached memory values is not an issue. however, consistency problems might arise when a client caches file data.1.15 describe a mechanism for enforcing memory protectionin order to prevent a program from modifying the memory associated with other programs.answer: the processor could keep track of what locations are associated with each process and limit access to locationsthat are outside of a program’s extent. informatio n regarding the extent of a program’s memory could be maintained by using base and limits registers and by performing a check for every memory access.1.16 what network configuration would best suit the following environments? a. a dormitory floorb. a university campusc. a stated. a nationanswer:a. a dormitory floor - a lan.b. a university campus - a lan, possible a wan for very large campuses.c. a state - awan.d. a nation - a wan.1.17 define the essential properties of the following types of operating systems: a. batchb. interactivec. time sharingd. real timee. networkf. parallelg. distributedh. clusteredi. handheld【篇二:操作系统概念第七版4-6章课后题答案(中文版)】举两个多线程程序设计的例子来说明多线程不比单线程方案提高性能答:1)任何形式的顺序程序对线程来说都不是一个好的形式。

操作系统概念第七版习题答案(中文版)完整版

操作系统概念第七版习题答案(中文版)完整版

操作系统概念第七版习题答案(中文版)完整版操作系统概念第七版习题答案(中文版)完整版本文为《操作系统概念第七版习题答案(中文版)》的完整版,旨在提供对该书中习题的详细解答和解析。

以下将按照章节顺序,逐一介绍各章习题的解答及相应的说明。

第一章:引言1. 操作系统的定义操作系统是计算机体系结构的重要组成部分。

它是一种软件,用于管理计算机硬件资源和提供用户与计算机系统之间的接口。

操作系统的主要目标是实现对计算机系统的控制和协调,以确保计算机系统的正确运行。

2. 操作系统的功能操作系统具有以下主要功能:- 管理系统资源:操作系统负责管理计算机系统的硬件资源,包括内存、CPU、硬盘和外部设备等。

- 提供用户接口:操作系统提供了用户与计算机系统之间的接口,使用户能够方便地使用计算机。

- 调度任务:操作系统根据一定的调度算法,决定进程的执行顺序,以实现对系统资源的合理利用。

- 存储管理:操作系统管理计算机的内存资源,为进程分配内存空间,并进行内存的读写操作。

- 文件系统:操作系统负责管理计算机系统中的文件,包括文件的创建、读写和删除等操作。

- 错误处理:操作系统能够检测和处理可能出现的错误,确保计算机系统的稳定和安全。

第二章:进程与线程1. 进程与线程的概念及区别进程是计算机系统中正在运行的程序的实例。

一个进程由程序、数据和进程控制块组成,拥有独立的内存空间和系统资源。

线程是进程中的一个实体,是进程的执行单位,共享进程的数据空间和系统资源。

进程和线程的主要区别在于资源的占用和拥有关系,进程拥有独立的资源,而线程共享进程的资源。

2. 进程调度算法常见的进程调度算法包括先来先服务(FCFS)、短作业优先(SJF)、最高优先权调度(HPF)、时间片轮转调度(RR)等。

不同的调度算法适用于不同的场景和需求,可以根据系统的实际情况选择合适的调度算法。

第三章:处理机调度与死锁1. 死锁的概念死锁是指系统中若干进程因竞争系统资源而陷入无限等待的状态,无法继续执行下去。

操作系统原理期末考试客观题及答案

操作系统原理期末考试客观题及答案

一、单选题1、操作系统的基本功能是()。

A.提供用户界面方便用户使用B.提供功能强大的网络管理工具C,控制和管理系统内的各种资源D.提供方便的可视化编辑程序正确答案:C2、系统调用的目的是()。

A.释放系统资源B.请求系统服务C.中止系统服务D.申请系统资源正确答案:B3、在中断发生后,进入中断处理的程序属于()oA.用户程序B.操作系统程序C.可能是应用程序,也可能是操作系统程序D.既不是应用程序,也不是操作系统程序正确答案:B4、当CPU处于核心态时,它可以执行的指令是()。

A.只有“访管”指令c∙计算机中全部指令D.只有特权指令正确答案:C5、PCB是进程实体的一部分,下列O不属于PCB。

A.全局变量B.堆栈指针C.CPU状态D.进程ID正确答案:A6、分时操作系统通常采用()调度算法来为用户服务。

A.时间片轮转B.优先级C.先来先服务D.短作业优先正确答案:A7、在进程调度算法中,对短进程不利的是()。

A.多级反馈队列调度算法B.优先级C.先来先服务调度算法D.短进程优先调度算法正确答案:C8、P、V操作实现进程同步,信号量的初值为()。

A.2B.lC.-lD.0正确答案:D9、对于两个并发进程,设互斥信号量为mutex(初值为1),若mutex=-l则()。

A.表示有一个进程进入临界区,另一个进程等待进入B.表示有两个进程进入临界区C.表示没有进程进入临界区D.表示有一个进程进入临界区正确答案:A10、有一个计数信号量S:若干个进程对S进行了28次P操作和18次V操作之后,信号量S的值为0,请问该信号量S原来的值是多少?A.5B.10C.13D.18正确答案:B11、信箱通信是一种()通信方式。

A.信号量B,直接通信C.低级通信D.间接通信正确答案:D12、死锁预防是保证系统不进入死锁状态的静态策略,其决办法是破环产生死锁的四个必要条件之一,下列方法中破坏了“循环等待”条件的是()oA.剥夺资源法B.资源有序分配策略C.一次性分配略D.银行家算法正确答案:B13、某系统中共有11台磁带机,X个进程共享此磁带机设备,每个进程最多请求使用3台,则系统不会死锁的X值是()oA.7B.5C.3D.6正确答案:B14、一个进程在获得资源后,只能在使用完资源后由自己释放,这属于死锁必要条件的()。

操作系统期末考试题及答案

操作系统期末考试题及答案

操作系统期末考试题及答案一、选择题(每题2分,共20分)1. 在操作系统中,进程和线程的主要区别是:A. 进程有独立的内存空间,线程共享内存空间B. 进程和线程没有区别C. 进程和线程共享内存空间D. 线程有独立的内存空间,进程共享内存空间答案:A2. 以下哪个是操作系统的五大基本功能之一?A. 文件管理B. 网络通信C. 用户界面D. 数据加密答案:A3. 在分页存储管理中,页表的作用是:A. 存储进程的代码和数据B. 实现虚拟内存C. 存储页的物理地址D. 映射虚拟地址到物理地址答案:D4. 死锁的必要条件不包括:A. 互斥条件B. 请求和保持条件C. 不剥夺条件D. 循环等待条件答案:B5. 在操作系统中,文件系统的主要作用是:A. 管理进程B. 管理内存C. 管理设备D. 管理文件和目录答案:D(此处省略其他选择题)二、简答题(每题10分,共30分)1. 简述进程和程序的区别。

答案:进程是程序在执行时的状态,包括程序代码、数据、堆栈等,是资源分配的基本单位。

程序是静态的指令集合,是进程执行的指令集合,不包含执行状态信息。

2. 描述死锁的概念及其产生的原因。

答案:死锁是指在多进程系统中,两个或多个进程因争夺资源而造成的一种僵局,每个进程都在等待其他进程释放资源,而其他进程又在等待它释放资源,导致系统无法继续运行。

死锁产生的原因通常包括:互斥条件、请求和保持条件、不剥夺条件和循环等待条件。

3. 解释虚拟内存的概念及其工作原理。

答案:虚拟内存是一种内存管理技术,它允许计算机通过硬盘空间来扩展可用的内存。

操作系统将虚拟内存划分为多个页面,当物理内存不足时,可以将一些不常用的页面从物理内存移动到硬盘上,这个过程称为页面置换。

虚拟内存使得程序可以使用比物理内存更大的地址空间,提高了内存的使用效率。

三、计算题(每题15分,共30分)1. 假设有一个具有4个页面的程序,页面大小为4KB,程序的起始地址为0x1000,页面起始地址为0x0。

操作系统期末考试试题及答案

操作系统期末考试试题及答案

操作系统期末考试试题及答案一、选择题(每题2分,共20分)1. 在操作系统中,进程和程序的区别是什么?A. 进程是程序的执行实例B. 程序是进程的执行实例C. 进程和程序是同一个概念D. 进程是程序的存储介质答案:A2. 死锁的必要条件包括以下哪几个?A. 互斥条件、占有和等待、不可剥夺条件、循环等待条件B. 互斥条件、占有和等待、可剥夺条件、循环等待条件C. 互斥条件、释放和等待、不可剥夺条件、循环等待条件D. 互斥条件、占有和等待、可剥夺条件、非循环等待条件答案:A3. 虚拟内存技术允许计算机执行以下哪项操作?A. 运行比物理内存大的程序B. 存储更多的数据C. 加速程序的执行D. 减少程序的执行时间答案:A4. 在现代操作系统中,分页和分段的区别是什么?A. 分页是连续内存分配,分段是离散内存分配B. 分页是离散内存分配,分段是连续内存分配C. 分页和分段都是连续内存分配D. 分页和分段都是离散内存分配答案:B5. 操作系统中的文件系统的主要功能是什么?A. 存储和管理文件B. 管理进程C. 管理内存D. 管理输入输出设备答案:A...(此处省略其他选择题)二、简答题(每题10分,共30分)1. 简述操作系统的五大基本功能。

答案:操作系统的五大基本功能包括:进程管理、内存管理、文件系统管理、输入/输出设备管理和用户接口管理。

2. 解释什么是时间片轮转调度算法,并说明其优缺点。

答案:时间片轮转调度算法是一种CPU调度算法,它将CPU时间分配给每个进程,每个进程被分配一个固定的时间片。

当一个进程的时间片用完后,CPU将被分配给下一个进程。

优点包括公平性和响应时间的可预测性。

缺点是上下文切换的开销可能会影响性能。

3. 描述文件系统的层次结构,并解释每个层次的功能。

答案:文件系统的层次结构通常包括文件系统管理器、文件目录和文件。

文件系统管理器负责管理整个文件系统,文件目录用于组织文件,而文件则是存储数据的基本单元。

操作系统概念(第七版 翻译版)复习题

操作系统概念(第七版 翻译版)复习题

2011-12操作系统复习题(一)进程同步●进程同步1进程P1和进程P2并发执行时满足一定的时序关系,P1的代码段S1执行完后,才能执行P2的代码段S2.为描述这种同步关系, :试设计相应的信号量, :给出信号量的初始值,●:给出进程P1和P2的结构●进程同步2问题描述:(理发店问题)一个理发店有一间配有n个椅子的等待室和一个有理发椅的理发室。

如果没有顾客,理发师就睡觉;如果顾客来了二所有的椅子都有人,顾客就离去;如果理发师在忙而有空的椅子,顾客就会坐在其中一个椅子;如果理发师在睡觉,顾客会摇醒他。

①给出同步关系②设计描述同步关系的信号量;③给出满足同步关系的进程结构(请完成满足同步关系的进程结构)。

●进程同步2设公共汽车上,司机和售票员的活动分别为:司机的活动为启动车辆,正常行车,到站停车;售票员的活动为关车门,售票,开车门。

给出在汽车不断地到站、停车、行驶过程中,司机和售票员的活动的同步关系。

用信号量和wait, signal操作实现他们间的协调操作。

●进程同步3:某高校计算机系开设网络课并安排上机实习,假设机房共有2m台机器,有2n名学生选该课,规定:(1)每两个学生组成一组,各占一台机器,协同完成上机实习;(2)只有凑够两个学生,并且此时机房有空闲机器,门卫才允许该组学生进入机房;(3)上机实习由一名教师检查,检查完毕,一组学生才可以离开机房。

试用信号量机制实现它们的同步关系。

进程同步4:多个进程对信号量S进行了5次 wait操作,2次signal操作后,现在信号量的值是-3,与信号量S相关的处于阻塞状态的进程有几个?信号量的初值是多少?进程同步5:使用两个进程计算Y=F1(X)+F2 (X). 在这个问题中,F1(X)和F2 (X)的计算是可以并行处理的,因此F1(X)和F2 (X)可以分别出现在两个进程中。

在F1(X)+F2 (X)中,必须在F1(X)和F2(X)计算完毕,才能进行加法运算,因此本问题是同步问题。

操作系统原理期末试卷及答案

操作系统原理期末试卷及答案

操作系统原理试卷1一、填空题(20分)1.在操作系统中, _________是资源分配、调度和管理的最小单位。

2.不在主机控制下进行的输入/输出操作称为______________操作。

3.在操作系统中,不可中断执行的操作为_____________。

4.当系统采用资源有序分配方法预防死锁时,它破坏产生死锁的必要条件中的___________。

5.利用SPOOLING技术可以将___________设备改造成可共享的虚拟设备。

6.系统中各进程之间逻辑上的相互制约关系称为__________。

7.访问磁盘的时间由三部分构成,即_________,__________和_________。

8.文件的逻辑结构分为流式文件和_________。

二、简答题(20分)1.为什么说PCB是进程存在的唯一标志?2.比较段式管理和页式管理。

3.在请求分页系统中,产生抖动的原因是什么?4.调度的类型有哪几种?5. 为什么说程序并发执行失去了封闭性和可再现性?三、计算题(30分)1. 若一个作业的运行时间为2小时,等待时间为3小时,计算机其响应比。

2.如下访问序列:0,1,0,3,1,2,4,3,驻留集大小为2,计算OPT算法的缺页中断率。

3.对于具有快表的分页系统,内存访问时间200ns,快表的访问时间20ns,快表的命中率为85%,计算数据的访问时间。

4.当前磁头位于20号磁道,多个磁盘请求:10、22、20、2、40、6、38,计算电梯算法(磁道号增加的方向)的寻道距离。

5.假定磁盘块大小为2KB,对于20G的硬盘,计算其文件分配表FAT占用的空间。

四、有一系统采用请求页式存储管理,有一作业大小是8KB,页大小为2KB,已知1号、2号页面已调入内存,且对应块号为第7、9块,试问虚地址0AFEH,1ADDH对应页面是否在内存,若在求其内存地址。

(10分)五、以两个用户A、B共享同一文件File1为例,用图的方式说明基于索引结点的共享方式和利用符号链的共享方式的原理。

操作系统概念第七版答案(含编程代码)

操作系统概念第七版答案(含编程代码)

solutions to the exercisesChapter 11.1 In a multiprogramming and time-sharing environment, several users share the system simultaneously. This situation can result in various security problems.a. What are two such problems?b. Can we ensure the same degree of security in a time-shared machine as in a dedicated machine? Explain your answer.Answer:a. Stealing or copying one’s programs or data; using system resources (CPU, memory, disk space, peripherals) without proper accounting.b. Probably not, since any protection scheme devised by humans can inevitably be broken by a human, and the more complex the scheme, the more difficult it is to feel confident of its correct implementation.1.2 The issue of resource utilization shows up in different forms in different types of operating systems. List what resources must be managedcarefully in the following settings: a. Mainframe or minicomputer systems b. Workstations connected to servers c. Handheld computersAnswer:a. Mainframes:memory and CPU resources, storage, network bandwidth.b. Workstations: memory and CPU resoucesc. Handheld computers: power consumption, memory resources.1.3 Under what circumstances would a user be better off using a timesharing system rather than a PC or single-user workstation?Answer: When there are few other users, the task is large, and the hardware is fast, time-sharingmakes sense. The full power of the system can be brought to bear on the user’s problem. The problemcan be solved faster than on a personal computer. Another case occurs when lots of other users need resources at the same time.A personal computer is best when the job is small enough to be executed reasonably on it and when performance is sufficient to execute the program to the user’s satisfaction.1.4 Which of the functionalities listed below need to be supported by the operating system for the following two settings: (a) handheld devices and (b) real-time systems. a. Batch programming b. Virtual memory c. Time sharingAnswer: For real-time systems, the operating system needs to support virtual memory and time sharing in a fair manner. For handheld systems,the operating system needs to provide virtual memory,but does not need to provide time-sharing. Batch programming is not necessary in both settings.1.5 Describe the differences between symmetric and asymmetric multiprocessing.What are three advantages and one disadvantage of multiprocessor systems?Answer: Symmetric multiprocessing treats all processors as equals, and I/O can be processed on any CPU. Asymmetric multiprocessing has one master CPU and the remainder CPUs are slaves. The master distributes tasks among the slaves, and I/O is usually done by the master only. Multiprocessors can save money by not duplicating power supplies,housings, and peripherals. They can execute programs more quickly and can have increased reliability. They are also more complex in both hardware and software than uniprocessor systems.1.6 How do clustered systems differ from multiprocessor systems? What is required for two machines belonging to a cluster to cooperate to provide a highly available service?Answer: Clustered systems are typically constructed by combining multiple computers into a single system to perform a computational task distributed across the cluster. Multiprocessor systems on the other hand could be a single physical entity comprising of multiple CPUs. A clustered system is less tightly coupled than a multiprocessor system.Clustered systems communicate using messages, while processors in a multiprocessor system could communicate using shared memory.In order for twomachines to provide a highly available service, the state on the two machines should be replicated and should be consistently updated. When one of the machines fail, the other could then take-over the functionality of the failed machine.1.7 Distinguish between the client-server and peer-to-peer models of distributed systems. Answer: The client-server model firmly distinguishes the roles of the client and server. Under this model, the client requests services that are provided by the server. The peer-to-peer model doesn’t have such strict roles. In fact, all nodes in the system are considered peers and thus may act as either clients or servers - or both. A node may request a service from another peer, or the node may in fact provide such a service to other peers in the system.For example, let’s consider a system of nodes that share cooking recipes.Under the client-server model, all recipes are stored with the server. If a client wishes to access a recipe, it must request the recipe from the specified server. Using the peer-to-peer model, a peer node could ask other peer nodes for the specified recipe. The node (or perhaps nodes) with the requested recipe could provide it to the requesting node. Notice how each peer may act as both a client (i.e. it may request recipes) and as a server (it may provide recipes.)1.8 Consider a computing cluster consisting of twonodes running adatabase.Describe two ways in which the cluster software can manage access to the data on the disk. Discuss the benefits and disadvantages of each.Answer: Consider the following two alternatives: asymmetric clustering and parallel clustering. With asymmetric clustering, one host runs the database application with the other host simply monitoring it.If the server fails, the monitoring host becomes the active server. This is appropriate for providing redundancy. However, it does not utilize the potential processing power of both hosts. With parallel clustering, the database application can run in parallel on both hosts. The difficulty implementing parallel clusters is providing some form of distributed locking mechanism for files on the shared disk.1.9 How are network computers different from traditional personal computers? Describe some usage scenarios in which it is advantageous to use network computers.Answer: A network computer relies on a centralized computer for most of its services. It can therefore have a minimal operating system to manage its resources. A personal computer on the other hand has to be capable of providing all of the required functionality in a standalonemanner without relying on a centralized manner. Scenarios where administrative costs are high and where sharing leads to more efficient use of resources are precisely those settings where network computers are preferred.1.10 What is the purpose of interrupts? What are the differences between a trap and an interrupt? Can traps be generated intentionally by a user program? If so, for what purpose?Answer: An interrupt is a hardware-generated change-of-flow within the system. An interrupt handler is summoned to deal with the cause of the interrupt; control is then returned to the interrupted context and instruction. A trap is a software-generated interrupt. An 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 system routines or to catch arithmetic errors.1.11 Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU′s execution load.a. How does the CPU interface with the device to coordinate the transfer?b. How does the CPU know when the memory operations are complete?c. The CPU is allowed to execute other programs while the DMA controller is transferring data. Does this process interfere with the execution of the user programs? If so, describe what forms of interference are caused.Answer: The CPU can initiate a DMA operation by writing values into special registers that can be independently accessed by the device.The device initiates the corresponding operation once it receives a command from the CPU. When the device is finished with its operation, it interrupts the CPU to indicate the completion of the operation.Both the device and the CPU can be accessing memory simultaneously.The memory controller provides access to the memory bus in a fair manner to these two entities. A CPU might therefore be unable to issue memory operations at peak speeds since it has to compete with the device in order to obtain access to the memory bus.1.12 Some computer systems do not provide a privileged mode of operation in hardware. Is it possible to construct a secure operating system for these computer systems? Give arguments both that it is and that it is not possible.Answer: An operating system for a machine of this type would need to remain in control (or monitor mode) at all times. This could be accomplished by two methods:a. Software interpretation of all user programs (like some BASIC,Java, and LISP systems, for example). The software interpreter would provide, in software, what the hardware does not provide.b. Require meant that all programs be written in high-level languages so that all object code is compiler-produced. The compiler would generate (either in-line or by function calls) the protection checks that the hardware is missing.1.13 Give two reasons why caches are useful.What problems do they solve? What problems do they cause? If a cache can be made as large as the device for which it is caching (for instance, a cache as large as a disk), why not make it that large and eliminate the device?Answer: Caches are useful when two or more components need to exchange data, and the components perform transfers at differing speeds.Caches solve the transfer problem by providing a buffer of intermediate speed between the components. If the fast device finds the data it needs in the cache, it need not wait for the slower device. The data in the cache must be kept consistent with the data in the components. If a omponent has a data value change, and the datum is also in the cache, the cache must also be updated. This is especially a problem on multiprocessor systemswhere more than one process may be accessing a datum.Acomponent may be eliminated by an equal-sized cache, but only if: (a) the cache and the component have equivalent state-saving capacity (that is,if the component retains its data when electricity is removed, the cache must retain data as well), and (b) the cache is affordable, because faster storage tends to be more expensive.1.14 Discuss, with examples, how the problem of maintaining coherence of cached data manifests itself in the following processing environments:a. Single-processor systemsb. Multiprocessor systemsc. Distributed systemsAnswer: In single-processor systems, the memory needs to be updated when a processor issues updates to cached values. These updates can be performed immediately or in a lazy manner. In amultiprocessor system,different processors might be caching the same memory location in its local caches. When updates are made, the other cached locations need to be invalidated or updated. In distributed systems, consistency of cached memory values is not an issue. However, consistency problems might arise when a client caches file data.1.15 Describe a mechanism for enforcing memory protection in order to prevent a program from modifying the memory associated with other programs.Answer: The processor could keep track of what locations are associated with each process and limit access to locations that are outside of a program’s extent. Information regarding the extent of a program’s memory could be maintained by using base and limits registers and by performing a check for every memory access.1.16 What network configuration would best suit the following environments?a. A dormitory floorb. A university campusc. A stated. A nationAnswer:a. A dormitory floor - A LAN.b. A university campus - A LAN, possible a WAN for very large campuses.c. A state - AWAN.d. A nation - A WAN.1.17 Define the essential properties of the following types of operating systems:a. Batchb. Interactivec. Time sharingd. Real timee. Networkf. Parallelg. Distributedh. Clusteredi. HandheldAnswer:a. Batch. Jobs with similar needs are batched together and run through 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, andmultiprogramming. Batch is good for executing large jobs that need little interaction; it can be submitted and picked up later.b. Interactive. This system is composed of many short transactions where the results of the next transaction may be unpredictable. Response time needs to be short (seconds) since the user submits and waits for the result.c. Time sharing. This systems uses CPU scheduling and multiprogramming to provide economical interactive use of a system. The CPU switches rapidly from one user to another. Instead of having a job defined by spooled card images, each program reads its next control card from the terminal, and output is normally printed immediately to the screen.d. Real time. Often used in a dedicated application, this system reads information from sensors and must respond within a fixed amount of time to ensure correct performance.e. Network. Provides operating system features across a network such as file sharing.f. SMP. Used in systems where there are multiple CPU’s eac h running the same copy of the operating munication takes place across the system bus.g. Distributed.This system distributes computation among several physical processors. The processors do not share memory or 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 localarea network.h. Clustered. A clustered system combines multiple computers into a single system to perform computational task distributed across the cluster.i. Handheld. A small computer system that performs simple tasks such as calendars, email, and web browsing. Handheld systems differ from traditional desktop systemswith smallermemory and display screens and slower processors.1.18 What are the tradeoffs inherent in handheld computers?Answer: Handheld computers are much smaller than traditional desktop PC’s. This results in smaller memory, smaller screens, and slower processing capabilities than a standard desktop PC. Because of these limitations,most handhelds currently can perform only basic tasks such as calendars, email, and simple word processing. However, due to their small size, they are quite portable and, when they are equipped with wireless access, can provide remote access to electronic mail and the world wide web.Chapter 22.1 The services and functions provided by an operating system can be divided into two main categories. Briefly describe the two categories and discuss how they differ.Answer: One class of services provided by an operating system is to enforce protection between different processes running concurrently in the system. Processes are allowed to access only thosememory locations that are associated with their address spaces. Also, processes are not allowed to corrupt files associated with other users. A process is also not allowed to access devices directly without operating system ntervention.The second class of services provided by an operating system is to provide new functionality that is not supported directly by the underlying hardware. Virtual memory and file systems are two such examples of new services provided by an operating system.2.2 List five services provided by an operating system that are designed to make it more convenient for users to use the computer system. In what cases it would be impossible for user-level programs to provide these services? Explain.Answer:• Program execution. The operating system loads the contents (or sections) of a file into memory and begins its execution. A user-level program could not be trusted to properly allocate CPU time.• I/O operations. Disks, tapes, serial lines, and other devices must be communicated with at a very low level. The user need only specify the device and the operation to perform on it, while the system converts that request into device- or controller-specific commands. User-level programs cannot be trusted to only access devices they should have access to and to only access them when they areotherwise unused.• File-system manipulation. There are many details in file creation, deletion, allocation, and naming that users should not have to perform. Blocks of disk space are used by files and must be tracked. Deleting a file requires removing the name file information and freeing the allocated blocks. Protections must also be checked to assure proper file access. User programs could neither ensure adherence to protection methods nor be trusted to allocate only free blocks and deallocate blocks on file deletion.• Communications. M essage passing between systems requires messages be turned into packets of information, sent to the network controller,transmitted across a communications medium, and reassembled by the destination system. Packet ordering and data correction must take place. Again, user programs might not coordinate access to the network device, or they might receive 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 changed 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 andunallocated blocks of storage match the total number on the device. There, errors are frequently process-independent (for instance, the corruption of data on a disk), so there must 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.2.3 Describe three general methods for passing parameters to the operating system.Answer:a. Pass parameters in registersb. Registers pass starting addresses of blocks of parametersc. Parameters can be placed, or pushed, onto the stack by the program, and popped off the stack by the operating system.2.4 Describe how you could obtain a statistical profile of the amount of time spent by a program executing different sections of its code.Discuss the importance of obtaining such a statistical profile.Answer: One could issue periodic timer interrupts and monitor what instructions or what sections of code are currently executing when the interrupts are delivered. A statistical profile of which pieces of code were active should be consistent with the time spent by the program in different sections of its code. Once such a statistical profile has been obtained, the programmer could optimize those sections of code that are consuming more of the CPU resources.2.5 What are the five major activities of an operating system in regard to file management?Answer:• The creati on and deletion of files• The creation and deletion of directories• The support of primitives for manipulating files and directories• The mapping of files onto secondary storage• The backup of files on stable (nonvolatile) storage media2.6 What are the advantages and disadvantages of using the same systemcall interface for manipulating both files and devices?Answer: Each device can be accessed as though it was a file in the file system. Since most of the kernel deals with devices through this file interface,it is relatively easy to add a new device driver by implementing the hardware-specific code to support this abstract file interface. Therefore,this benefits the development of both user program code, which can bewritten to access devices and files in the samemanner, and device driver code, which can be written to support a well-defined API. The disadvantage with using the same interface is that it might be difficult to capture the functionality of certain devices within the context of the file access API, thereby either resulting in a loss of functionality or a loss of performance. Some of this could be overcome by the use of ioctl operation that provides a general purpose interface for processes to invoke operations on devices.2.7 What is the purpose of the command interpreter? Why is it usually separate from the kernel? Would it be possible for the user to develop a new command interpreter using the system-call interface provided by the operating system?Answer: It reads commands from the user or from a file of commands and executes them, usually by turning them into one or more system calls. It is usually not part of the kernel since the command interpreter is subject to changes. An user should be able to develop a new command interpreter using the system-call interface provided by the operating system. The command interpreter allows an user to create and manage processes and also determine ways by which they communicate (such as through pipes and files). As all of this functionality could be accessed by an user-level program using the system calls, it should be possible for the user to develop a new command-line interpreter.2.8 What are the two models of interprocess communication? What are the strengths and weaknesses of the two approaches?Answer: The two models of interprocess communication are message-passing model and the shared-memory model.2.9 Why is the separation of mechanism and policy desirable?Answer: Mechanism and policymust be separate to ensure that systems are easy to modify. No two system installations are the same, so each installation may want to tune the operating system to suit its needs.With mechanism and policy separate, the policy may be changed at will while the mechanism stays unchanged. This arrangement provides a more flexible system.2.10 Why does Java provide the ability to call from a Java program native methods that are written in, say, C or C++? Provide an example of a situation in which a native method is useful.Answer: Java programs are intended to be platform I/O independent. Therefore, the language does not provide access to most specific system resources such as reading fromI/O devices or ports. To perform a system I/O specific operation, you must write it in a language that supports such features (such as C or C++.) Keep in mind that a Java program that calls a native method written in another language will no longer be architecture-neutral.2.11 It is sometimes difficult to achieve a layered approach if two components of the operating system are dependent on each other. Identify a scenario in which it is unclear how to layer two system components that require tight coupling of their functionalities.Answer: The virtual memory subsystem and the storage subsystem are typically tightly-coupled and requires careful design in a layered system due to the following interactions. Many systems allow files to be mapped into the virtual memory space of an executing process. On the other hand, the virtualmemory subsystem typically uses the storage system to provide the backing store for pages that do not currently reside in memory. Also, updates to the filesystem are sometimes buffered in physical memory before it is flushed to disk, thereby requiring careful coordination of the usage of memory between the virtual memory subsystem and the filesystem.2.12 What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in amicrokernel architecture? What are the disadvantages of using the microkernel approach?Answer: Benefits typically include the following (a) adding a new service does not require modifying the kernel, (b) it is more secure as more operations are done in user mode than in kernel mode, and (c) a simpler kernel design and functionality typically results in a more reliable operating system. User programs and system services interact in a microkernel architecture by using interprocess communication mechanisms such asmessaging. These messages are conveyed by the operating system. The primary disadvantage of the microkernel architecture are the overheads associated with interprocess communication and the frequent use of the operating system’s messaging functions in order to enable the user process and the system service to interact with each other.2.13 In what ways is the modular kernel approach similar to the layered approach? In what ways does it differ from the layered approach?Answer: The modular kernel approach requires subsystems to interact with each other through carefully constructed interfaces that are typically narrow (in terms of the functionality that is exposed to external modules). The layered kernel approach is similar in that respect. However, the layered kernel imposes a strict ordering of subsystems such that subsystems at the lower layers are not allowed to invoke operations corresponding to the upper-layer subsystems. There are no such restrictions in the modular-kernel approach, wherein modules are free to invoke each other without any constraints.2.14 What is the main advantage for an operating-system designer of using a virtual-machine architecture? What is the main advantage for a user?Answer: The system is easy to debug, and security problems are easy to solve. Virtual machines also provide a good platform for operating system research sincemany different operating systemsmay run on one physical system.2.15 Why is a just-in-time compiler useful for executing Java programs?Answer: Java is an interpreted language. This means that the JVM interprets the bytecode instructions one at a time. Typically,most interpreted environments are slower than running native binaries, for the interpretation process requires converting each instruction into native machine code. A just-in-time (JIT) compiler compiles the bytecode for a method into native machine code the first time the method is encountered. This means that the Java program is essentially running as a native application(of course, the conversion process of the JIT takes time as wellbut not as much as bytecode interpretation.) Furthermore, the JIT caches compiled code so that it may be reused the next time the method is encountered.A Java program that is run by a JIT rather than a traditional interpreter typically runs much faster.2.16 What is the relationship between a guest operating system and a host operating system in a system like VMware? What factors need to be considered in choosing the host operating system?Answer: A guest operating system provides its services by mapping them onto the functionality provided by the host operating system. A key issue that needs to be considered in choosing the host operating system is whether it is sufficiently general in terms of its system-call interface in order to be able to support the functionality associated with the guest operating system.2.17 The experimental Synthesis operating system has an assembler incorporatedwithin the kernel. To optimize system-call performance, the kernel assembles routineswithin kernel space to minimize the path that the system call must take through the kernel. This approach is the antithesis of the layered approach, in which the path through the kernel is extended to make building the operating system easier. Discuss the pros and cons of the Synthesis approach to kernel design and to system-performance optimization.Answer: Synthesis is impressive due to the performance it achieves through on-the-fly compilation. Unfortunately, it is difficult to debug problems within the kernel due to the fluidity of the code. Also, such compilation is system specific, making Synthesis difficult to port (a new compiler must be written for each architecture).2.18 In Section 2.3,we described a program that copies the contents of one file to a destination file. This program works by first prompting the user for the name of the source and destination files. Write this program using either the Windows32 or POSIX API. Be sure to include all necessary error checking, including ensuring that the source file exists. Once you have correctly designed and tested。

操作系统概念第七版习题答桉(中文版

操作系统概念第七版习题答桉(中文版

·1.1在多道程序和分时环境中,多个用户同时共享一个系统,这种情况导致多种安全问题。

a. 列出此类的问题b.在一个分时机器中,能否确保像在专用机器上一样的安全度?并解释之。

Answer:a.窃取或者复制某用户的程序或数据;没有合理的预算来使用资源(CPU,内存,磁盘空间,外围设备)b.应该不行,因为人类设计的任何保护机制都会不可避免的被另外的人所破译,而且很自信的认为程序本身的实现是正确的是一件困难的事。

1.2资源的利用问题在各种各样的操作系统中出现。

试例举在下列的环境中哪种资源必须被严格的管理。

(a)大型电脑或迷你电脑系统(b)与服务器相联的工作站(c)手持电脑Answer:(a)大型电脑或迷你电脑系统:内存和CPU资源,外存,网络带宽(b)与服务器相联的工作站:内存和CPU资源(c)手持电脑:功率消耗,内存资源1.3在什么情况下一个用户使用一个分时系统比使用一台个人计算机或单用户工作站更好?Answer:当另外使用分时系统的用户较少时,任务十分巨大,硬件速度很快,分时系统有意义。

充分利用该系统可以对用户的问题产生影响。

比起个人电脑,问题可以被更快的解决。

还有一种可能发生的情况是在同一时间有许多另外的用户在同一时间使用资源。

当作业足够小,且能在个人计算机上合理的运行时,以及当个人计算机的性能能够充分的运行程序来达到用户的满意时,个人计算机是最好的,。

1.4在下面举出的三个功能中,哪个功能在下列两种环境下,(a)手持装置(b)实时系统需要操作系统的支持?(a)批处理程序(b)虚拟存储器(c)分时Answer:对于实时系统来说,操作系统需要以一种公平的方式支持虚拟存储器和分时系统。

对于手持系统,操作系统需要提供虚拟存储器,但是不需要提供分时系统。

批处理程序在两种环境中都是非必需的。

1.5描述对称多处理(SMP)和非对称多处理之间的区别。

多处理系统的三个优点和一个缺点?Answer:SMP意味着所以处理器都对等,而且I/O可以在任何处理器上运行。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

操作系统期末考试试卷(B)
计算机科学系______级______科______班姓名__________学号__________
题号一二三四总分
分数
ア、 填空(1%×30) ★该题答写在本卷纸上★
1.操作系统的基本类型有1)____________________
2)____________________
3)____________________4)___________________5)___________________
_ 和6)分布式操作系统等。

2.常用的进程调度算法和作业调度算法有1)____________________
2)___________________ 3)___________________
4)____________________ 5)____________________ 和6)最高相应比优
先(HRN)算法等。

3.作业调度的目标主要有1)____________________
2)____________________
3)____________________4)___________________。

4.内存管理要解决的问题有1)_________________ 2)____________________
3)____________________4)___________________5)___________________。

5.常用的内存管理方法有1)单一连续区管、2)___________________
3)___________________ 和4)____________________等。

6.作业由1) 程序、2)__________________和3)__________________组成。

1
7.常用的记录式文件有1)____________________ 2)___________________
3)___________________ 4)____________________四种。

イ、 解释名词术语(4%×5) ★该题答写在本卷纸上★
1.通道:___________________________________________________
_____________________________________________________________。

2.进程:___________________________________________________
_____________________________________________________________。

3.文件的物理结构:________________________________________________
_____________________________________________________________。

4.虚拟存储器:___________________________________________________
_____________________________________________________________。

5.I/O控制:___________________________________________________
_____________________________________________________________。

ウ、 简要回答以下各题(6%×5) ★该题答写在附加卷纸上并写明题号★
1.动态页式管理的页表有哪些项目,在动态页式管理中起什么作用。

2.为什么要引入段页式管理。

3.DMA方式下进行数据传输时,DMA控制器的处理流程。

4.系统调用(陷入)处理过程。

5.UNIX文件的物理结构(文件映射关系)。

エ、 回答下述问题(10%×2) ★该题答写在附加卷纸上并写明题号★
1.文件系统是怎样实现按名存取和物理存储结构透明的。

2.设计缓冲池管理所需申请的算法GET_BUF( type )以及释放算法
PUT_BUF( type,number ),并分析它们之间的关系。

2。

相关文档
最新文档