1、1.1 What are the three main purposes of an operating system?Answer: To provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner. To allocate the separate resources of the computer as needed to solve the problem given. The allocation pro
2、cess should be as fair and efficient as possible. As a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) management of the operation and control of I/O devices.1.2 What are the main differences
3、 between operating systems for mainframe computers and personal computers?Answer: Generally, operating systems for batch systems have simpler requirements than for personal computers. Batch systems do not have to be concerned with interacting with a user as much as a personal computer. As a result,
4、an operating system for a PC must be concerned with response time for an interactive user. Batch systems do not have such requirements. A pure batch system also may have not to handletime sharing, whereas an operating system must switch rapidly between different jobs.1.3 List the four steps that are
5、 necessary to run a program on a completely dedicated machine.Answer:a. Reserve machine time.b. Manually load program into memory.c. Load starting address and begin execution.d. Monitor and control execution of program from console.1.4 We have stressed the need for an operating system to make effici
6、ent use of the computing hardware. When is it appropriate for the operating system to forsake this principle and to “waste” resources? Why is such a system not really wasteful?Answer: Single-user systems should maximize use of the system for the user. A GUI might “waste” CPU cycles, but it optimizes
7、 the users interaction with the system.1.5 What is themain difficulty that a programmer must overcome in writing an operating system for a real-time environment?Answer: The main difficulty is keeping the operating system within the fixed time constraints of a real-time system. If the system does not
8、 complete a task in a certain time frame, it may cause a breakdown of the entire system it is running. Therefore when writing an operating system for a real-time system, the writer must be sure that his scheduling schemes dont allow response time to exceed the time constraint.1.6 Consider the variou
9、s definitions of operating system. Consider whether the operating system should include applications such as Web browsers And mail programs. Argue both that it should and that it should not, and support your answer.Answer: Point. Applications such as web browsers and email tools are performing an in
10、creasingly important role inmodern desktop computer systems. To fulfill this role, they should be incorporated as part of the operating system. By doing so, they can provide better performance and better integration with the rest of the system. In addition, theseimportant applications can have the s
11、ame look-and-feel as the operating system software.Counterpoint. The fundamental role of the operating system is to manage system resources such as the CPU, memory, I/O devices, etc. In addition, its role is to run software applications such as web browsers and email applications. By incorporating s
12、uch applications into the operating system, we burden the operating system with additional functionality. Such a burden may result in the operating system performing a less-than satis factory job at managing system resources. In addition, we increase the size of the operating system thereby increasi
13、ng the likelihood of system crashes and security violations.1.7 How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security) system?Answer: The distinction between kernel mode and user mode provides a rudimentary form of protection in the followi
14、ng manner. Certain instructions could be executed only when the CPU is in kernel mode. Similarly, hardware devices could be accessed only when the programis executing in kernel mode. Control over when interrupts could be en abled or disabled is also possible only when the CPU is in kernel mode. Cons
15、equently, the CPU has very limited capability when executing in user mode, thereby enforcing protection of critical resources.1.8 Which of the following instructions should be privileged?a. Set value of timer.b. Read the clock.c. Clear memory.d. Issue a trap instruction.e. Turn off interrupts.f. Mod
16、ify entries in device-status table.g. Switch from user to kernel mode.h. Access I/O device.Answer: The following operations need to be privileged: Set value of timer, clear memory, turn off interrupts, modify entries in device-status table, access I/O device. The rest can be performed in user mode.1
17、.9 Some early computers protected the operating system by placing it in a memory partition that could not be modified by either the user job or the operating system itself. Describe two difficulties that you think could arise with such a scheme.Answer: The data required by the operating system (pass
18、words, access controls, accounting information, and so on) would have to be stored in or passed through unprotected memory and thus be accessible to unauthorized users.1.10 Some CPU provide for more than two modes of operation. What are two possible uses of these multiple modes?Answer: Although most
19、 systems only distinguish between user and kernel modes, some CPUs have supported multiple modes. Multiple modes could be used to provide a finer-grained security policy. For example, rather than distinguishing between just user and kernel-mode,you could distinguish between different types of user m
20、ode. Perhaps users belonging to the same group could execute each others code. The machine would go into a specified mode when one of these users was running code. When the machine was in this mode, a member of thegroup could run code belonging to anyone else in the group. Another possibility would
21、be to provide different distinctions within kernel code. For example, a specific mode could allow USB device drivers to run. This would mean that USB devices could be serviced withouthaving to switch to kernel mode, thereby essentially allowing USB device drivers to run in a quasi-user/kernel mode.1
22、.11 Timers could be used to compute the current time. Provide a short descriptionof how this could be accomplished.Answer: A program could use the following approach to compute the current time using timer interrupts. The program could set a timer for some time in the future and go to sleep. When it
23、 is awakened by the interrupt, it could update its local state, which it is using to keep track of the number of interrupts it has received thus far. It could then repeat this process of continually setting timer interrupts and updating its local state when the interrupts are actually raised.1.12 Is
24、 the Internet a LAN or a WAN?Answer: The Internet is a WAN as the various computers are located at geographically different places and are connected by long-distance network links.2.1 What is the purpose of system calls?Answer: System calls allow user-level processes to request services of the opera
25、ting system.2.2 What are the five major activities of an operating system in regard to process management?Answer:a. The creation and deletion of both user and system processesb. The suspension and resumption of processesc. The provision of mechanisms for process synchronizationd. The provision of me
26、chanisms for process communicatione. The provision of mechanisms for deadlock handling2.3 What are the three major activities of an operating system in regard to memory management?Answer: a. Keep track of which parts of memory are currently being usedand by whom.b. Decide which processes are to be l
27、oaded into memory when memoryspace becomes available.c. Allocate and deallocate memory space as needed.2.4 What are the three major activities of an operating system in regard to secondary-storage management?Answer: Free-space management. Storage allocation. Disk scheduling.2.5 What is the purpose o
28、f the command interpreter? Why is it usually separate from the kernel?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.
29、2.6 What system calls have to be executed by a command interpreter or shellin order to start a new process?Answer: In Unix systems, a fork system call followed by an exec systemcall need to be performed to start a new process. The fork call clones thecurrently executing process, while the exec call
30、overlays a new processbased on a different executable over the calling process.2.7 What is the purpose of system programs?Answer: System programs can be thought of as bundles of usefulsystem calls. They provide basic functionality to users so that users donot need to write their own programs to solv
31、e common problems.2.8 What is the main advantage of the layered approach to system design?What are the disadvantages of using the layered approach?Answer: As in all cases of modular design, designing an operatingsystem in a modular way has several advantages. The system is easierto debug and modify
32、because changes affect only limited sections ofthe system rather than touching all sections of the operating system.Information is kept only where it is needed and is accessible only withina defined and restricted area, so any bugs affecting that data must belimited to a specific module or layer.2.9
33、 List five services provided by an operating system. Explain how eachprovides convenience to the users. Explain also in which cases it wouldbe impossible for user-level programs to provide these services.Answer:a. Program execution. The operating system loads the contents (orsections) of a file into
34、 memory and begins its execution. A userlevelprogram could not be trusted to properly allocate CPU time.b. I/O operations. Disks, tapes, serial lines, and other devices mustbe communicated with at a very low level. The user need onlyspecify the device and the operation to perform on it, while thesys
35、tem converts that request into device- or controller-specificcommands. User-level programs cannot be trusted to access onlydevices they should have access to and to access them only whenthey are otherwise unused.c. File-systemmanipulation. There aremany details in file creation,deletion, allocation,
36、 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 andfreeing the allocated blocks. Protections must also be checked toassure proper file access. User programs could neither ensure a
37、dherenceto protection methods nor be trusted to allocate only freeblocks and deallocate blocks on file deletion.d. Communications. Message passing between systems requiresmessages to be turned into packets of information, sent to the networkcontroller, transmitted across a communications medium,and
38、reassembled by the destination system. Packet ordering anddata correction must take place. Again, user programs might notcoordinate access to the network device, or they might receivepackets destined for other processes.e. Error detection. Error detection occurs at both the hardware andsoftware leve
39、ls. At the hardware level, all data transfers must beinspected to ensure that data have not been corrupted in transit.All data on media must be checked to be sure they have notchanged since they were written to the media. At the softwarelevel, media must be checked for data consistency; for instance
40、,whether the number of allocated and unallocated blocks of storagematch the total number on the device. There, errors are frequentlyprocess-independent (for instance, the corruption of data on adisk), so there must be a global program (the operating system)that handles all types of errors. Also, by
41、having errors processedby the operating system, processes need not contain code to catchand correct all the errors possible on a system.2.10 What is the purpose of system calls?Answer: System calls allow user-level processes to request services ofthe operating system.2.11 What are the main advantage
42、s of the microkernel approach to systemdesign?Answer: Benefits typically include the following (a) adding a newservice does not require modifying the kernel, (b) it is more secure asmore operations are done in user mode than in kernel mode, and (c)a simpler kernel design and functionality typically
43、results in a morereliable operating system.2.12 Whydo some systems store the operating system in firmware, and otherson disk?Answer: For certain devices, such as handheld PDAs and cellular telephones,a disk with a file system may be not be available for the device.In this situation, the operating sy
44、stem must be stored in firmware.2.13 How could a system be designed to allow a choice of operating systemsto boot from? What would the bootstrap program need to do?Answer: Consider a system that would like to run both WindowsXP and three different distributions of Linux (e.g., RedHat, Debian, andMan
45、drake). Each operating system will be stored on disk. During systemboot-up, a special program (which we will call the boot manager) willdetermine which operating system to boot into. This means that ratherinitially booting to an operating system, the boot manager will first runduring system startup.
46、 It is this boot manager that is responsible fordetermining which system to boot into. Typically boot managers mustbe stored at certain locations of the hard disk to be recognized duringsystem startup. Boot managers often provide the userwith a selection ofsystems to boot into; boot managers are als
47、o typically designed to bootinto a default operating system if no choice is selected by the user.3.1 Palm OS provides no means of concurrent processing. Discuss threemajor complications that concurrent processing adds to an operatingsystem.Answer:a. A method of time sharing must be implemented to al
48、low eachof several processes to have access to the system. This methodinvolves the preemption of processes that do not voluntarily giveup the CPU (by using a system call, for instance) and the kernelbeing reentrant (so more than one processmaybe executing kernelcode concurrently).b. Processes and sy
49、stem resources must have protections and mustbe protected from each other. Any given process must be limitedin the amount of memory it can use and the operations it canperform on devices like disks.c. Care must be taken in the kernel to prevent deadlocks betweenprocesses, so processes arent waiting for each others allocatedresources.3.2 The Sun UltraSPARC processor has multiple register sets. Describe theactions of a context switch if the new context is already loaded intoone of the register sets. What else must happen if the new context is inmemory rather than in a register set a