92 Chapter 2 Operating-System Structures

is 2.4 What are the three major activities of an with regard 2.21 What to secondary-storage management? design? microker 2.5 What is the purpose of the command interpreter? Why is it Usually microkel separate from the kernel? 2.22 In what 2.6 What system calls have to be executed by a command interpreter or shell approacl in order to start a new process? 7o:·~?:) i': ,:ir\-'

,,,ha'. ;3 tncma.n advanLdg;?of the layered approach to system design? 2.24 Why is 2 What are the disadvantages of using the layered approach? 2.25 What is 2.9 List five services provided by an operating system, and explain how each operatill creates convenience for users. In which cases would it be impossible for consider user-level programs to provide these services? Explain your answer. 2.26 The exp 2.10 Why do some systems store the operating system in firmware, while porated others store it on disk? assembl systemc 2.11 How could a system be designed to allow a choice of operating systems from which to boot? What would the bootstrap program need to do? of the 1a: to make of the ~ optimiz

Exercises Programrning F 2.12 The services and functions provided by an operating system can be divided into two main categories. Briefly describe the two categories 2.27 In Secti: and discuss how they differ. to a des 2.13 Describe three general methods for passing parameters to the operating the nan system. either t checkir 2.14 Describe how you could obtain a statistical profile of the amount of time o spent by a program executing different sections of its code. Discuss the you us importance of obtaining such a statistical profile. that tra 2.15 What are the five major activities of an operating system with regard to Solaris file management? ktracE not pre 2.16 What are the advantages and disadvantages of using the same system- versior call interface for manipulating both files and devices? 2.17 Would it be possible for the user to develop a new command interpreter using the system-call interface provided by the operating system? Proorarnming-J 2.18 What are the two models of interprocess communication? What are the strengths and weaknesses of the two approaches? 2.28 AddiJ 2.19 Why is the separation of mechanism and policy desirable? In this Linux< 2.20 It is sometimes difficult to achieve a layered approach if two components the of the operating system are dependent on each other. Identify a scenario op a new in 'which it is unclear how to layer two system components that require of the tight coupling of their functionalities. Programming Projects 93

ng system with regard 2.21 What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in a microkernel architecture? What are the disadvantages of using the ter? Why is it usually microkernel approach? 2.22 In what ways is the modular kernel approach similar to the layered .and interpreter or shell approach? In what ways does it differ from the layered approach? 2.23 What is the main advantage for an operating-system designer of using a virtual-machine architecture? What is the main advantage for a user? oach to system design? 2.24 Why is a just-in-time compiler useful for executing Java programs? approach? 2.25 What is the relationship between a guest operating system and a host 1, and explain how each operating system in a system like VMware? What factors need to be uld it be impossible for considered in choosing the host operating system? xplain your answer. 2.26 The experimental Synthesis operating system has an assembler incor- em in firmware, while porated in the kernel. To optimize system-call performance, the kernel assembles routines within kernel space to minimize the path that the :e of operating systems must take through the kernel. This approach is the antithesis )rogram need to do? 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 system-performance optimization.

erating system can be Programming Problems 'ibe the two categories 2.27 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 meters to the operating the name of the source and destination files. Write this program using either the Win32 or POSIX API. Be sure to include all necessary error e of the amount of time checking, including ensuring that the source file exists. of its code. Discuss the 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 ; system with regard to Solaris systems use the truss or command. On Mac os x, the ktrace facility provides similar functionality. As Windows systems do Ising the same system- not provide such features, you will have to trace through the Win32 'ices? version of this program using a debugger. v command interpreter 'pcrating system?

11 io. \7 \ ;7 2.28 Adding a system call to the Linux desirable? In this project, you will study the system-call interface provided by the oach if two components Linux opera ting system and learn how user programs comm unica te with :her. Identify a scenario the operating system kernel via this interface. Your task is to incorporate »nponents that require a new system call into the kernel, thereby expanding the functionality of the operating system.