Operating system concepts
(Seventh edition)                                     2008.3 
solutions to the exercises 
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 
machine? Explain your answer. 
in  a time-shared  machine  as in  a dedicated 
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 
confident of its correct implementation. 
is  to  feel 
it 
1.2  The issue  of  resource  utilization 
of operating systems. List what resources must be managed 
carefully in the 
Workstations connected to servers   c. Handheld computers 
following settings:  a. Mainframe 
shows up  in  different 
forms  in  different 
types 
or  minicomputer systems     b. 
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 
rather than a PC or single-user workstation? 
user  be better off 
using a timesharing system 
the  task  is  large,  and  the  hardware  is  fast, 
sense.  The  full  power  of  the  system  can  be  brought 
Answer:  When there  are  few  other  users, 
time-sharingmakes 
user ’s  problem.  The problemcan  be solved  faster 
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 
satisfaction. 
to  bear  on  the 
than  on a personal  computer.  Another 
program to the user ’s 
1.4  Which  of  the  functionalities 
system  for  the  following 
a. Batch programming      b. Virtual memory   c. Time sharing 
two  settings: 
listed 
below  need to  be supported  by  the  operating 
(a)  handheld  devices  and (b)  real-time 
systems.  
Answer:  For  real-time 
systems, 
the  operating  system  needs  to  support  virtual  memory 
Operating system concepts
(Seventh edition)                                     2008.3 
and  time  sharing 
to  provide 
programming is not necessary in both settings. 
virtual 
system  needs 
Batch 
in  a  fair  manner.  For  handheld  systems,the  operating 
memory,  but  does  not  need  to  provide 
time-sharing. 
1.5  Describe 
are three advantages and one disadvantage of multiprocessor systems? 
the  differences 
between  symmetric  and  asymmetric  multiprocessing.What 
Answer: Symmetric multiprocessing treats all processors as equals, and I/O can be 
processed  on any CPU. Asymmetric  multiprocessing 
CPUs are slaves.  The master distributes 
done by the master only. 
Multiprocessors can save money by not duplicating power supplies,housings, and 
peripherals. 
reliability. 
uniprocessor systems. 
They  can  execute  programs  more  quickly 
They  are  also  more  complex 
tasks among the 
slaves, and I/O 
and  can  have 
in  both  hardware  and  software 
has one master  CPU and the  remainder 
increased 
than 
is usually 
1.6 How do clustered systems differ from multiprocessor systems? What is required 
for two  machines  belonging to a cluster to 
service? 
cooperate to 
provide a  highly available 
computers 
task  distributed 
constructed  by combining  multiple 
across  the  cluster. 
systems  on the  other  hand could  be a single  physical  entity  comprising 
than  a  multiprocessor 
Answer:  Clustered  systems  are  typically 
into  a single  system  to  perform  a computational 
Multiprocessor 
of  multiple  CPUs. A clustered 
system.Clustered 
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. 
systems  communicate  using  messages,  while 
system  is  less 
processors 
coupled 
tightly 
in  a 
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 
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  that  share  cooking  recipes.Under 
client-server model, all recipes are stored with the server. If a 
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 
In  fact, 
roles. 
client wishes to 
recipe. 
all  nodes 
the 
Operating system concepts
(Seventh edition)                                     2008.3 
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 
recipes) and as a server (it may provide recipes.) 
(i.e. 
it  may request 
1.8  Consider  a computing  cluster 
two ways in which the cluster software can manage access to the data on the disk. 
Discuss the benefits and disadvantages of each. 
consisting 
of  twonodes  running  adatabase.Describe 
one host  runs  the  database  application  with 
the  monitoring  host  becomes 
and parallel 
the  following 
two  alternatives: 
asymmetric  clustering 
Answer:  Consider 
clustering.  With  asymmetric  clustering, 
the  other  host  simply  monitoring 
If 
the active server. This is appropriate for providing redundancy. However, it does 
the  potential 
not  utilize 
the  database  application 
implementing 
mechanism for files on the shared disk. 
can 
clusters 
processing  power  of  both  hosts.  With  parallel 
on  both  hosts. 
is  providing 
in  parallel 
the  server 
parallel 
fails, 
run 
it. 
clustering, 
The  difficulty 
some  form  of  distributed 
locking 
1.9  How  are  network  computers  different 
Describe  some usage  scenarios 
in  which  it 
from 
traditional 
computers? 
is  advantageous  to  use network  computers. 
personal 
have  a minimal  operating 
Answer:  A network  computer  relies  on a centralized 
It  can  therefore 
computer on the other hand has to be capable of providing all of the required 
functionality 
Scenarios where administrative costs are high and where sharing leads to more 
efficient 
preferred. 
in  a  standalonemanner  without 
use of  resources  are  precisely 
system  to  manage its 
relying 
those  settings  where  network  computers  are 
computer  for  most  of  its  services. 
resources.  A personal 
on  a  centralized 
manner. 
1.10  What is  the  purpose  of  interrupts?  What  are  the  differences 
an interrupt? Can traps be generated intentionally by a user program? If so, for 
what purpose? 
between  a  trap  and 
returned 
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 
software-generated 
an  I/O  to  obviate 
system routines or to catch arithmetic errors. 
instruction. 
can  be  used  to  signal 
the  need  for  device  polling. 
An interrupt 
interrupted 
interrupt. 
context 
and 
the 
to 
A 
trap 
a 
the  completion  of 
is 
A trap  can  be  used  to  call  operating 
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 
Operating system concepts
(Seventh edition)                                     2008.3 
transferring data. Does this process interfere with the execution of the user 
programs? If so, describe what forms of interference are caused. 
can  be 
independently 
accessed  by 
values 
the  device.The 
into  special 
device 
a DMA operation  by  writing 
Answer:  The CPU can initiate 
that 
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 simultaneously.The memory 
controller 
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. 
provides  access  to  the  memory bus  in  a fair  manner  to  these  two  entities. 
registers 
initiates 
the 
1.12  Some computer  systems  do not  provide  a privileged  mode of  operation 
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. 
in  hardware. 
type  would  need to  remain  in  control 
Answer:  An operating  system  for  a machine  of  this 
(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 useful.What 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? 
a  buffer  of  intermediate 
speed  between  the  components.  If 
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 
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 datum.Acomponent 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. 
the 
Operating system concepts
(Seventh edition)                                     2008.3 
1.14  Discuss,  with  examples,  how the  problem  of  maintaining 
manifests itself in the following processing environments: 
a. Single-processor systems 
b. Multiprocessor systems 
c. Distributed systems 
coherence  of  cached  data 
the  memory needs  to  be updated  when a processor 
processors  might  be caching 
the 
systems, 
Answer:  In  single-processor 
issues updates to cached values. These updates can be performed immediately or in 
a lazy  manner.  In  amultiprocessor 
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 
when a client caches file data. 
system,different 
is  not  an  issue.  However,  consistency  problems  might  arise 
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
Information 
base and limits registers and by performing a check for every memory access. 
regarding 
the  extent  of  a program’s  memory could  be maintained  by  using 
’s extent. 
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 
Operating system concepts
(Seventh edition)                                     2008.3 
the  computer 
times  through  buffering, 
off-line 
transactions  where  the  results 
card  from  the  terminal, 
This  system  is  composed of  many short 
to  keep  CPU and  I/O  devices  busy  at  all 
Answer: 
needs  are  batched  together  and  run  through 
a.  Batch.  Jobs  with  similar 
as a group by an operator or automatic job sequencer. Performance is increased by 
attempting 
operation, spooling, andmultiprogramming. Batch is good for executing large jobs 
that need little interaction; it can be submitted and picked up later. 
b.  Interactive. 
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. 
its  next  control 
to the screen. 
d.  Real  time.  Often  used  in  a  dedicated  application, 
from sensors and must respond within a fixed amount of time to ensure correct 
performance. 
e.  Network.  Provides  operating 
f. SMP. Used in systems where there are multiple CPU
of the operating system.Communication takes place across the system bus. 
g.  Distributed.This 
processors.  The  processors  do  not  share  memory or  a  clock. 
has 
communication lines, such as a high-speed bus or local area network. 
h. Clustered. A clustered system combines multiple computers into a single system 
to perform computational task distributed across the cluster. 
i.  Handheld.  A small  computer  system  that  performs  simple 
from 
email, 
systemswith smallermemory and display screens and slower processors. 
own  local  memory.  They  communicate  with  each  other 
and  web  browsing.  Handheld  systems  differ 
system  distributes 
computation 
its 
among  several 
physical 
Instead,  each  processor 
various 
through 
tasks  such  as  calendars, 
traditional 
desktop 
Instead  of  having  a job  defined  by  spooled  card  images,  each  program  reads 
and  output 
is  normally  printed 
immediately 
this  system  reads  information 
system  features  across  a network  such  as file 
sharing. 
’s eac h running the same copy 
1.18 What are the tradeoffs inherent in handheld computers? 
in  smaller  memory, smaller  screens,  and slower  processing  capabilities 
Answer: Handheld computers are much smaller than traditional desktop PC
results 
a standard desktop PC. Because of these limitations,most handhelds currently can 
perform only basic tasks such as calendars, email, and simple word processing. 
However,  due to  their  small  size, 
with wireless access, can provide remote access to electronic mail and the world 
wide web. 
they  are  quite  portable  and,  when they  are  equipped 
’s. This 
than 
Operating system concepts
(Seventh edition)                                     2008.3 
Chapter 2 
2.1 The  services  and functions 
two main  categories.  Briefly 
provided  by an  operating system can be 
divided into 
the  two  categories  and discuss  how they  differ. 
describe 
is 
system 
concurrently 
between  different 
provided 
processes 
to  access  only  thosememory  locations 
by  an  operating 
running 
to  enforce 
the  system. 
that  are  associated  with 
Answer:  One  class  of  services 
protection 
Processes  are  allowed 
their address spaces. Also, processes are not allowed to corrupt files associated 
with other users. A process is also not allowed 
operating system ntervention. 
The second class of services provided by an operating system is to provide new 
functionality that is not supported directly by the underlying hardware. Virtual 
memory and file  systems  are  two  such  examples  of  new services  provided  by an operating 
system. 
to access devices directly without 
in 
2.2 List five services provided by an operating system that are designed to make 
it more convenient for users to use the computer system. In what cases it would be 
impossible for user-level programs to provide these services? Explain. 
tapes,  serial 
it, 
that 
request 
into 
device- 
the  system  converts 
of  a file 
trusted to 
programs  cannot  be  trusted 
(or  sections) 
not be 
or 
to  only  access 
lines,  and other  devices  must be communicated 
while 
commands. User-level 
Answer:  
? Program  execution.  The operating  system  loads  the  contents 
into memory  and begins its execution. A user-level program could 
properly allocate CPU time. 
? I/O  operations.  Disks, 
with at a very low level. The user need only specify the device and the operation 
on 
to  perform 
controller-specific 
devices they should have access to and to only access them when they are otherwise 
unused. 
? File -system manipulation. There are many details in file creation, deletion, 
allocation, and 
not have to perform. Blocks of 
are used by files and must be tracked. Deleting a file requires removing the name 
file 
to assure proper file access. User programs could neither ensure adherence to 
protection  methods  nor  be trusted 
on file deletion. 
? Communications.  Message  passing  between  systems  requires  messages be turned 
packets  of 
communications medium, and reassembled by the destination system. Packet ordering 
and data  correction  must take  place.  Again,  user  programs  might  not  coordinate  access 
for  other  processes. 
to  the  network  device,  or  they  might  receive  packets  destined 
? Error  detection. 
levels. 
At  the  hardware  level, 
occurs  at  both  the  hardware  and  software 
only  free  blocks  and deallocate  blocks 
blocks.  Protections  must also  be  checked 
all  data  transfers  must  be inspected 
the  network  controller,transmitted 
naming that users should 
to  ensure  that  data  have 
and  freeing 
the  allocated 
Error  detection 
information, 
sent 
to 
into 
across  a 
information 
to  allocate 
disk space 
Operating system concepts
(Seventh edition)                                     2008.3 
not been corrupted in transit. All data on media must be checked to be sure they 
have  not  changed  since 
must be  checked for data consistency; for instance, do the number 
to  the  media.  At  the  software 
they  were  written 
level,  media 
and  
of allocated 
process-independent 
unallocated blocks of storage match the total number on the device. There, errors 
are  frequently 
so there must be a global program (the operating system) that handles all types of 
errors. Also, by having errors processed by the operating system, processes need 
not contain code to catch and correct all the errors possible on a system. 
the  corruption 
instance, 
(for 
of  data  on a disk), 
2.3  Describe 
three  general  methods  for  passing  parameters 
to  the  operating 
system. 
Answer: 
a. Pass parameters in registers 
b. Registers pass starting addresses of blocks of parameters 
c. Parameters can be placed, or pushed, onto the stack by the program, and popped 
off the stack by the operating system. 
2.4  Describe  how you  could  obtain  a  statistical 
by a program executing different sections of its code.Discuss the importance of 
obtaining such a statistical profile. 
profile 
of  the  amount  of  time  spent 
timer 
interrupts 
Answer:  One could  issue  periodic 
what sections of code are currently executing when the interrupts are delivered. 
A statistical 
the time spent by the program in different sections of its code. Once such a 
statistical 
of code that are consuming more of the CPU resources. 
the  programmer  could  optimize 
has been  obtained, 
profile 
profile 
of  which  pieces  of  code  were  active  should  be consistent  with 
and  monitor  what  instructions 
or 
those  sections 
2.5 What are the five major activities of an operating system in regard to file 
management? 
on and deletion of files 
Answer: 
? The creati
? The creation and deletion of directories
? The support of primitives for manipulating files and directories
? The mapping of files onto secondary storage
? The backup of files on stable (nonvolatile) storage media
2.6  What are  the  advantages  and disadvantages  of  using  the  same systemcall 
for manipulating both files and devices? 
interface 
Answer:  Each device  can  be  accessed  as  though  it  was a file 
most  of  the  kernel  deals  with  devices 
through 
this 
file 
in  the  file  system.  Since 
interface,it 
is  relatively