Preetha/ME-CSE/I
INTRODUCTION
• High level constructs [Helps the program in
using underlying communication network]
• Two Types of Communication Models
– Message passing
– Remote Procedure Calls
Preetha/ME-CSE/I
Message Passing Method
• Two basic communication primitives
 SEND - Message & its Destination
 RECEIVE - Source of msg &Buffer for storing the
message
• Client-Server Computation Model
 Client sends Message to server and waits
 Server replies after computation
Preetha/ME-CSE/I
Design issues
Blocking vs Non blocking primitives
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 behavior is predictable.
• Drawback : Lack of flexibility in programming.Preetha/ME-CSE/I
Cont…
Synchronous vs Asynchronous Primitives
Synchronous
• SEND primitive is blocked until corresponding RECEIVE
primitive is executed at the target computer.
• Also known as rendezvous.
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.
• Drawback : buffering message is more complex , as it involves
creating , manging &destroying buffers.Preetha/ME-CSE/I
Details to be handled in Message Passing
• Pairing of Response with Requests
• Data Representation
• Sender should know the address of Remote
machine
• Communication and System failures
Preetha/ME-CSE/I
Remote procedure call (RPC)
• RPC is a protocol that one program can use to
request a service from a program located in
another computer in a network without having
to understand network details.
• RPC uses the client/server model.
• The requesting program is a client and the
service-providing program is the server.
Preetha/ME-CSE/I
Cont..
• The main idea of an RPC is to allow a local
computer (client) to remotely call procedures
on a remote computer (server).
• 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.
Preetha/ME-CSE/I
Preetha/ME-CSE/I
RPC design issues
• Structure
• Binding
• Parameter and Result Passing
• Error handling, semantics and Correctness
Preetha/ME-CSE/I
Structure
Stub : It is a piece of code used for converting parameters passed
during a RPC.
Client stub procedure :
• constructs a message containing identity of remote procedures & parameters.
• sends the message to remote server machine.
Server stub procedures :
• receives the message at remote machine side & passes the parameter to the
procedure specified.
• Upon completion, it passes the result back to the client-stub procedure ,which
returns the result to the client.
Preetha/ME-CSE/I
Binding
It is a process that determines the remote
procedure & the machine on which it will be
executed, upon a remote procedure invocation.
Binding server :
 Client-server model uses this server.
 It stores the server machine addresses along
with the services they provide.
Preetha/ME-CSE/I
Parameter and result passing
1. Stub procedures convert the parameters to remote machine
format and pack them into a buffer . After the message is
received , it must be unpacked.
Problems :Conversion becomes expensive if it has to be done
on every call.
2. Send the parameters along with a code identifying the format
used so that receiver can do the conversion.
Problems :Machine should know how to convert all the
formats that can possibly be used and poor portability
because whenever new representation is introduced into the
system, existing s/w need to be updated.
Preetha/ME-CSE/I
Cont..
 Each data type may have standard format in
the message .Here ,sender convert data to
standard format & receiver convert from
standard format to its local representation.
 Problem : arises if both sender and receiver
use the same internal representation.
 Another issue is passing parameter by value &
reference .Passing parameter by value is
simple but other is complicated
Preetha/ME-CSE/I
Error handling ,semantics & correctness
RPC fails for two reasons:
 Computer failure
 Communication failure
Semantics play a significant role in development of
programs for distributes computation.
RPC semantics :
 “At least once” semantics
 “exactly once” semantics
 “At most once” semantics
Preetha/ME-CSE/I
 “At least once” semantics
If RPC succeeds,it implies that atleast one execution of remote
procedure has taken place at remote machine.
Else 0,partial,one or more execution.
 “exactly once” semantics
If RPC succeeds,it implies that exactly one execution of
remote procedure has taken place at remote machine.
Else 0,partial,one execution.
 “At most once” semantics
Similar to exactly once semantics , in addition calls that do not
terminate do not produce any side effects and also referred as
Zero-or-one semantics.
Preetha/ME-CSE/I
Preetha/ME-CSE/I
Preetha/ME-CSE/I

