-
操作系统概念课后答案
【篇一:操作系统概念第七版答案
(
含编程代码
)
】
>
chapter 1
1.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 managed
carefully in the following settings:
a. mainframe or
minicomputer systems
b. workstations connected to serversc.
handheld computers
answer:
a.
mainframes:memory and cpu resources, storage,
network
bandwidth.
b. workstations: memory and cpu
resouces
c. 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 sharing
answer: 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 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
multiprocessor
red 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
tha
t share
cooking 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 be 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 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
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 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 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
nent 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 systems
b.
multiprocessor systems
c.
distributed systems
answer: 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 limit
access to locations
that are outside of
a program’s extent. information regarding
the exten
t 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
floor
b. a university
campus
c. a
state
d. a
nation
answer:
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. batch
b.
interactive
c. time
sharing
d. real
time
e. network
f. parallel
g.
distributed
h.
clustered
i.
handheld
【篇二:操作系统概念
_
第六版
_
重点部分
_
中文答案
-
】
urposes of an operating
system?
1 to provide an
environment for a computer user to execute
programs on computer hardware in a
convenient and ef?cient
manner.
2 to
allocate the separate resources of the computer as
needed to solve the problem given. the
allocation process
should be as fair
and ef?cient as possible.
3
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.
?
环境提供者,为计算机用户提供一个环境,使得能够在计
算机硬
件上方便、高效的执行程序
?
资源分配者,为解决问题按需分配计
算机的资源,资源分配需尽可能公平、高效
?
控制程序
监控用户程序的执行,防止出错和对计算机的不正当使用管理
i
/o
设
备的运行和控制
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
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 transactionmay be
unpredictable.
response time needs to be short (seconds)
since the user submits and waits for
the result.
c. time
stemsuses 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
de?ned by spooled card
images, each
program readsits 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 ?xed amount
of time to ensure correct perfor-
mance.
e.
network.
f. 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 telephone
line.
a. batch
相似需求的
job
分批、成组的在计算机上执行,<
/p>
job
由操作员或自
动
< br>job
程序装置装载;
可以通过采用
buffering, off-line
operation, spooling,
multiprogramming
等技术使
cpu
和
i/o
不停忙来提高性能
批处理适合于需要极少用户交互的
job
。
p>
b. interactive
由许多短交易组成,下一次交易的结果可能不可预知
需要响应时间短
c. time
sharing
使用
cpu
调度和多道程序提供对系统的经济交互式使用,
cpu
快速
地在用户之间切换
一般从终端读取控制,输出立即打印到屏幕
d.
real time
在专门系统中使用,从传感器读取信息,必须在规定时间内作出响
应以确保正
确的执行
e. network
在通用
os
上添加
联网、通信功能
远程过程调用
文件共享
f.
distributed
具有联网、通信功能
提供远程过程调用
提供多处理机的统一调度调度
统一的存储管理
分布式文件系统
2.3 what
are the differences between a trap and an
interrupt?
what is the use of each
function?