You are on page 1of 38

Chapter Three

Inter-Process Communication in Distributed System


Introduction
 Communication is the process of transferring
information from one place/object to another
place/object to share ideas and concepts among
objects.
 In distributed system communication is the interaction
among processes, users, programs in a networked
environment. Or
 It is the process of transferring objects (information
(text, audio, image),database object(records, fields,
table), web page object, code, etc) from one place to
another place to share ideas and concepts among
objects.
Inter Process Communication (IPC)
 IPC is the interaction among processes.
 A distributed application requires the participation of two
or more independent entities (processes).
E.g Chatting, db application(UI, database, processing
level)
 Each process can act as either the sender or the receiver.
E.g Inserting data on remote machine, displaying the
content of remote machine(DB, pages).
 why communication in distributed systems? because there
is no shared memory
Cont…
 Inter process 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
4
Network Protocols and Standards
 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
 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
 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 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 transport layer protocols: connection-oriented
and connectionless
6
Communication Paradigms in Distributed System

Shared memory
Remote procedure call (RPC)
Remote Method Invocation (RMI)
Message Oriented
Stream Oriented
Group Communication
Shared Memory

 Communication among a number of processors in one machine


is carried out using shared memory.
 Shared memory is an efficient means of passing data between
programs. One program will create a memory portion which
other processes (if permitted) can access.
 Example : using the output of one function on any other function. So the
two functions communicate by writing and reading the content of memory.
 In computer programming, shared memory is a method by which
program processes can exchange data more quickly than by
reading and writing using the regular operating system services.
 Os is acting as an interface between hardware and other software.
 We need some kind of synchronization between processes that
read and write shared memory.
 Using a designated area of shared memory, the data can be made
directly accessible to both processes without having to use the
system services.
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; what9 if
Client and Server Stubs
 RPC would like to make a remote procedure call look the
same as a local one; it should be transparent, i.e., the
calling procedure should not know that the called
procedure is executing on a different machine or vice versa

principle of RPC between a client and server program


 When a program is compiled, it uses different versions of
library functions called client stubs
 A server stub is the server-side equivalent of a client stub
10
Steps of a Remote Procedure Call
1. Client procedure calls client stub in the normal way
2. Client stub builds a message and calls the local OS
(packing parameters into a message is called parameter
marshaling)
3. Client's OS sends the message to the remote OS
4. Remote OS gives the message to the server stub
5. Server stub unpacks the parameters and calls the server
6. Server does the work and returns the result to the stub
7. Server stub packs it in a message and calls the local OS
8. Server's OS sends the message to the client's OS
9. Client's OS gives the message to the client stub
10. Stub unpacks the result and returns to client
 hence, for the client remote services are accessed by making
ordinary (local) procedure calls; not by calling send and
receive.
11
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

a) the interconnection between client and server in a traditional RPC


b) the interaction using asynchronous RPC 12
2. if the result can be collected later
 e.g., prefetching network addresses of a set of hosts, ...
 the server immediately sends an ack promising that it
will carryout the request
 the client can now proceed without blocking
 the server later sends the result

a client and server interacting through two asynchronous RPCs


13
 The above method combines two asynchronous
RPCs and is sometimes called deferred synchronous
RPC
 variants of asynchronous RPC
 let the client continue without waiting even for an ack,
called one-way RPC
 problem: if reliability of communication is not
guaranteed

14
Remote Object (Method) Invocation (RMI)
 Resulted from object-based technology that has proven its value in
developing non distributed 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.
15
Cont…
 The state of an object is not distributed, only the
interfaces are; such objects are also referred to as
remote objects
 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
tasks: a proxy marshals method invocation into
messages and unmarshals reply messages to return the
result of the method invocation to the client
 A server stub, called a skeleton, unmarshals
messages and marshals replies
common organization of a remote object with client-side proxy
17
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
 ...

18
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

19
Message Passing
 Message Passing is a form of communication used in parallel
computing(sending messages to different service providers), object-
oriented programming and intercrosses communication.
 Message passing provides a mechanism for the exchange of data in
memory distributed across the nodes of a cluster.
 Sending message to intermediate storage or directly to the receiver.
E.g email, text & video chatting application(direct)
 In this model ,processes or objects can send and receive messages
to other processes. Messages are sent from a sender to one or more
recipients.
– One-one-communication. E.g email, telephone, etc.
– One-to-many communication.1client process to many servers, email, TV&
Radio broadcasting, etc.
– Many-to-one communication. Many clients accessing a single server machine.
– Many-to-many communication
 Communication in the message passing paradigm is performed
using the send and receive functions.
 Send primitive needs destination process and the
message data as parameters.
 Receive primitive needs the name of sender