Communication primitives

  • 1.
  • 2.
    INTRODUCTION • High levelconstructs [Helps the program in using underlying communication network] • Two Types of Communication Models – Message passing – Remote Procedure Calls Preetha/ME-CSE/I
  • 3.
    Message Passing Method •Two basic communication primitives  SEND - Message & its Destination  RECEIVE - Source of msg &Buffer for storing the message • Client-Server Computation Model  Client sends Message to server and waits  Server replies after computation Preetha/ME-CSE/I
  • 4.
    Design issues Blocking vsNon blocking primitives 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 behavior is predictable. • Drawback : Lack of flexibility in programming.Preetha/ME-CSE/I
  • 5.
    Cont… Synchronous vs AsynchronousPrimitives Synchronous • SEND primitive is blocked until corresponding RECEIVE primitive is executed at the target computer. • Also known as rendezvous. 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. • Drawback : buffering message is more complex , as it involves creating , manging &destroying buffers.Preetha/ME-CSE/I
  • 6.
    Details to behandled in Message Passing • Pairing of Response with Requests • Data Representation • Sender should know the address of Remote machine • Communication and System failures Preetha/ME-CSE/I
  • 7.
    Remote procedure call(RPC) • RPC is a protocol that one program can use to request a service from a program located in another computer in a network without having to understand network details. • RPC uses the client/server model. • The requesting program is a client and the service-providing program is the server. Preetha/ME-CSE/I
  • 8.
    Cont.. • The mainidea of an RPC is to allow a local computer (client) to remotely call procedures on a remote computer (server). • 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. Preetha/ME-CSE/I
  • 9.
  • 10.
    RPC design issues •Structure • Binding • Parameter and Result Passing • Error handling, semantics and Correctness Preetha/ME-CSE/I
  • 11.
    Structure Stub : Itis a piece of code used for converting parameters passed during a RPC. Client stub procedure : • constructs a message containing identity of remote procedures & parameters. • sends the message to remote server machine. Server stub procedures : • receives the message at remote machine side & passes the parameter to the procedure specified. • Upon completion, it passes the result back to the client-stub procedure ,which returns the result to the client. Preetha/ME-CSE/I
  • 12.
    Binding It is aprocess that determines the remote procedure & the machine on which it will be executed, upon a remote procedure invocation. Binding server :  Client-server model uses this server.  It stores the server machine addresses along with the services they provide. Preetha/ME-CSE/I
  • 13.
    Parameter and resultpassing 1. Stub procedures convert the parameters to remote machine format and pack them into a buffer . After the message is received , it must be unpacked. Problems :Conversion becomes expensive if it has to be done on every call. 2. Send the parameters along with a code identifying the format used so that receiver can do the conversion. Problems :Machine should know how to convert all the formats that can possibly be used and poor portability because whenever new representation is introduced into the system, existing s/w need to be updated. Preetha/ME-CSE/I
  • 14.
    Cont..  Each datatype may have standard format in the message .Here ,sender convert data to standard format & receiver convert from standard format to its local representation.  Problem : arises if both sender and receiver use the same internal representation.  Another issue is passing parameter by value & reference .Passing parameter by value is simple but other is complicated Preetha/ME-CSE/I
  • 15.
    Error handling ,semantics& correctness RPC fails for two reasons:  Computer failure  Communication failure Semantics play a significant role in development of programs for distributes computation. RPC semantics :  “At least once” semantics  “exactly once” semantics  “At most once” semantics Preetha/ME-CSE/I
  • 16.
     “At leastonce” semantics If RPC succeeds,it implies that atleast one execution of remote procedure has taken place at remote machine. Else 0,partial,one or more execution.  “exactly once” semantics If RPC succeeds,it implies that exactly one execution of remote procedure has taken place at remote machine. Else 0,partial,one execution.  “At most once” semantics Similar to exactly once semantics , in addition calls that do not terminate do not produce any side effects and also referred as Zero-or-one semantics. Preetha/ME-CSE/I
  • 17.
  • 18.