0% found this document useful (0 votes)
6 views

Unit-4(kd)

The document discusses Inter-Process Communication (IPC), which facilitates communication and synchronization between processes in distributed systems through mechanisms like shared memory and message passing. It outlines various communication protocols, including connection-oriented (TCP) and connectionless (UDP) protocols, and emphasizes the importance of Remote Procedure Calls (RPC) and message-oriented communication for efficient data exchange. Additionally, it covers the characteristics of stream-oriented communication and the role of middleware in supporting diverse communication needs in distributed systems.

Uploaded by

Samrat Acharya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Unit-4(kd)

The document discusses Inter-Process Communication (IPC), which facilitates communication and synchronization between processes in distributed systems through mechanisms like shared memory and message passing. It outlines various communication protocols, including connection-oriented (TCP) and connectionless (UDP) protocols, and emphasizes the importance of Remote Procedure Calls (RPC) and message-oriented communication for efficient data exchange. Additionally, it covers the characteristics of stream-oriented communication and the role of middleware in supporting diverse communication needs in distributed systems.

Uploaded by

Samrat Acharya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Unit 4: Communication

By Kabita Dhital
Bca
Inter Process Communication (IPC)

• Inter-process communication (IPC) is a mechanism that allows processes to


communicate with each other and synchronize their actions.
• "Inter-process communication is used for exchanging useful information
between numerous threads in one or more processes (or programs)."
• Inter Process Communication is a type of mechanism usually provided by
the operating system (or OS).
• The main aim or goal of this mechanism is to provide communications in
between several processes.
• The communication between these processes can be seen as a method of
co-operation between them.
• Processes can communicate with each other through both:
• Shared Memory
• Message passing
• Inter-process communication is at the heart of all distributed systems.
• It makes no sense to study distributed systems without carefully examining
the ways that processes on different machines can exchange information.
• Modern distributed systems often consist of thousands or even millions of
processes scattered across a network with unreliable communication such
as the Internet.
• Communication in distributed systems is always based on low-level
message passing as offered by the underlying network.
• Expressing communication through message passing is harder than using
primitives based on shared memory, as available for non distributed
platforms.
• Unless the primitive communication facilities of computer networks are
replaced by something else, development of large-scale distributed
applications is extremely difficult.
What we will study ?
• The rules that communicating processes must
adhere to, known as protocols, and concentrate
on structuring those protocols in the form of
layers.
 Widely-used models for communication:
 Remote Procedure Call (RPC),
 Message-Oriented Middleware (MOM), and
 data streaming.
