Chapter 2-Communication
Chapter 2-Communication
Chapter 2 - Communication
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
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.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
layers, interfaces, and protocols in the OSI model
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
a typical message as it appears on the network
A conversation occurs between a sender and a receiver at
each layer
e.g., at the data link layer
Stack pointer
the message after receipt on the SPARC; wrong integer (5*224) 83886080, but
correct string
one approach is to invert the bytes of each word after
receipt
the message after being inverted (correct integer but wrong string)
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 collocated on
the same machine?
a door is a generic name for a procedure in the address
space of a server process that can be called by a process
collocated with the server
support from the local OS is required
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
to establish remote
references. return call lookup
The Stub serializing the
parameters to skeleton,
stub
the skeleton invoking the
remote method and
RMI Client
serializing the result back
to the stub.
Local Machine
The Stub and Skeleton
call
skeleton
Stub
RMI Client RMI Server
return
42
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
2.4.1 Persistence and Synchronicity in
Communication
assume the communication system is organized as a
computer network shown below
Persistent Transient
Asynchronous
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.
Primitive Meaning Executed by
Socket Create a new communication endpoint; also both
reserve resources to send and receive messages
Bind Attach a local address to a socket; e.g., IP
address with a known port number
Listen Announce willingness to accept connections; for
connection-oriented communication
Accept Block caller until a connection request arrives
servers
Connect Actively attempt to establish a connection; the
client is blocked until connection is set up
Send Send some data over the connection
Receive Receive some data over the connection
Close Release the connection
Socket primitives for TCP/IP
connection-oriented communication pattern using sockets
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
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)