You are on page 1of 3

CS 403/534 – Distributed Systems Spring 2003

Homework #1
Note: Only hardcopy and printed submissions are acceptable.

1. Consider that a file server is up half of the time due to hardware problems. How many
more replicated servers have to be used to give an availability of at least 99 percent? (10
points)

At least 7 servers are needed to give 99 percent availability since 1 – 1/(27)=0.992.

2. Which protocol do you think it should be used to implement the following services, TCP
or UDP? Explain you choices.

a. telnet, ssh
b. ftp, scp
c. rwho, finger
d. http
e. RPC
(20 points)

a. The long duration of sessions, the need for reliability and the unstructured sequences
of characters make connection-oriented communication most suitable for this
application. Performance is not critical, so the overheads are generally unimportant.

b. File transfers involve transmission of large amounts of data. Connectionless would be


fine if error rates are low and messages can be large (the sliding window protocol can
be used under such conditions). However, the Internet doesn't meet these
requirements, so TCP is used.

c. Connectionless service is preferable since the messages are short and a single message
is sufficient for each transaction. The request is also easily re-issued if necessary.

d. Either could be used. Requests can be easily re-issued in the event of a problem (the
“Reload" button). However, the volume of data issued for a request can be quite large,
so TCP is used in practice.

e. RPC achieves reliability through timeouts and retransmission. Connectionless service


is often preferred.

3. You wish to execute a Java code, which resides at remote server. The speed of the
network connecting your machine and the server is 10 Mbit/s. You have two options to
execute it:

a. Local Execution: Download and run the Java code on your local computer. The code is
100 kilobytes and execution time of it is 500 milliseconds on your machine
b. Remote Execution (RMI): Download a proxy for the remote object implementing the
service and use it to invoke the method of the remote object. The following are given:
The size of the proxy is 10 kilobytes. Marshalling the arguments takes 5 ms and

Erkay Savas – CS 403/354


arguments and results are 1.25 kilobyte in size each. It takes the same time to
unmarshal them on the other side. The latency for the send and receive primitives is 5
ms on both machines.

Assuming that the web server is identical to your computer, except that it may have a
different clock frequency. How much faster (percentage-wise) does the server have to
be before it is better to use the proxy than download and run the applet? (20 points)

a. For the downloading the applet to your machine, noting that 100kbytes = 800kbits =
0.8Mbits:

Time = Download time + Execution time =


(0.8Mbits)/(10Mbits/sec) + 0.5 sec = 0.58 second

b. For using the proxy, noting that 10kbytes = 80kbits = 0.08Mbits.

Time = Proxy download + Marshal args + Send of args + Argument transmission +


Receive of args + Unmarshal of args + Execution time + Marshal result + Send of
result + Result transmission + Receive of result + Unmarshal of result
= (0.08Mbits) /(10Mbits/sec) + 0.005 + 0.005 + (0.01Mbits/(10Mbits/sec)) +
0.005 + 0.005 + 0.5/P + 0.005 + 0.005 +
(0.01Mbits/(10Mbits/sec)) + 0.005 + 0.005

where P is the percentage by which the server is faster than the PC.
We want the value of P for which the following inequality will hold:

0.05 + 0.5/P < 0.58


0:5/P < 0.53
P > 0.94

The applet is big and it takes too long to download it. The server needs to be only 94% as
fast as the PC to get the job done faster. This means that it is still better to use the remote
invocation even if the server is slightly slower than the client machine.

4. Java and other languages support exceptions, which are raised when an error occurs. Such
languages enable developer to code their own exception handling routines. How would
you implement exceptions in RMI? Why is it important to catch the “RemoteException”
with every remote method call? (10 points)

Because exceptions are initially raised at the server side, the server stub can do nothing
else but catch the exception and marshal it as a special error response back to the client.
The client stub, on the other hand, will have to unmarshal the message and raise the same
exception if it wants to keep access to the server transparent. Consequently, exceptions
now also need to be described in an interface definition language. It is important catch the
exceptions since the remote invocations are more vulnerable to failures than local
invocations.

5. A reliable multicast service allows a sender to reliably send messages to a collection of


receivers. Does such a service belong to middleware layer, or should it be part of lower-
layer? Explain your reasoning. (10 points)

Erkay Savas – CS 403/354


In principle, a reliable multicast service could easily be part of the transport layer, or even
the network layer. As an example, the unreliable IP multi-casting service is implemented
in the network layer. However, because such services are currently not readily available,
they are generally implemented using transport-level services, which automatically places
them in the middleware.

6. Explain, with your own words, what is meant by separating policies from mechanisms in
distributed systems, why it is necessary and give an example of such a separation. (15
points)

A policy in a distributed system dictates, for example, when and how data is replicated.
However, such policies may be good for one application but bad for another. Therefore,
ideally, a system should provide only the means for enforcing policies. In the case of
replication, a distributed system could permit an application to specify the constraints that
need to be satisfied before some data is actually replicated.

7. What are the differences between the client server and the peer process model? What are the main
advantages of the peer process model, in which situations would you use it? (15 points)

In peer process model all of the processes play similar roles, interacting cooperatively as
peers to perform a distributed activity or computation without any distinction between
clients and servers. In client-server architecture, the server is always the performance
bottleneck. Furthermore, in the case of server failures, the operation cannot continue. The
peer process model is used in situations where cooperation is essential and there is no
clear distinction between the processes.

Erkay Savas – CS 403/354

You might also like