Ch 6 - CDK4: Home page

Download Report

Transcript Ch 6 - CDK4: Home page

Exercises for Chapter 6:
Operating System Support
From Coulouris, Dollimore and Kindberg
Distributed Systems:
Concepts and Design
Edition 4, © Pearson Education 2005
Exercise 6.1
Discuss each of the tasks of encapsulation,
concurrent processing, protection, name resolution,
communication of parameters and results, and
scheduling in the case of the UNIX file service (or
that of another kernel that is familiar to you)
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.2
Why are some system interfaces implemented by
dedicated system calls (to the kernel), and others on
top of message-based system calls?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.3
Smith decides that every thread in his processes
ought to have its own protected stack – all other
regions in a process would be fully shared. Does this
make sense?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.4
Should signal (software interrupt) handlers belong to
a process or to a thread?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.5
Discuss the issue of naming applied to shared
memory regions.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.6
 Suggest a scheme for balancing the load on a set of computers.
You should discuss:
i) what user or system requirements are met by such a
scheme;
ii) to what categories of applications it is suited;
iii) how to measure load and with what accuracy; and
iv) how to monitor load and choose the location for a new
process. Assume that processes may not be migrated.
How would your design be affected if processes could be
migrated between computers? Would you expect process
migration to have a significant cost?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.7
Explain the advantage of copy-on-write region
copying for UNIX, where a call to fork is typically
followed by a call to exec. What should happen if a
region that has been copied using copy-on-write is
itself copied?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.8
 A file server uses caching, and achieves a hit rate of 80%. File
operations in the server cost 5 ms of CPU time when the server
finds the requested block in the cache, and take an additional
15 ms of disk I/O time otherwise. Explaining any assumptions
you make, estimate the server’s throughput capacity (average
requests/sec) if it is:
i) single-threaded;
ii) two-threaded, running on a single processor;
iii) two-threaded, running on a two-processor computer.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.9
Compare the worker pool multi-threading architecture
with the thread-per-request architecture.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.10
What thread operations are the most significant in
cost?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.11
A spin lock (see Bacon [1998]) is a boolean variable
accessed via an atomic test-and-set instruction, which
is used to obtain mutual exclusion. Would you use a
spin lock to obtain mutual exclusion between threads
on a single-processor computer?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.12
Explain what the kernel must provide for a user-level
implementation of threads, such as Java on UNIX.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.13
Do page faults present a problem for user-level
threads implementations?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.14
Explain the factors that motivate the hybrid scheduling
approach of the ‘scheduler activations’ design (instead
of pure user-level or kernel-level scheduling).
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.15
Explain the factors that motivate the hybrid scheduling
approach of the ‘scheduler activations’ design (instead
of pure user-level or kernel-level scheduling).
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.16
Network transmission time accounts for 20% of a null
RPC and 80% of an RPC that transmits 1024 user
bytes (less than the size of a network packet). By what
percentage will the times for these two operations
improve if the network is upgraded from 10
megabits/second to 100 megabits/second?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.17
A ‘null’ RMI that takes no parameters, calls an empty
procedure and returns no values delays the caller for
2.0 milliseconds. Explain what contributes to this time.
In the same RMI system, each 1K of user data adds
an extra 1.5 milliseconds. A client wishes to fetch 32K
of data from a file server. Should it use one 32K RMI
or 32 1K RMIs?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.18
Which factors identified in the cost of a remote
invocation also feature in message passing?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.19
Explain how a shared region could be used for a
process to read data written by the kernel. Include in
your explanation what would be necessary for
synchronization.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.20
i) Can a server invoked by lightweight procedure calls
control the degree of concurrency within it?
ii) Explain why and how a client is prevented from calling
arbitrary code within a server under lightweight RPC.
iii) Does LRPC expose clients and servers to greater
risks of mutual interference than conventional RPC
(given the sharing of memory)?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.21
A client makes RMIs to a server. The client takes 5 ms
to compute the arguments for each request, and the
server takes 10ms to process each request. The local
OS processing time for each send or receive operation
is 0.5 ms, and the network time to transmit each
request or reply message is 3 ms. Marshalling or
unmarshalling takes 0.5 ms per message.
Estimate the time taken by the client to generate and
return from 2 requests (i) if it is single-threaded, and
(ii) if it has two threads which can make requests
concurrently on a single processor. Is there a need for
asynchronous RMI if processes are multi-threaded?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.22
Explain what is security policy and what are the
corresponding mechanisms in the case of a multi-user
operating system such as UNIX.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.23
Explain the program linkage requirements that must be
met if a server is to be dynamically loaded into the
kernel’s address space, and how these differ from the
case of executing a server at user level.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.24
How could an interrupt be communicated to a userlevel server?
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005
Exercise 6.25
On a certain computer we estimate that, regardless of
the OS it runs, thread scheduling costs about 50
microsec, a null procedure call 1 millisec, a context
switch to the kernel 20 microsec and a domain
transition 40 microsec. For each of Mach and SPIN,
estimate the cost to a client of calling a dynamically
loaded null procedure.
Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
© Pearson Education 2005