Thursday 25 September 2014

4:: Communication Models


•High level constructs [Helps the program in using underlying communication network]
•Two Types of Communication Models
1) Message passing
2) Remote Procedure Calls


1) Message Passing Primitives

•Two basic communication primitives
-SEND(a,b) , a-> Message , b-> Destination
-RECEIVE(c,d), c-> Source , d-> Buffer for storing the message

Message Passing Primitive Design Issues

  • buffered vs. unbuffered
  • blocking vs. nonblocking
  • reliable vs. unreliable
  • synchronous vs. asynchronous
Blocking vs Non blocking

           •Nonblocking
- SEND primitive return the control to the user process as soon as the message is copied from user buffer to kernel buffer
-Advantage : Programs have maximum flexibility in performing computation and communication in any order
-Drawback  Programming becomes tricky and difficult
•Blocking
-SEND primitive does not return the control to the user process until message has been sent or acknowledgement has been received
-Advantage : Program’s behavior is predictable
-Drawback  Lack of flexibility in programming

----> Means, Non Blocking control will not wait for any acknowledgement. It will engage in other tasks. And blocking will become dedicated control till message is transmitted.

Synchronous vs Asynchronous

•Synchronous
-SEND primitive is blocked until corresponding RECEIVE primitive is executed at the target computer
•Asynchronous
-Messages are buffered
-SEND primitive does not block even if there is no corresponding execution of the RECEIVE primitive
-The corresponding RECEIVE primitive can be either blocking or non-blocking

2) Remote Procedure Calls

RPC is an interaction between a client and a server
•Client invokes procedure on sever
•Server executes the procedure and pass the result back to client
•Calling process is suspended and proceeds only after getting the result from server

RPC Design issues

•Structure
•Binding
•Parameter and Result Passing
•Error handling, semantics and Correctness

Structure


Binding

•Determines remote procedure and machine on which it will be executed
•Check compatibility of the parameters passed
•Use Binding Server

•Parameter and Result Passing

Stub procedures converts parameters & Results in appropriate format.
Pack the info in parameters and while receiving it will converted as per local machine standard.

•Pack parameters into a buffer
•Receiver Stub Unpacks the parameters
•Expensive if done on every call
-Send Parameters along with code that helps to identify format so that receiver can do conversion
-Alternatively Each data type may have a standard format. Sender will convert data to standard format and receiver will convert from standard format to its local representation
•Passing Parameters by Reference 

Error handling, Semantics and Correctness

•RPC may fail either due to computer or communication failure
•If the remote server is slow the program invoking remote procedure may call it twice.
•If client crashes after sending RPC message
•If client recovers quickly after crash and reissues RPC
•Orphan Execution of Remote procedures
•RPC Semantics
-At least once semantics
-Exactly Once
-At most once




1 comment: