INSTRUCTOR’S MANUAL TO ACCOMPANY OPERATING- SYSTEM

Transcription

INSTRUCTOR’S MANUALTO ACCOMPANYOPERATINGSYSTEMCONCEPTSSEVENTH EDITIONABRAHAM SILBERSCHATZYale UniversityPETER BAER GALVINCorporate TechnologiesGREG GAGNEWestminster College

PrefaceThis volume is an instructor’s manual for the Seventh Edition of OperatingSystem Concepts, by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne.It consists of answers to the exercises in the parent text.Although we have tried to produce an instructor’s manual that will aidall of the users of our book as much as possible, there can always be improvements (improved answers, additional questions, sample test questions,programming projects, alternative orders of presentation of the material, additional references, and so on). We invite you to help us in improving this manual.If you have better solutions to the exercises or other items which would be ofuse with Operating-System Concepts, we invite you to send them to us for consideration in later editions of this manual. All contributions will, of course, beproperly credited to their contributor.Internet electronic mail should be addressed to os-book@cs.yale.edu.Physical mail may be sent to Avi Silberschatz, Department nof Computer Science, Yale University 51 Prospect Street, New Haven, CT 06520, USA.A. S.P. B. GG. G.iii

ContentsChapter 1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Chapter 2Operating-System Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Chapter 3Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Chapter 4Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Chapter 5CPU Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27Chapter 6Process Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Chapter 7Deadlocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Chapter 8Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Chapter 9Virtual Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61Chapter 10File-Systems Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71Chapter 11File-Systems Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75Chapter 12Mass Storage Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91Chapter 13I/O Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93Chapter 14Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99Chapter 15Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105Chapter 16Network Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Chapter 17Distributed Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Chapter 18Distributed-File Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121Chapter 19Multimedia Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Chapter 20Embedded Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131Chapter 21The Linux System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137Chapter 22Windows XP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145Chapter 23Influential Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149v

1CHAPTERIntroductionChapter 1 introduces the general topic of operating systems and a handful ofimportant concepts (multiprogramming, time sharing, distributed system, andso on). The purpose is to show why operating systems are what they are byshowing how they developed. In operating systems, as in much of computerscience, we are led to the present by the paths we took in the past, and we canbetter understand both the present and the future by understanding the past.Additional work that might be considered is learning about the particularsystems that the students will have access to at your institution. This is still justa general overview, as specific interfaces are considered in Chapter 3.Exercises1.1In a multiprogramming and time-sharing environment, several usersshare the system simultaneously. This situation can result in varioussecurity 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 properaccounting.b. Probably not, since any protection scheme devised by humanscan inevitably be broken by a human, and the more complexthe scheme, the more difficult it is to feel confident of its correctimplementation.1

2Chapter 1 Introduction1.2The 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 systemsb. 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.3Under 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 thehardware is fast, time-sharing makes sense. The full power of the systemcan be brought to bear on the user’s problem. The problem can be solvedfaster than on a personal computer. Another case occurs when lots ofother 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 theprogram to the user’s satisfaction.1.4Which of the functionalities listed below need to be supported by theoperating system for the following two settings: (a) handheld devicesand (b) real-time systems.a. Batch programmingb. Virtual memoryc. Time sharingAnswer: For real-time systems, the operating system needs to supportvirtual memory and time sharing in a fair manner. For handheld systems,the operating system needs to provide virtual memory, but does notneed to provide time-sharing. Batch programming is not necessary inboth settings.1.5Describe 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, andI/O can be processed on any CPU. Asymmetric multiprocessing has onemaster CPU and the remainder CPUs are slaves. The master distributestasks 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 quicklyand can have increased reliability. They are also more complex in bothhardware and software than uniprocessor systems.

Exercises31.6How do clustered systems differ from multiprocessor systems? What isrequired for two machines belonging to a cluster to cooperate to providea highly available service?Answer: Clustered systems are typically constructed by combiningmultiple computers into a single system to perform a computationaltask distributed across the cluster. Multiprocessor systems on the otherhand could be a single physical entity comprising of multiple CPUs. Aclustered system is less tightly coupled than a multiprocessor system.Clustered systems communicate using messages, while processors in amultiprocessor system could communicate using shared memory.In order for two machines to provide a highly available service, the stateon the two machines should be replicated and should be consistentlyupdated. When one of the machines fail, the other could then take-overthe functionality of the failed machine.1.7Distinguish 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 areprovided by the server. The peer-to-peer model doesn’t have such strictroles. In fact, all nodes in the system are considered peers and thus mayact as either clients or servers - or both. A node may request a servicefrom another peer, or the node may in fact provide such a service toother 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. Ifa client wishes to access a recipe, it must request the recipe from thespecified server. Using the peer-to-peer model, a peer node could askother peer nodes for the specified recipe. The node (or perhaps nodes)with the requested recipe could provide it to the requesting node. Noticehow each peer may act as both a client (i.e. it may request recipes) andas a server (it may provide recipes.)1.8Consider a computing cluster consisting of two nodes running a database.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 runsthe database application with the other host simply monitoring it. Ifthe server fails, the monitoring host becomes the active server. This isappropriate for providing redundancy. However, it does not utilize thepotential processing power of both hosts. With parallel clustering, thedatabase application can run in parallel on both hosts. The difficultyimplementing parallel clusters is providing some form of distributedlocking mechanism for files on the shared disk.1.9How are network computers different from traditional personal computers? Describe some usage scenarios in which it is advantageous touse network computers.Answer: A network computer relies on a centralized computer formost of its services. It can therefore have a minimal operating system

4Chapter 1 Introductionto manage its resources. A personal computer on the other hand hasto be capable of providing all of the required functionality in a standalone manner without relying on a centralized manner. Scenarios whereadministrative costs are high and where sharing leads to more efficientuse of resources are precisely those settings where network computersare preferred.1.10What is the purpose of interrupts? What are the differences between atrap and an interrupt? Can traps be generated intentionally by a userprogram? If so, for what purpose?Answer: An interrupt is a hardware-generated change-of-flow withinthe system. An interrupt handler is summoned to deal with the causeof the interrupt; control is then returned to the interrupted context andinstruction. A trap is a software-generated interrupt. An interrupt canbe used to signal the completion of an I/O to obviate the need for devicepolling. A trap can be used to call operating system routines or to catcharithmetic errors.1.11Direct memory access is used for high-speed I/O devices in order toavoid increasing the CPUś execution load.a. How does the CPU interface with the device to coordinate thetransfer?b. How does the CPU know when the memory operations are complete?c. The CPU is allowed to execute other programs while the DMAcontroller is transferring data. Does this process interfere withthe execution of the user programs? If so, describe what forms ofinterference are caused.Answer: The CPU can initiate a DMA operation by writing valuesinto 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, itinterrupts 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 fairmanner to these two entities. A CPU might therefore be unable to issuememory operations at peak speeds since it has to compete with thedevice in order to obtain access to the memory bus.1.12Some computer systems do not provide a privileged mode of operationin hardware. Is it possible to construct a secure operating system forthese computer systems? Give arguments both that it is and that it is notpossible.Answer: An operating system for a machine of this type would need toremain 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 interpreterwould provide, in software, what the hardware does not provide.

Exercises5b. Require meant that all programs be written in high-level languages so that all object code is compiler-produced. The compilerwould generate (either in-line or by function calls) the protectionchecks that the hardware is missing.1.13Give 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 thedevice 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

CONCEPTS SEVENTH EDITION ABRAHAM SILBERSCHATZ Yale University PETER BAER GALVIN Corporate Technologies GREG GAGNE Westminster College. Preface This volume is an instructor’s manual for the Seventh Edition of erBaerGalvin,andGregGagne. It consists of answers to File Size: 911KBPage Count: 156People also search foroperating system concepts 10th solutionsoperating system concepts 10th solutionsoperating system concepts 9th editionoperating system concepts 9th solutionoperating system concepts exercise soluti