Chapter 4-Communication
Chapter 4-Communication
Chapter 4-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 which is
harder 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 how processes communicate in a network (the rules
or the protocols) and their structures
introduce the five widely used communication models for
distributed systems:
Remote Procedure Call (RPC) - which hides the details of
message passing and suitable for client-server models
Remote Object (Method) Invocation (RMI)
Message-Oriented Middleware (MOM) - instead of the
client-server model, think in terms of messages and have
a high level message queuing model similar to e-mail
Stream-Oriented Communication - for multimedia to
support the continuous flow of messages with timing
constraints
Multicast Communication - information dissemination for
several recipients
3
4.1 Network Protocols and Standards
why communication in distributed systems? because there is
no shared memory
two communicating processes must agree on the syntax and
semantics of messages
a protocol is a set of rules that governs data communications
a protocol defines what is communicated, how it is
communicated, and when it is communicated
for instance, for one computer to send a message to another
computer, the first computer must perform the following
general steps (highly simplified)
break the data into small sections called packets (message,
datagram, packet, frame)
add addressing information to the packets identifying the
source and destination computers
deliver the data to the network interface card for
transmission over the network
4
the receiving computer must perform the same steps, but in
reverse order
accept the data from the NIC
remove transmitting information that was added by the
transmitting computer
reassemble the packets of data into the original message
the key elements of a protocol are syntax, semantics, and
timing
syntax: refers to the structure or format of the data
semantics: refers to the meaning of each section of bits
timing: refers to when data should be sent and how fast
they can be sent
functions of protocols
each device must perform the same steps the same way
so that the data will arrive and reassemble properly; if
one device uses a protocol with different steps, the two
devices will not be able to communicate with each other
5
Protocols in a layered architecture
protocols that work together to provide a layer or layers of
the model are known as a protocol stack or protocol suite,
e.g. TCP/IP
each layer handles a different part of the communications
process and has its own protocol
Data Communication Standards
standards are essential for interoperability
data communication standards fall into two categories
De facto standards: that have not been approved by an
organized body; mostly set by manufacturers
De jure standards: those legislated by an officially
recognized body such as ISO, ITU, ANSI, IEEE
6
Network (Reference) Models
Layers and Services
within a single machine, each layer uses the services
immediately below it and provides services for the layer
immediately above it
between machines, layer x on one machine communicates
with layer x on another machine
Two important network models or architectures
The ISO OSI (Open Systems Interconnection) Reference
Model
The TCP/IP Reference Model
a. The OSI Reference Model
consists of 7 layers
was never fully implemented as a protocol stack, but a
good theoretical model
Open – to connect open systems or systems that are open
for communication with other systems
7
layers, interfaces, and protocols in the OSI model
8
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; FTP, HTTP, SMTP, ...
Host (upper) Layers
9
a typical message as it appears on the network
10
b. The TCP/IP Reference Model
TCP/IP - Transmission Control Protocol/Internet Protocol
used by ARPANET and its successor the Internet
design goals
the ability to connect multiple networks (internetworking)
in a seamless way
the network should be able to survive loss of subnet
hardware, i.e., the connection must remain intact as long
as the source and destination machines are properly
functioning
flexible architecture to accommodate requirements of
different applications - ranging from transferring files to
real-time speech transmission
these requirements led to the choice of a packet-switching
network based on a connectionless internetwork layer
has 4 (or 5 depending on how you see it) layers:
Application, Transport, Internet (Internetwork), Host-to-
network (some split it into Physical and Data Link) 11
OSI and TCP/IP Layers Correspondence
12
Layers involved in various hosts (TCP/IP)
when a message is sent from device A to device B, it may
pass through many intermediate nodes
the intermediate nodes usually involve the first three layers
13
Middleware Protocols
a middleware is an application that contains general-purpose
protocols to provide services
example of middleware services
authentication and authorization services
distributed transactions (commit protocols; locking
mechanisms) - see later in Chapter 8
middleware communication protocols (calling a procedure
or invoking an object remotely, synchronizing streams for
real-time data, multicast services) - see later in this Chapter
hence an adapted reference model for networked
communications is required
14
an adapted reference model for networked communication
15
4.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