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

合集下载

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

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

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可以在任何处理器上运行。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 可以在任何处理器上运行。

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

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

操作系统概念第七版答案(含编程代码)Operating system concepts(Seventh edition) 2021.3solutions to the exercisesChapter 11.1 In a multiprogramming and time-sharing environment, several usersshare 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 systemresources (CPU, memory, disk space, peripherals) without proper accounting.b. Probably not, since any protection scheme devised by humans caninevitably be broken by a human, and the more complex the scheme, the moredifficult it is to feel confident of its correct implementation.1.2 The issue of resource utilization shows up in different forms indifferent 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 atimesharing system rather than a PC or single-user workstation?Answer: When there are few other users, the task is large, and thehardware 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 thanon 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 tothe 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. TimesharingAnswer: For real-time systems, the operating system needs to supportvirtual memoryOperating system concepts(Seventh edition) 2021.3and time sharing in a fair manner. For handheld systems,the operatingsystem 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 ofmultiprocessor systems?Answer: Symmetric multiprocessing treats all processors as equals, and I/Ocan be processed on any CPU. Asymmetric multiprocessing has one master CPU andthe 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 ahighly available service?Answer: Clustered systems are typically constructed by combining multiple computers into a single system to perform a computational task distributedacross the cluster. Multiprocessor systems on the other hand could be a singlephysical entity comprising of multiple CPUs. A clustered system is lesstightly coupled than a multiprocessor system.Clustered systems communicateusing messages, while processors in a multiprocessor system could communicate using shared memory.In order for twomachines to provide a highly available service, the stateon the two machines should be replicated and should be consistently updated. When one of the machines fail, the other could then take-over thefunctionality 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 theclient 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 aseither 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 cookingrecipes.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 otherpeer nodes for the specified recipe.Operating system concepts(Seventh edition) 2021.3The node (or perhaps nodes) with the requested recipe could provide it tothe requesting node. Notice how each peer may act as both a client (i.e. itmay request recipes) and as a server (it may provide recipes.)1.8 Consider a computing cluster consisting of twonodes runningadatabase.Describe two ways in which the cluster software can manage access tothe 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 providingredundancy. However, it does not utilize the potential processing power ofboth hosts. With parallel clustering, the database application can run inparallel on both hosts. The difficulty implementing parallel clusters isproviding some form of distributed locking mechanism for files on the shared disk.1.9 How are network computers different from traditional personalcomputers? Describe some usage scenarios in which it is advantageous to use network computers.Answer: A network computer relies on a centralized computer for most ofits services. It can therefore have a minimal operating system to manage its resources. A personal computer on the other hand has to be capable ofproviding all of the required functionality in a standalonemanner withoutrelying on a centralized manner. Scenarios where administrative costs are highand 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 theinterrupt; control is then returned to the interrupted context and instruction.A trap is a software-generated interrupt. An interrupt can be used to signalthe 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 toavoid 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 controllerisOperating system concepts(Seventh edition) 2021.3transferring data. Does this process interfere with the execution of theuser 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 makeit 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 maybe 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, thecache must retain data as well), and (b) the cache is affordable, becausefaster storage tends to be more expensive.Operating system concepts(Seventh edition) 2021.31.14 Discuss, with examples, how the problem of maintaining coherence of cached data manifests itself in the following processing environments: a.Single-processor systems b. Multiprocessor systems c. 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,differentprocessors 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 toprevent a program from modifying the memory associated with other programs.Answer: The processor could keep track of what locations are associatedwith each process and limit access to locations that are outside of aprogram’s extent. Information regarding the extent of a program’s memorycould be maintained by using base and limits registers and by performing acheck 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)同理,接下来R欲申请1个资源也是不安全的分配,故不能分给。
5) Q申请2个资源时,假定操作系统分给它,Q进程将运行结束,Q释放的资源又可使P运行结束;P运行结束,释放的资源又可使R运行结束。所以这个分配是安全的,故将2个资源分给Q。
(2)不会死锁,因为银行家算法在任何时候均保证至少有一个进程能得到所需的全部资源,这样,得到资源的进程能及时归还资源供其他进程使用。
Answer2
一、判断题改错题
1.对。
2.错,原因:与进程执行速度有关。
3.错.线程是调度的基本单位,进程是资源分配的基本单位。
4.错,原因:分段存储管理易于实现用户使用内存空间的动态扩充。
5.对。
二、单项选择题
l. A 2.A 3. A 4. C 5. C
6. C 7. C 8. B 9. D lO.B
时刻8:P1结束。P2将得到P1释放的打印机,从阻塞变为就绪,且它是系统中惟一的进程,故选中P2投入执行。
时刻10:P3到达。P2己执行2个时间片,而P3则因申请内存而阻塞,故仍选中P2投入执行。
时刻11:P4到达。P2己执行3个时间片,P3仍阻塞,P4则因申请打印机而阻塞,故仍将选中P2投入执行。
3.这个问题实际上可看作是两个生产者和两个消费者共享了一个仅能存放一件产品的缓冲器。生产者各自生产不同的产品,消费者各自取自己需要的产品。利用P、y操作编程为
猎手进程农民进程动物园进程饭店进程
P(S)P(S)P(S1)P(S2)
放入虎放入猪买老虎买猪
V(S1)V(S2)V(S)V(S)
信号量初值:S=1,S1=0,S2=0。
(2,500)因为段内偏移500>段长100。故报地址越界错。
(3,400)物理地址=1237+400=1637。

操作系统概念第七版4-6章课后题答案(中文版)

操作系统概念第七版4-6章课后题答案(中文版)

操作系统概念第七版4-6章课后题答案(中⽂版)第四章线程4.1举两个多线程程序设计的例⼦来说明多线程不⽐单线程⽅案提⾼性能答:1)任何形式的顺序程序对线程来说都不是⼀个好的形式。

例如⼀个计算个⼈报酬的程序。

2)另外⼀个例⼦是⼀个“空壳”程序,如C-shell和korn shell。

这种程序必须密切检测其本⾝的⼯作空间。

如打开的⽂件、环境变量和当前⼯作⽬录。

4.2描述⼀下线程库采取⾏动进⾏⽤户级线程上下⽂切换的过程答:⽤户线程之间的上下⽂切换和内核线程之间的相互转换是⾮常相似的。

但它依赖于线程库和怎样把⽤户线程指给内核程序。

⼀般来说,⽤户线程之间的上下⽂切换涉及到⽤⼀个⽤户程序的轻量级进程(LWP)和⽤另外⼀个线程来代替。

这种⾏为通常涉及到寄存器的节约和释放。

4.3在哪些情况下使⽤多内核线程的多线程⽅案⽐单处理器系统的单个线程⽅案提供更好的性能。

答:当⼀个内核线程的页⾯发⽣错误时,另外的内核线程会⽤⼀种有效的⽅法被转换成使⽤交错时间。

另⼀⽅⾯,当页⾯发⽣错误时,⼀个单⼀线程进程将不能够发挥有效性能。

因此,在⼀个程序可能有频繁的页⾯错误或不得不等待其他系统的事件的情况下,多线程⽅案会有⽐单处理器系统更好的性能。

4.4以下程序中的哪些组成部分在多线程程序中是被线程共享的?a.寄存值b.堆内存c.全局变量d.栈内存答:⼀个线程程序的线程共享堆内存和全局变量,但每个线程都有属于⾃⼰的⼀组寄存值和栈内存。

4.5⼀个采⽤多⽤户线程的多线程⽅案在多进程系统中能够取得⽐在单处理器系统中更好的性能吗?答:⼀个包括多⽤户线程的多线程系统⽆法在多处理系统上同时使⽤不同的处理器。

操作系统只能看到⼀个单⼀的进程且不会调度在不同处理器上的不同进程的线程。

因此,多处理器系统执⾏多个⽤户线程是没有性能优势的。

4.6就如4.5.2章节描述的那样,Linux没有区分进程和线程的能⼒。

且Linux线程都是⽤相同的⽅法:允许⼀个任务与⼀组传递给clone()系统调⽤的标志的进程或线程。

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

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

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可以在任何处理器上运行。

操作系统概念第七版答案

操作系统概念第七版答案

操作系统概念第七版答案【篇一:操作系统概念第七版答案(含编程代码)】> 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. 操作系统的功能有哪些?
操作系统的功能主要包括:
(1)文件管理:操作系统提供文件管理功能,用户可以创建、删除、移动、复制、搜索和更改文件。

