Chapter 2 Communication
Chapter 2 Communication
Introduction
interprocess communication is at the heart of all distributed
systems
communication in distributed systems is based on message
passing as offered by the underlying network as opposed to
using shared memory
modern distributed systems consist of thousands of
processes scattered across an unreliable network such as
the Internet
unless the primitive communication facilities of the network
are replaced by more advanced ones, development of large
scale Distributed Systems becomes extremely difficult
2
Objectives of the Chapter
review of how processes communicate in a network (the
rules or the protocols) and their structures
introduce the four widely used communication models for
distributed systems:
Remote Procedure Call (RPC)
Remote Method Invocation (RMI)
Message-Oriented Middleware (MOM)
Streams
3
2.1 Layered Protocols
two computers, possibly from different manufacturers, must
be able to talk to each other
for such a communication, there has to be a standard
The ISO OSI (Open Systems Interconnection) Reference
Model is one of such standards - 7 layers
TCP/IP protocol suite is the other; has 4 or 5 layers
OSI
Open – to connect open systems or systems that are open
for communication with other open systems using standard
rules that govern the format, contents, and meaning of the
messages sent and received
these rules are called protocols
two types of protocols: connection-oriented and
connectionless
4
layers, interfaces, and protocols in the OSI model
5
Physical Layer
Definition: The physical layer is the lowest layer of the OSI
model and deals with the transmission of raw binary data over a
physical medium.
It defines the electrical, mechanical, procedural aspects of
transmission, such as voltage levels, cable types, and data rates.
Functionality: Its primary function is to transmit bits over a
communication channel reliably.
It handles tasks such as signal encoding, modulation, and
transmission media.
Example: Ethernet, Wi-Fi, Fiber optic cables.
6
Data Link Layer:
Definition: The data link layer is responsible for reliable data
delivery across the link between two directly connected nodes.
It provides error detection and correction, as well as flow control
to ensure data integrity during transmission.
Functionality: It manages the link between devices, establishes
and terminates connections, and handles framing, error detection,
and flow control.
Example: Ethernet (MAC layer), Point-to-Point Protocol (PPP).
7
Network Layer:
8
Transport Layer:
9
Session Layer:
10
Media (lower) Layers
Physical: Physical characteristics of the media
Data Link: Reliable data delivery across the link
Network: Managing connections across the network
or routing
Transport: End-to-end connection and reliability
(handles
lost packets); TCP (connection-oriented),
UDP (connectionless), etc.
Session: Managing sessions between applications
(dialog control and synchronization); rarely
supported
Presentation: Data presentation to applications; concerned
with the syntax and semantics of the
information transmitted
Application: Network services to applications; contains
protocols that are commonly needed by
users;
Host (upper) FTP, HTTP, SMTP, ...
Layers
11
a typical message as it appears on the network
12
a conversation occurs between a sender and a receiver at each
layer
e.g., at the data link layer
transactional TCP
15
2.2 Remote Procedure Call
the first distributed systems were based on explicit message
exchange between processes through the use of explicit
send and receive procedures; but do not allow access
transparency
in 1984, Birrel and Nelson introduced a different way of
handling communication: RPC
it allows a program to call a procedure located on another
machine
simple and elegant, but there are implementation problems
the calling and called procedures run in different address
spaces
parameters and results have to be exchanged; what if the
machines are not identical?
what happens if both machines crash?
16
Conventional Procedure Call, i.e., on a single machine
e.g. count = read (fd, buf, bytes); a C like statement, where
fd is an integer indicating a file
buf is an array of characters into which data are read
bytes is the number of bytes to be read
Stack pointer
Stack pointer
a. Doors
the original RPC model assumes that the caller and the callee
can communicate only by means of passing messages over a
network; what if they are colocated on the same machine?
22
1. the server process registers a door before it can be called (door_create)
and a name is attached to it
1. a client calls a door by a system call (door_call) including all parameters
2. results are returned by the system call door_return
24
b. Asynchronous RPC
if there is no need to block the client until it gets a reply
two cases
1. if there is no result to be returned
e.g., adding entries in a database, ...
the server immediately sends an ack promising that it will carryout
the request
the client can now proceed without blocking
27
2.2.4 DCE (Distributed Computing Environment) RPC
a middleware and an example RPC system developed by OSF
(Open Software Foundation), now The Open Group
it is designed to execute as a layer of abstraction between
existing OSs and distributed applications
the Open Group sells the source code and vendors integrate it
into their systems
it uses the client-server programming model and
communication is by means of RPCs
services
distributed file service: a worldwide file system that provides
a transparent way of accessing files
directory service: to keep track of the location of all
resources in the system (machines, printers, data,
servers, ...); a process can ask for a resource without
knowing its location
security service: for protecting resources; access is only
through authorization
28
distributed time service: to maintain clocks on different
machines synchronized (clock synchronization is covered in
Chapter 5)
29
Uuidgen generates a prototype IDL file with a globally unique interface identifier
the IDL file is edited (filling the names of procedures and parameters) and the
IDL compiler is called to generate 3 files
the application writer writes the client and server codes and are then compiled
and linked together with the stubs
30
Binding a Client to a Server in DCE RPC
31
32
2.3 Remote Object (Method) Invocation (RMI)
resulted from object-based technology that has proven its
value in developing nondistributed applications
it is an expansion of the RPC mechanisms
it enhances distribution transparency as a consequence of
an object that hides its internal from the outside world by
means of a well-defined interface
Distributed Objects
an object encapsulates data, called the state, and the
operations on those data, called methods
methods are made available through interfaces
the state of an object can be manipulated only by invoking
methods
this allows an interface to be placed on one machine while
the object itself resides on another machine; such an
organization is referred to as a distributed object
the state of an object is not distributed, only the interfaces
are; such objects are also referred to as remote objects 33
the implementation of an object’s interface is called a proxy (analogous to a client stub
in RPC systems)
it is loaded into the client’s address space when a client binds to a distributed object
34
common organization of a remote object with client-side proxy
35
Binding a Client to an Object
a process must first bind to an object before invoking its
methods, which results in a proxy being placed in the
process’s address space
binding can be implicit (directly invoke methods using
only a reference to an object) or explicit (by calling a
special function)
an object reference could contain
network address of the machine where the object
resides
endpoint of the server
an identification of which object
the protocol used
...
36
Parameter Passing
there are two situations when invoking a method with
object reference as parameter; is the object local or
remote to the client?
remote object: copy and pass the reference of the object
as a value parameter; this means the object is passed by
reference
local object: a copy of the object is passed; this means the
object is passed by value
37
the situation when passing an object by reference or by value
38
2.4 Message Oriented Communication
RPCs and RMIs are not adequate for all distributed system
applications
the provision of access transparency may be good but
they have semantics that is not adequate for all
applications
example problems
they assume that the receiving side is running at the
time of communication
a client is blocked until its request has been processed
39
communication can be
persistent or transient
asynchronous or synchronous
persistent: a message that has been submitted for
transmission is stored by the communication system as long
as it takes to deliver it to the receiver
e.g., email delivery, snail mail delivery
40
transient: a message that has been submitted for transmission is
stored by the communication system only as long as the sending
and receiving applications are executing
asynchronous: a sender continues immediately after it has
submitted its message for transmission
synchronous: the sender is blocked until its message is
stored in a local buffer at the receiving host or delivered to the
receiver
the different types of communication can be combined
persistent asynchronous: e.g., email
transient asynchronous: e.g., UDP, asynchronous RPC
in general there are six possibilities
Persistent Transient
Asynchronous
41
persistent asynchronous communication persistent synchronous communication
42
2.4.2 Message-Oriented Transient Communication
many applications are built on top of the simple message-
oriented model offered by the transport layer
standardizing the interface of the transport layer by
providing a set of primitives allows programmers to use
messaging protocols
they also allow porting applications
1. Berkley Sockets
an example is the socket interface as used in Berkley
UNIX
a socket is a communication endpoint to which an
application can write data that are to be sent over the
network, and from which incoming data can be read
43 B
Primitive Meaning Executed by
44
connection-oriented communication pattern using sockets
45
2. The Message-Passing Interface (MPI)
sockets were designed to communicate across networks
using general-purpose protocol stacks such as TCP/IP
they were not designed for proprietary protocols
developed for high-speed interconnection networks; of
course portability will suffer
MPI is designed for parallel applications and tailored for
transient communication
MPI assumes communication takes place within a known
group of processes, where each group is assigned an
identifier (groupID)
each process within a group is also assigned an identifier
(processID)
a (groupID, processID) identifies the source or destination
of a message, and is used instead of a transport-level
address
46
Primitive Meaning
MPI_ssend Send a message and wait until receipt starts (to support
delivery-based transient synchronous communication)
MPI_sendrecv Send a message and wait for reply (to support response-
based transient synchronous communication)
48
four combinations for loosely-coupled communications using queues
49
Primitive Meaning
50
General Architecture of a Message-Queuing System
messages can be put only into queues that are local to the
sender (same machine or on a nearby machine on a LAN)
such a queue is called the source queue
messages can also be read only from local queues
a message put into a local queue must contain the specification
of the destination queue; hence a message-queuing system must
maintain a mapping of queues to network locations; like in DNS
52
Message Brokers
how can applications understand the messages they receive
each receiver can not be made to understand message formats
of new applications
hence, in a message-queuing system conversations are
handled by message brokers
a message broker converts incoming messages to a format
that can be understood by the destination application based on
a set of rules
54
Types of Media
two types
discrete media: text, executable code, graphics, images;
temporal relationships between data items are not
fundamental to correctly interpret the data
continuous media: video, audio, animation; temporal
relationships between data items are fundamental to
correctly interpret the data
a data stream is a sequence of data units and can be applied
to discrete as well as continuous media
stream-oriented communication provides facilities for the
exchange of time-dependent information (continuous media)
such as audio and video streams
55
timing in transmission modes
asynchronous transmission mode: data items are transmitted
one after the other, but no timing constraints; e.g. text
transfer
synchronous transmission mode: a maximum end-to-end
delay defined for each data unit; it is possible that data can
be transmitted faster than the maximum delay, but not slower
isochronous transmission mode: maximum and minimum
end-to-end delay are defined; also called bounded delay
jitter; applicable for distributed multimedia systems
a continuous data stream can be simple or complex
simple stream: consists of a single sequence of data; e.g.,
mono audio, video only
complex stream: consists of several related simple streams
that must be synchronized; e.g., stereo audio, video
consisting of audio and video (may also contain subtitles,
translation to other languages, ...)
56
movie as a set of simple streams
57
a stream can be considered as a virtual connection between a
source and a sink
the source or the sink could be a process or a device
59
QoS Dimensions
timeliness dimensions
latency (maximum delay between consecutive frames)
start-up latency (maximum delay before starting a
presentation)
jitter (delay variance)
volume dimensions
throughput in frames/sec or bits/sec or bytes/sec
reliability dimensions
MTBF (Mean Time Between Failure) of disks
MTTR (Mean Time To Repair)
error rates on the telecommunication lines
60
QoS Requirements
deterministic
precise values or ranges
e.g., latency must be between 45 and 55 ms
probabilistic
probability of the required QoS
e.g., latency should be < 50 ms for 95% of the frames
stochastic distributions
e.g., frame arrival should follow normal distribution with
mean interval-time of 40 ms and 5 ms variance
classes
e.g., guaranteed and best effort
61
QoS Management
can be static or dynamic
Static QoS Management Functions
specification
e.g., deterministic range for timeliness, volume and
reliability categories
negotiation
the application may accept lower level of QoS for
lower cost
admission control
if this test is passed, the system has to guarantee the
promised QoS
resource reservation
may be necessary to provide guaranteed QoS
62
Dynamic QoS Management Functions
monitoring
notices deviation from QoS level
at a certain level of granularity (e.g., every 100 ms)
policing
detect participants not keeping themselves to the contract
e.g., source sends faster than negotiated (e.g., 25 fps)
maintenance
sustaining the negotiated QoS
e.g., the system requires more resources
renegotiation
client tries to adapt – may be can accept lower QoS
63
QoS requirements can be specified using flow specification
containing bandwidth requirements, transmission rates,
delays, ...
e.g. by Partridge (1992)
it uses the token bucket algorithm which specifies how the
stream will shape its network traffic (in fact the leaky
bucket, as used in networking)
the idea is to shape bursty traffic into fixed-rate traffic by
averaging the data rate
packets may be dropped if the bucket is full
the input rate may vary, but the output rate remains
constant
64
Stream Synchronization
how to maintain temporal relations between streams, e.g., lip
synchronization
two approaches
1. explicitly by operating on the data units of simple streams; the
responsibility of the application
66