processor and should provide a storage buffer for the
message.
 Message passing systems make workers communicate
through a messaging system. Messages keep everyone
separated, so that workers cannot modify each other's
data.
Example: Radio and TV transmission from source to the
users node, Video conferences, telephone
communication.
 Two generic message passing primitives for sending and
receiving messages.
send (destination, message)
receive (source, message)
source or dest={ process name, object name, link,
mailbox, port}
Example:
– Send(A, message)… send message to mail box A
– Receive (A, message )….receiving message from mail
box A.
 The message passing system has to be told the following
information: sending process, sources location, data type,
data length, receiving process , destination location .
Classification of communication
 Assume the communication system is organized as a computer
network shown below

general organization of a communication system in which hosts are connected


through a network 23
Based on nature of middle ware storage device:
A) Persistent Communication: a message that has been submitted for
transmission is stored by the communication middleware as long as it
takes to deliver it to the receiver.
• Example: Email System
– email server is a middle wares which store the message at one
or several of the storage facilities.
Cont…

B) Transient Communication: 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.
 Both the sender and receiver must be active at the
time of communication.
 Example: telephone system
Cont…
Based on way of delivering of data:
A) Synchronous Communication:
 a message is only allowed to be sent if its destination is ready to
receive it.
 sender and receiver to wait for each other to transfer the
message.
 Synchronous communication can be blocked by channel being
busy or in error since only one message is allowed to be
transmitted via a channel at time.
 there is no memory sharing in message passing, there is no need
for mutual exclusion.
 no buffers are used in communication channels.
 If one process is ready to communicate and the other is not, the
one that is ready must be blocked (or wait).
– Example: machine having different speed of processing.
Cont…
 The sender is blocked until its message is stored in a local
buffer at the receiving host or delivered to the receiver
 sending and receiving of a message are dependent events.
 all parties involved in the communication are present at the
same time.
Example: telephone conversation (not texting), video
conferencing , a chat room event, etc.
 When you are having a conversation on the phone, you send
and receive messages instantaneously using the same
connection.
B) Asynchronous Communication
 sending and receiving of a message are independent events.
 Asynchronous message passing systems deliver a message from
sender to receiver without waiting for the receiver to be ready.
 it's one-way communication.
 It is store and forward message passing method.
 a sender continues immediately after it has submitted its message
for transmission
Example: postal system, e-mail messages, text messaging over cell
phones
Cont…

 The different types of communication can be combined


 persistent asynchronous: e.g., email
 transient asynchronous: e.g., asynchronous RPC
 In general there are six possibilities
persistent asynchronous communication persistent synchronous
communication

30
transient asynchronous receipt-based transient synchronous communication
communication

 weakest form; the sender is


blocked until the message is
stored in a local buffer at the
receiving host
31
delivery-based transient response-based transient synchronous
synchronous communication communication
at message delivery

 the sender is blocked until the  strongest form; the sender is


message is delivered to the blocked until it receives a reply
receiver for further processing message from the receiver

32
Stream Oriented Communication
 Until now, we focused on exchanging independent and complete units of
information;Time has no effect on correctness; a system can be slow or fast
 however, there are communications where time has a critical role
 stream-oriented communication provides facilities for the exchange of time-
dependent information (continuous media) such as audio and video streams
Multimedia
– media
• storage, transmission, interchange, presentation, representation and
perception of different data types:
• text, graphics, images, voice, audio, video, animation, ...
• movie: video + audio + …
Multimedia: handling of a variety of representation media
– end user pull
• information overload and starvation
– technology push
• emerging technology to integrate media
33
The Challenge
 new applications
 multimedia will be pervasive in few years (as graphics)
 storage and transmission
 e.g., 2 hours uncompressed HDTV (1920×1080) movie:
1.12 TB (1920×1080x3x25x60x60x2)
 videos are extremely large, even after compressed
(actually encoded)
 continuous delivery
 e.g., 30 frames/s (NTSC), 25 frames/s (PAL) for video
 guaranteed Quality of Service
 admission control
 search
 can we look at 100… videos to find the proper one?

34
 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

35
• 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 (only visual frames)
– 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, ...)
36
Multicast Communication
multicasting: delivery of data from one host to many destinations; for
instance for multimedia applications
• a one-to-many relationship
1.Application-Level Multicasting
• nodes are organized into an overlay network and information is
disseminated to its members (routers are not involved as in network-level
routing)
• how to construct the overlay network
– nodes organize themselves as a tree with a unique path between two
pairs of nodes or
– nodes organize into a mesh network and there will be multiple paths
between two nodes; adv: robust
2. Gossip-Based Data Transmission
– use epidemic protocols where information is propagated among a
collection of nodes without a coordinator

37
Thank you!
?

You might also like