• Multicasting concept: the general problem of
sending data to multiple receivers
• Before we start our discussion on communication
in distributed systems, we first recapitulate some
of the fundamental issues related to
communication.
Communication Protocol
• Protocol: Set of rules on communication.
• Communication protocols in the network are the rules that are followed
when transmitting and receiving or exchanging information.
• The protocol defines the rules, syntax, semantics,
and synchronization of communication and possible error recovery
methods.
• Protocols may be implemented by hardware, software, or a combination of
both
• To allow a group of computers to communicate over a network, they must
all agree on the protocols to be used.
• Protocols can be connectionless and connection oriented
• Synchronous communication refers to a communication
pattern where services communicate with each other in a
request-response manner and typically wait for a response
before proceeding.
Connection-oriented Protocol
• . It requires a logical connection to be established between the two processes before
data is exchanged.
• The connection must be maintained during the entire time that communication is
taking place, then released afterwards.
• The process is much like a telephone call, where a virtual circuit is established--the
caller must know the person's telephone number and the phone must be answered--
before the message can be delivered.
• TCP is an example of a connection-oriented protocol.
• Examples of services that use connection-oriented transport services are telnet,
and ftp.
• TCP (Transmission Control Protocol) is a connection-oriented protocol that allows
communication between two or more computer devices by establishing connections
in the same or different networks. It is the most important protocol that
uses internet protocol to transfer the data from one end to another. Hence, it is
sometimes referred to as TCP/IP. It ensures that the connection is established and
maintained until the data packet is transferring between the sender and receiver is
complete.
Connectionless Protocol
• A connectionless protocol doesn’t establish a dedicated connection between
devices before transmitting data. A connectionless protocol sends each
packet as an independent unit and transmits them separately.
• Unlike connection-oriented protocols, connectionless protocols don’t
guarantee the delivery of all packets or to deliver them in order.
• No setup in advance is needed.
• The sender just transmits the first message when it is ready.
• Dropping a letter in a mailbox is an example of connectionless
communication.
• UDP (User Datagram Protocol) is an example of a connectionless protocol
that is used for the fast delivery of information where a degree of packet
loss is generally acceptable if it allows for faster transmission of data.
Moreover, UDP is a transport layer protocol in the internet protocol suite.
• OSI MODEL next slide
Types of Communication
• To understand the various alternatives in
communication that middleware can offer to
applications, we view the middleware as an
additional service in client-server computing, ,
as shown in Fig.
Example: electronic mail system
• In principle, the core of the mail delivery system can be seen as a
middleware communication service.
• Each host runs a user agent allowing users to compose, send, and
receive e-mail.
• A sending user agent passes such mail to the mail delivery system,
expecting it, in tum, to eventually deliver the mail to the intended
recipient.
• Likewise, the user agent at the receiver's side connects to the mail
delivery system to see whether any mail has come in.
• If so, the messages are transferred to the user agent so that they can
be displayed and read by the user.
REMOTE PROCEDURE CALL
• A Remote Procedure Call (RPC) is a software communication protocol that
one program uses to request a service from another program located on a
different computer and network, without having to understand the
network's detail.
• Remote Procedure Call (RPC) is a powerful technique for
constructing distributed, client-server based applications.ls.
RPC: Definition
• Concept: Allowing programs to call procedures located on other machines.
• When a process on machine A calls a procedure on machine B, the calling
process on A is suspended, and execution of the called procedure takes
place on B.
• Information can be transported from the caller to the call in the parameters
and can come back in the procedure result.
• No message passing at all is visible to the programmer.
• This method is known as Remote Procedure Call, or often just RPC.
• While the basic idea sounds simple and elegant, subtle problems exist.
• To start with, because the calling and called procedures run on different
machines, they execute in different address spaces, which causes
complications.
• Parameters and results also have to be passed, which can be complicated,
especially if the machines are not identical.
• Finally, either or both machines can crash and each of the possible failures
causes different problems.
• Still, most of these can be dealt with, and RPC is a widely-used technique
that underlies many distributed systems.
Basic RPC Operation
• We first start with discussing conventional procedure calls, and then
explain how the call itself can be split into a client and server part that are
each executed on different machines.
Advantage
• RPC support process oriented and client
oriented model.
• The internal message passing mechanism of
RPC is hidden from the user.
• The effort to re-write and re-develop the code
minimum in RPC.
• RPC can be used in distributed environment
as the local environment.
Asynchronous RPC
• RPC provides both blocking (synchronous) and non-blocking (asynchronous)
calls.
• Most asynchronous RPC systems only support calls that do not return a value
and few support both classes.
• As in conventional procedure calls, when a client calls a remote procedure, the
client will block until a reply is returned.
• This strict request-reply behavior is unnecessary when there is no result to
return, and only leads to blocking the client while it could have proceeded and
have done useful work just after requesting the remote procedure to be
called.
• Examples of where there is often no need to wait for a reply include:
• transferring money from one account to another,
• adding entries into a database,
• starting remote services,
• batch processing, and so on.
• To support such situations, RPC systems may
provide facilities for what are called
asynchronous RPCs, by which a client
immediately continues after issuing the RPC
request.
• The reply acts as an acknowledgment to the
client that the server is going to process the
RPC.
• The client will continue without further
blocking as soon as it has received the server's
acknowledgment.
MESSAGE-ORIENTED
COMMUNICATION
What we discuss here:
• what exactly synchronous behavior is and
what its implications are
• messaging systems that assume that parties
are executing at the time of communication.
• examine message-queuing systems that allow
processes to exchange information, even if the
other party is not executing at the time
communication is initiated.
MESSAGE-ORIENTED COMMUNICATION
Persistent Communication

• An electronic mail system is a typical example in which


communication is persistent.
• With 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.
• In this case, the middleware will store the message at one or several
of the storage facilities.
• As a consequence, it is not necessary for the sending application to
continue execution after submitting the message.
• Likewise, the receiving application need not be executing when the
message is submitted.
Transient Communication

• In contrast, with transient communication, a message is stored by


