Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Thilo Kielmann, AnaMaria Oprescu, Alex Uta
Vrije Universiteit Amsterdam, University of Amsterdam
Fall 2015
Solutions to Exercise 3
1. How are the OSI model layers mapped to the adapted (middlewarecentric) reference
model? Discuss in terms of functionality.
A: Physical (bit transmission), Data link (correctness) Hardware; Network (routing),
Transport (retransmission, connectionoriented (telephone) and connectionless (mailing
a letter) communication services) Operating System; Session (synchronization
facilities), Presentation (semantics) Middleware (applicationindependent protocols);
Application (applicationspecific and generalpurpose protocols) Application
(applicationspecific protocols).
2. Give some examples of generalpurpose protocols, which belong to the middleware
layer. What types of distribution transparency do they provide?
A: remote procedure call provides access transparency; domain name system
provides location transparency.
3. Give some examples of systems evolving from combining persistent/transient,
synchronous/asynchronous and discrete/streaming communication. Which combination
corresponds to RPC?
A: Persistent communication means that a message submitted for transmission is stored
by the communication middleware until received; with transient communication, a
message is stored only as long as both the sender and receiver are executing.
Asynchronous communication means the sender continues after submitting a message
for transmission, while synchronous communication means the sender blocks either until
a) middleware confirms taking over; b) message has been delivered to destination; or c)
the recipient replies.
In discrete communication a message forms a complete unit of information, while
streaming involves multiple, related messages. Persistent communication, blocking until
a message is delivered to destination is typical for messagequeueing systems.
Transient communication, blocking until receiving a reply is typical for RPC,
Client/Server. Transient communication, blocking until message is delivered to
destination is typical for asynchronous RPC.
4. Can we simply use pointers as parameters in RPC calls without extra care? Why?
A: No, because local callbyreference would be meaningless on a remote machine. A
solution to this is replacing the callbyreference by callbyvalue/restore. Followup
question: Why aren’t these semantically identical, but still good enough frequently? A: in
callbyreference the changes to the variable are immediately visible (e.g., another
pointer variable to the same address space would see the updated value), while in
callbyvalue/restore only the final change is visible at the end of the call (e.g., multiple
such variables would not see the updated value). Another solution is using global
references (e.g., file handle in a shared file system).
5. In multicast RPC, should the client wait for all responses? Why?
A: It depends on the purpose of involving multiple servers: if it’s for faulttolerance, then
1 reply is sufficient, if it’s for workload distribution, then we need all replies back, merged
by the stub before being returned into a single answer to the client.
6. Consider implementing an application using RPC on top of streams (TCP) and
datagrams (UDP) sockets, respectively. What would be your main challenge?
A: Since UDP is an unreliable transport protocol, the application needs to handle
resending a request. If the request is idempotent (no sideeffects) things are trivial,
otherwise at a minimum clientissued sequence numbers are needed, state has to be
maintained by the server for each client and the server needs to reply to each request.
7. What are the differences between ZeroMQ and Berkeley (traditional) sockets? What is
the side effect of asynchronous connectionoriented communication? What are the main
communication patterns supported by ZeroMQ?
A: In contrast to onetoone Berkeley sockets, ZeroMQ sockets may support
onetomany and manytoone communication patterns. Processes may request a
connection setup and then send a message even if the recipient is not upandrunning.
Sender actions are queued at the sender side, and are dealt by a separate ZeroMQ
thread. Main communication patterns are requestreply (similar to clientserver),
publishsubscribe (similar to eventbased coordination), and pipeline (pushpull
behavior).
8. What is the role of the message brokers? Why/when are they needed? A: Their main
role is to convert incoming messages so that they may be understood by destination
applications (basic: reformatters, more advanced: applicationlevel gateway, using
plugins to convert messages between two applications using different messaging
protocols). In a system with N applications, we may need up to NxN messaging protocol
converters. Higherlevel abstraction solutions, such as XML messages, still have to
make sure the semantics of the message are well understood. Moreover, message
brokers may act as subjectbased routers (publishsubscribe).
9. Gossiping protocols can be used for data aggregation. Each node Pi
maintains a
variable vi
. When two nodes i j
and vi
gossip, they set their variables vj
and (vi + vj) /2
to .
Show that, eventually, all nodes will have computed the average of the initial values.
What happens in the case when v1 = 1, and vi = 0 i != 1
(for ) ?
A: Whenever two nodes gossip, they compute the average of their values. During more
and more communication rounds, more initial values will be covered by the averaging
process. Eventually, all nodes end up with the same average value.
In the case where all nodes start with 0, and one node starts with 1, the final result will
be 1/N (with N nodes). This value can be used to estimate the overall size of the
network.
10. Where do we see gossip protocols at work in reallife computing? Think of an example.
A: Tribler (BitTorrent client) uses a gossip protocol to add keyword search capabilities,
as well as to discover relevant content. At every step, it either connects to a known peer
or exchanges information with a random peers. see:
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.78.4174&rep=rep1&type=pdf