(2)设备管理:操作系统提供设备管理功能,用户可以控制
和管理计算机系统中的各种外部设备,如打印机、磁盘驱动器、
显示器等。

(3)内存管理:操作系统提供内存管理功能,用户可以控制
和管理计算机系统中的内存,以便更有效地利用内存资源。

(4)进程管理:操作系统提供进程管理功能,用户可以控制
和管理计算机系统中的各种进程,以便更有效地利用处理器资源。

(5)网络管理:操作系统提供网络管理功能,用户可以控制
和管理计算机系统中的网络,以便更有效地利用网络资源。

(6)安全性:操作系统提供安全性功能,用户可以控制和管
理计算机系统中的安全性,以便更有效地保护系统资源。

(7)可靠性:操作系统提供可靠性功能,用户可以控制和管
理计算机系统中的可靠性,以便更有效地保证系统的可靠性。

(8)可移植性:操作系统提供可移植性功能,用户可以控制
和管理计算机系统中的可移植性,以便更有效地实现系统的可移
植性。

操作系统概念第七版习题答案(中文版)完整版之欧阳育创编

操作系统概念第七版习题答案(中文版)完整版之欧阳育创编

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 在多道程序和分时环境中,多个用户同时共享一个系统,这种情况导致多种安全问题。

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

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.7 试区分分布式系统(distribute system)的客户机-服务器(client-server)模型与对等系统(peer-to-peer)模型Answer: 客户机-服务器(client-server)模型可以由客户机和服务器的角色被区分。

在这种模型下,客户机向服务器发出请求,然后服务器满足这种请求。

对等系统(peer-to-peer)模型没有这种严格的区分角色,。

实际上,在系统中的所有结点被看做是对等的,而且这些结点既可以是客户机也可以是服务器,或者两这都是。

也许一个结点从另一个对等结点上请求一个服务,或者,这个结点满足在系统中的另一个结点的请求。

比如,一个系统中的结点共享烹饪方法。

在客户机-服务器(client-server)模型下,所有方法都被存储在服务器上。

如果一个客户机想要获得烹饪方法,它必须向那台服务器发出请求。

在对等系统(peer-to-peer)模型下,一个结点可以向另外的结点请求指定的烹饪方法。

存储了这种烹饪方法的那个结点(或几个结点)可以把烹饪的方法提供给发出请求的结点。

注意每个对等结点既可以扮演客户机(发出请求),也可以扮演服务器(提供请求)。

1.8 如果一个由两个结点组成的集群系统正在运行一个数据库,试描述集群软件可以用哪两种方法管理存取磁盘的数据,并说明每种方法的优点和缺点。

Answer:两种方法:非对称集群系统(asymmetric clustering) 和并行集群系统(parallel clustering).对于非对称集群系统,一个主机运行这个数据库,而其它主机只是监测这个数据库。

如果服务器出现故障,进行监测的主机就会转变成运行这个数据库的主机。

这是提供适当的冗余。

然而,它没有利用具有潜在处理能力的主机。

对于并行集群系统,数据库可以在两个并行的主机上运行。

在并行集群系统上实现的困难是提供一些分布式锁机制给共享磁盘上的文件。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 在多道程序和分时环境中,多个用户同时共享一个系统,这种情况导致多种安全问题。

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)。

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. Anothe r 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 programmingb. Virtual memoryc. 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 usuallydone 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 orby 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 li mit 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 each 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 local area 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 canperform 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 are otherwise 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. Message passing between systems requires mes sages 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 creation and deletion of files• The creation and delet ion 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. Someof 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 theusage 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 thefunctionality 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 toa 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 the program, if you used a system that supports it, run the program using a utility that traces system calls. Linux systems provide the ptrace utility, and Solaris systems use the truss or dtrace command. On Mac OS X, the ktrace facility provides similar functionality.Answer://Solution 1:The Copy program implemented with file system calls of Linux.//This program was written by Wendell on Mar. 5,2008.// Usage: copy src dst#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#define BUFSIZE 8192int main( int argc, char ** argv){if (argc!=3){printf("\n usage: copy src dst\n");return -1;}int src, dst;char buf[BUFSIZE];。

相关文档
最新文档