the communication system only as long as the sending and receiving
application are running.
• More precisely, the middleware cannot deliver a message due to a
transmission interrupt, or because the recipient is currently not
active, it will simply be discarded.
• Typically, all transport-level communication services offer only
transient communication.
• Example:-Router
• If a router cannot deliver a message to the next one or the
destination host, it will simply drop the message.
Synchronous Communication
• Synchronous communication typically requires an immediate response as
the sender and recipient exchange information simultaneously.
• Examples of synchronous communication include video conferencing,
instant messaging, and telephone conversations.
• Synchronous communication is real-time communication where you can
exchange information with others immediately.
• There are essentially three points where synchronization can take place.
• First, the sender may be blocked until the middleware notifies that it will
take over transmission of the request.
• Second, the sender may synchronize until its request has been delivered to
the intended recipient.
• Third, synchronization may take place by letting the sender wait until its
request has been fully processed, that is, up the time that the recipient
returns a response.
Asynchronous communication
• In asynchronous communication, while it may be possible to send
and receive information simultaneously, there's typically no
expectation of immediate replies.
• Sender continues immediately after message sent.
• Example:- the answering machine.
Basic RPC Operation
• We first start with discussing conventional procedure calls, and
then explain how the call itself can be split into a client and
server part that are each executed on different machines.
Conventional Procedure Call
Conventional (i.e., single m
Consider a call in C like:
Count = read(fd, buf, nbytes)
Where,
fd →integer indicating a file,
buf→an array of characters into which data are read, and
nbytes → another integer telling how many bytes to read
• parameters can be call-by value or call-by-
reference.
Message-Oriented Transient Communication
 Berkeley Socket Primitives, and
 Message-Passing Interface (MPI)
Message-Oriented Persistent Communication
 Message Queuing Systems (MQS)
Message-Oriented Transient
Communication
• Messages are sent through a channel abstraction.
• The channel connects two running processes.
• Time coupling between sender and receiver.
• Transmission time is measured in terms of milliseconds,
typically.
• Examples:
 Berkeley Sockets — typical in TCP/IP-based networks
 MPI (Message-Passing Interface) — typical in high-speed
interconnection networks among parallel processes
Berkeley Socket Primitives
• Berkeley sockets is an application programming interface (API) for Internet
sockets and Unix domain sockets, used for inter-process communication (IPC).
• Universally, known as sockets.
• Identified by IP address and port number.
• It is commonly implemented as a library of linkable modules.
• The name derives from the origins of the API in release 4.2 of the Berkeley Standard
Distribution (4.2BSD) of UNIX.
• Berkeley sockets act at the transport layer:
• They help get the data where it's going, but have nothing to say about the content of
the data.
• Berkeley sockets are part of an API, not a specific protocol, which defines how the
programmer interacts with an idealized network.
• Berkeley Sockets — typical in TCP/IP-based networks.
• A socket can be thought of as an endpoint in a two-way communication channel.
• A socket is bound to a port number so that the TCP layer can identify the application
that data is destined to be sent to.
Message-Passing Interface
• Typical in high-speed interconnection networks among
parallel processes.
• Standard library for message passing that can be used to
develop portable message-passing programs using
either c or fortan.
• The message passing interface (MPI) is a standardized means
of exchanging messages between multiple computers running
a parallel program across distributed memory.
• There are many implementations of MPI, including Intel,
Microsoft, and others.
• Can be used in clusters and parallel computers.
• Can be used to write parallel libraries.
• The message passing interface (MPI) is a standardized
means of exchanging messages between multiple computers
running a parallel program across distributed memory.
MPI assumptions:
• communication within a known group of processes,
• each group with assigned id,
• each process within a group also with assigned id,
• all serious failures (process crashes, network partitions)
assumed as fatal and without any recovery.
• a (groupID, processID) pair used to identify source and
destination of the message,
• only receipt-based transient synchronous communication
(d) not supported, other supported.
Message-Oriented Persistent
Communication
• Message-queuing systems – a.k.a. Message-
Oriented Middleware (MOM)
• Basic idea: MOM provides message storage
service.
• A message is put in a queue by the sender,
and delivered to a destination queue .
• The target(s) can retrieve their messages from
the queue.
• Example: IBM’s WebSphere
• Time uncoupling: a sender can send a message
even if the receiver is still not available. The
message is stored and picked up at a later
moment.
• Time coupled interactions are observable when
communication cannot take place unless both
endpoints are operating at the same time.
STREAM-ORIENTED COMMUNICATION
• Stream-oriented communication can occur via simplex, half-duplex,
or full-duplex transmission.
• Factors like bandwidth, latency, jitter, and packet loss impact
quality of service.
• Stream oriented communication is a form of communication in
which timing plays crucial role. E.g. audio stream
• Multicast Communication.
• Forms of communication in which timing plays a crucial role,
• Examples:-
• Financial services: Delivery of news, stock quotes etc.
• E-learning: Streaming content to many students at different levels.
Features
1) Support for continuous media.
2) Streams in distributed system.
3) Stream Management.
Stream oriented communication
-is a form of communication in which time plays crucial role.
Continue media
-Characterized by the fact that value is time dependent.
a) Audio
b) Video
c) Animations
d) Senor data(temperature, pressure etc)
Support for Continuous Media
Stream Characteristics
• Stream supports isochronous data
transmission.
• Stream are unidirectional.
• Simple stream: a single flow of data, eg.
Audio, video
• Complex stream: multiple data flow, eg.
Combination audio/video.
Data Stream
Summary
• Middleware enables much functionality in DS
• Especially the many types of interaction/communications necessary
• With rational reasons for every one!
• Remote Procedure Call (RPC) enables transparency
• But Message Queuing Systems necessary for persistent
communications
• IBM WebSphere is ok but a bit old, clunky & tired at this stage
• AMQP open source, more flexible, better Industrial support
• Multicast Communications are often necessary in DS

You might also like