INSTRUCTOR’S MANUAL
TO ACCOMPANY
OPERATING
SYSTEM
CONCEPTS
SIXTH EDITION
ABRAHAM SILBERSCHATZ
Bell Laboratories
PETER BAER GALVIN
Corporate Technologies
GREG GAGNE
Westminster College
Copyright c2001 A. Silberschatz, P. Galvin and Greg Gagne
PREFACE
This volume is an instructor’s manual for the Sixth Edition of Operating-System Concepts by
Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne. It consists of answers to the exercises
in the parent text. In cases where the answer to a question involves a long program, algorithm
development, or an essay, no answer is given, but simply the keywords “No Answer” are added.
Although we have tried to produce an instructor’s manual that will aid all 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, both instructors and students, to
help us in improving this manual. If you have better solutions to the exercises or other items
which would be of use 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, be properly
credited to their contributor.
Internet electronic mail should be addressed to avi@bell-labs.com. Physical mail may be sent
to Avi Silberschatz, Information Sciences Research Center, MH 2T-310, Bell Laboratories, 600
Mountain Avenue, Murray Hill, NJ 07974, USA.
A. S.
P. B. G
G. G.
iii
CONTENTS
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 1
Computer-System Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Chapter 2
Chapter 3 Operating-System Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Chapter 4
Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Chapter 5
CPU Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 6
Process Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Chapter 7
Chapter 8 Deadlocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 9 Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Chapter 10 Virtual Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
File-System Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Chapter 11
File-System Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Chapter 12
I/O Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Chapter 13
Chapter 14 Mass-Storage Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Chapter 15 Distributed System Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Chapter 16 Distributed File Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Chapter 17 Distributed Coordination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Chapter 18
Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Chapter 19
Chapter 20 The Linux System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Chapter 21 Windows 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Appendix A The FreeBSD System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Appendix B The Mach System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
v
Chapter 1
INTRODUCTION
Chapter 1 introduces the general topic of operating systems and a handful of important concepts
(multiprogramming, time sharing, distributed system, and so on). The purpose is to show why
operating systems are what they are by showing how they developed. In operating systems, as
in much of computer science, we are led to the present by the paths we took in the past, and we
can better understand both the present and the future by understanding the past.
Additional work that might be considered is learning about the particular systems that the
students will have access to at your institution. This is still just a general overview, as specific
interfaces are considered in Chapter 3.
Answers to Exercises
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 process 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) manage-
ment of the operation and control of I/O devices.
1.2 List the four steps that are 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
2
Chapter 1
Introduction
1.3 What is the main advantage of multiprogramming?
Answer: Multiprogramming makes efficient use of the CPU by overlapping the demands
for the CPU and its I/O devices from various users. It attempts to increase CPU utilization
by always having something for the CPU to execute.
1.4 What are the main differences between operating systems for mainframe computers and
personal computers?
Answer: The design goals of operating systems for those machines are quite different.
PCs are inexpensive, so wasted resources like CPU cycles are inconsequential. Resources
are wasted to improve usability and increase software user interface functionality. Main-
frames are the opposite, so resource use is maximized, at the expensive of ease of use.
1.5 In a multiprogramming and time-sharing environment, several users share the system si-
multaneously. 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 we have 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 bro-
ken by a human, and the more complex the scheme, the more difficult it is to feel
confident of its correct implementation.
1.6 Define the essential properties of the following types of operating systems:
a. Batch
b. Interactive
c. Time sharing
d. Real time
e. Network
f. Distributed
Answer:
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, and multiprogramming. 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