Unit-II Message Passing and RPC
Unit-II Message Passing and RPC
Unit-II Message Passing and RPC
P Shared common P
1
memory area 2
(a)
P P
1 2
(b)
Two basic Inter Process Communication Paradigms: the shared data approach and message
passing approach.
In the shared-data approach the information to be shared is placed in a common memory
area that is accessible to all processes involved in an IPC.
In the message-passing approach, the information to be shared is physically copied from the
sender process’s space to the address space of all the receiver processes and this is done by
transmitting the data to be copied in the form of messages (message is a block of information).
A Message-Passing System is a subsystem of distributed operating system that provides a
set of message-based IPC protocols and does so by shielding the details of complex network
protocols and multiple heterogeneous platforms from programmers. It enables processes to
communicate by exchanging messages and allows programs to be written by using simple
communication primitives, such as send and receive.
(a) Simplicity: A message passing system should be simple and easy to use. It should be
possible to communicate with old and new applications, with different modules without the
need to worry about the system and network aspects.
(b) Uniform Semantics: In a distributed system, a message-passing system may be used for
the following two types of inter process communication:
i. Local Communication, in which the communicating process are on the same node;
iii. Survivability.
Atomicity ensures that every message sent to a group of receivers will be delivered to either
all of them or none of them. Ordered delivery ensures that messages arrive to all receivers in an
order acceptable to the application. Survivability guarantees that messages will be correctly
delivered despite partial failures of processes, machines, or communication links.
suspended
execution
Sender’s
Acknowledgment
Message
Executing state
Blocked state
execution suspended
Receive (message);
Execution resumed
Send (Acknowledgment)
execution suspended
Receive (message);
A variant of the nonblocking receive primitive is the conditional receive primitive, which also
returns control to the invoking process almost immediately, either with a message or with an
indicator that no message is available.
When both the send and receive primitives of a communication between two processes use
blocking semantics, the communication is said to be synchronous, otherwise it is asynchronous.
The main drawback of synchronous communication is that it limits concurrency and is subject to
communication deadlocks.
Sending Receiving
process process
Mess
age
Single- message
Node buffer
boundary
(b)
Sending Receiving
process Message 1
process
Message 2
Message
Message 3
Message n
Multiple-message
buffer/mailbox/port
(c)
When the buffer has finite bounds, a strategy is also needed for handling the problem of a
possible buffer overflow. The buffer overflow problem can be dealt with in one of the following two
ways:
Unsuccessful communication: In this method, message transfers simply fail, whenever
there is no more buffer space and an error is returned.
Flow-Controlled Communication: The second method is to use flow control, which means
that the sender is blocked until the receiver accepts some messages, thus creating space in the
buffer for new messages. This method introduces a synchronization between the sender and the
receiver and may result in unexpected deadlocks. Moreover, due to the synchronization imposed,
the asynchronous send does not operate in the truly asynchronous mode for all send commands.
Request message
(Cantaions remote
Call procedure and procedure’s parameter Receive request and start
wait for reply procedure execution
Procedure executes
Client Packs
Server packet
(1) Client :
i. A Client is a user process which initiates a RPC.
ii. The client makes a normal call that will invoke a corresponding procedure in the
client stub.
Client Server
Request Message
First Procedure
RPC execution
Reply Message
Acknowledgement for the
request message
Request Message
Acknowledgement for the
Procedure
Next reply of on a previous RPC
execution
RPC Reply Message
Acknowledgement for the
request message
Request Message
First Procedure
RPC Reply Message execution
Acknowledgement for the
request message
Request Message
Acknowledgement for the
Procedure
Next reply of on a previous RPC
execution
RPC Reply Message
Acknowledgement for the
request message
The process willing to communicate does not explicitly name a process for communication
(the sender names a server instead of a process). This type of process addressing is also known as
functional addressing.
1. Address: It contains characters that uniquely identify the sending and receiving
processes in the network.
2. Sequence number: This is the message identifier (ID), which is very useful for
identifying lost messages and duplicates messages, in case of system failures.
3. Structural information: This element also has two parts. The type part specifies
whether the data to be passed on to the receiver is included within the message or the
message only contains a pointer to the data, which is stored somewhere outside the
contiguous portion of the message. The second part of this element specifies the length
of the variable – size message data.
Structural
Addresses
information
Actual data Sequence
or pointer to Number of typ number or Receiving Sending
the data bytes/ e message ID process process
elements address address
(a) Server/client relationship (binding): While a local procedure call depends on a static
relationship between the calling and the called procedure, the RPC paradigm requires a more
dynamic behaviour. As with a local procedure call, the RPC establishes this relationship through
binding between the calling procedure (client) and the called procedure (server). However, in the
RPC case a binding usually depends on a communications link between the client and server RPC
runtime systems. A client establishes a binding over a specific protocol sequence to a specific host
system and endpoint.
(b) No assumption of shared memory: Unlike a local procedure call, which commonly
uses the call – by – reference passing mechanism for input/output parameters, RPCs with
input/output parameters have copy – in, copy – out semantics due to the differing address spaces of
calling and called procedures.
(c) Independent failure: Beyond execution errors that arise from the procedure call itself,
an RPC introduces additional failure cases due to execution on physically separate machines.
Remoteness introduces issues such as remote system crash, communications links, naming and
binding issues, security problems and protocol incompatibilities.
(d) Security: Executing procedure calls across physical machine boundaries has additional
security implications. Client and server must establish a security context based on the underlying
security protocols and they require additional attributes for authorizing access.