Distributed System Message Passing
Distributed System Message Passing
Message passing is the basic IPC mechanism in distributed system due to non
availability of common memory area in Distributed System.
.
SYNCHRONIZATION
Receiving process knows that message has arrived in buffer by two techniques:
• Polling- receiver periodically poll the kernel to check the buffer.
• Interrupt- when message arrives a software interrupt is used to notify receiving
process.
SYNCHRONIZATION (Contd.)
Synchronous Communication:
* Synchronous comm. is simple and easy to implement and more reliable. But it
lacks concurrency and subject to deadlocks.
* Asynchronous comm. is complicated but provide better concurrency, reduced
message traffic and better flexibility.
BUFFERING
Receiving process have buffer where OS can copy the messages such that the
receiving process can later use it for execution.
Single Message Buffer: in this buffer having capacity to store single message is used
on the receivers node. So it keep message ready for use at receiver end.
BUFFERING (Contd.)
Finite Bound Buffer: unbounded capacity buffer is not practical so a finite message
buffer is used. Problem of buffer overflow arises in this and is tackled in two ways:
• Unsuccessful comm.- message transfer completely fail during buffer overflow.
• Flow controlled comm.- sender is blocked until the receiver accepts some
messages, thus creating space in the buffer for new messages.
Multi-Datagram Messages
All networks have an upper bound on size of data that can be transferred called
Maximum transfer unit (MTU).
Message greater than MTU are fragmented into multiple MTU and then
transferred.
* Sender:-
* Fragment message into multiple MTU.
* Each fragment along with some control info. is called packet/datagram is
sent to receiver.
* Message larger than MTU is converted into multi-datagram that bear
sequential relationship.
* Receiver:-
* Assembles the multi datagram after receiving.
Encoding & Decoding of Message Data
An absolute pointer value looses its meaning during transfer. For e.g.
Tree Structure. They must be transferred in some other form.
Different program object occupy different amount of storage space
( long, short, integers, character string), so message must contain
information that which program object is stored where in message
buffer.
Encoding & Decoding of Message Data (Contd.)
Sender:
Do encoding i.e. convert program object to stream form that is easy to
transfer.
Receiver:
Do decoding i.e. reconstruction of original object program.
Tagged: type of program object with its value is encoded in message. More
expensive then untagged.
Process Addressing
Simple Addressing:
Process willing to send message uses the primitive as:
Limitation:
Doesn’t work if process is to be migrated to other machine for load balancing.
Non-transparent.
PROCESS ADDRESSING (Contd.)
When process is migrated, a link info. is left on its previous node. And New
node maintains the address of previous address.
At old node - machine_id@local_id@newnode_id
At new node – machine_id@local_id@oldnode_id
PROCESS ADDRESSING (Contd.)
Message may now easily travel over several nodes before reaching destination
process.
P1 P2
PROCESS ADDRESSING (Contd.)
Loss of request message: The request message lost in transit from sender to
receiver. It occurs due to communication failure or receiver node is down
Unsuccessful execution of request: The receiver node may get crash during
execution of request.
It occurs due to crashing of receiver node during processing.
Various IPC Protocols are given for reliable communication b/w Client-Server .
Four Level
Three Level
Two Level
Level-2> Server Kernel returns ACK to client. If client doesn’t get ACK within
time-out it retransmit request.
FAILURE HANDLING (Contd.)
Level-3> Server after processing client request, returns reply message to client.
Level-4> Client kernel returns ACK after receiving to server kernel. If ACK is not
received within time-out by Server it retransmits the reply message.
Level-2> Server after processing client request, returns reply message to client.
The client remains blocked until the reply is received.
If server takes much time to process client request then it sends ACK to client before
reply message. Otherwise it simply sends reply message as acknowledgment.
FAILURE HANDLING (Contd.)
Level-1> Client sends request message to server and remain blocked until reply
is received.
It is possible that request from client is executed more than once by server.
FAILURE HANDLING (Contd.)