0% found this document useful (0 votes)
13 views20 pages

DC Lec 6

The document discusses the implementation of Remote Procedure Calls (RPC) in distributed computing, detailing the types of messages involved, including call and reply messages. It explains the components of these messages, the conditions under which servers respond to call messages, and the process of marshalling parameters for communication between client and server. Additionally, it covers parameter passing methods and the importance of server registration for client-server interaction.

Uploaded by

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

DC Lec 6

The document discusses the implementation of Remote Procedure Calls (RPC) in distributed computing, detailing the types of messages involved, including call and reply messages. It explains the components of these messages, the conditions under which servers respond to call messages, and the process of marshalling parameters for communication between client and server. Additionally, it covers parameter passing methods and the importance of server registration for client-server interaction.

Uploaded by

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

Distributed Computing

-Dr. Nabanita Mandal


Types of messages involved in
implementation of RPC

1. Call Messages: sent by client to server


requesting execution of a remote procedure.
RPC
Messages 2. Reply Messages: sent by server to client for
returning result of remote procedure execution
1. Call Messages:
 Components of a call message :
 Identification information of the remote
procedure to be executed i.e. Remote
procedure identifier.
 Arguments necessary for execution of the
procedure

RPC  Additional Fields:


 Message identification field : It has a
Messages sequence no. for identifying lost messages
and duplicate messages.
 Client identification field : It allows the
server to identify the client
 Message Type field : It is used to
distinguish call message from reply message
 0→call message
 1 → reply message
1. Call Messages:
 RPC call message format

RPC
Messages
2. Reply Messages
When the server of an RPC receives a call
message, it could be faced with the following
conditions:

i. Call message violates RPC protocol


 Action: Server rejects such a call
RPC
Messages ii. Server detects by scanning client’s id. Finds
that it is not authorized to use the service
 Action: Server returns an unsuccessful reply.

iii. Remote procedure specified in the remote


procedure id. Field of the call message is not
available with it
 Action: Server returns an unsuccessful reply.
2. Reply Messages
When the server of an RPC receives a call message, it
could be faced with the following conditions:

iv. Incompatible RPC interface being used by the client


and server.
RPC  Action: Server returns an unsuccessful reply.
Messages v. An exception condition (Division by zero) occurs
during execution of remote procedure
 Action: Server returns an unsuccessful reply.
vi. The specified procedure is executed successful
 Action: Successful reply.
Fields in Reply Messages
 Message Identifier Field : same as call message.
 Message Type :Indicates it is a reply message.
RPC  Reply status : 0 →Successful reply
Messages 1 / non-zero value →
Unsuccessful reply
 Result : Result of procedure execution.
 Reason : Reason for failure
Fields in Reply Messages

RPC
Messages
Passing
Value in
RPC
A server stub may handle more than one remote
procedure
Issues with Parameter Passing:
1. Marshalling
2. Reference Parameters
Marshalling Arguments and Results
 Implementation of RPC involves :
 Transfer of arguments from the client
process to the server process and,
 Transfer of results from server process to
client process.
1.
 These arguments and results are transferred in
Marshalling form of message data between two computers.

 In RPC, packing parameters into a


message is known as marshalling
Steps:-
1. Taking arguments (of client) or result (of
server) that will form message data to be sent
to remote process.
2. Encoding the message data.
3. Decoding the message data.

1.
Marshalling Procedure:-
For successful marshalling, the client &
server ,both should know the methods used.
 It is provided as a part of RPC software: That
is the Best way
 User-defined methods
Parameter Marshalling:
 There is more than just wrapping parameters
into a message.
 Client and server machines may have different
data representations (example: byte ordering).
 Wrapping a parameter means transforming a
value into sequence of bytes.
1.  Client and server have to agree on the same
encoding:
Marshalling  How are basic data values represented
(integers,floats, characters)
 How are complex data values represented
(arrays,unions)
 Client and server need to properly interpret
messages, transforming them into machine-
dependent representations
Example:
 An integer (one 32-bit word), and a four-character
string (one 32-bit word)
 Consider integer 5 and string JILL
 The little numbers in boxes indicate the address of
each byte

Passing
Value
Parameters

a)Original message on the Pentium (little-endian)


b) The message after receipt on the SPARC (big-
endian)
Example:
 An integer (one 32-bit word), and a four-character
string (one 32-bit word)
 Consider integer 5 and string JILL
 The little numbers in boxes indicate the address of each
byte

Passing
Value
Parameters

a) Original message on the Pentium (little-endian)


b) The message after receipt on the SPARC (big-endian)
c)The message after being inverted (integer 5, string:
LLIJ)
 Pointer refers to the address space of the
process it is being used
 Solutions:–
 Forbid pointers and reference parameters in
general
 Use copy in/copy out semantics: while
procedure is executed, nothing can be
assumed about parameter values (only Ada
2. supports this model).
Reference
Parameters  RPC assumes all data that is to be operated on
is passed by parameters. Excludes passing
references to (global) data.
 One optimization, if the stubs know which are
parameters are input and output parameters->
eliminate copying
Parameter passing in RPC:

2. 1. Call by value
Reference
Parameters 2.Call by reference

3. Call by copy- restore


1. Call by value
 All parameters are copied into a message that is
transmitted from the client to the server through
the network.
 It is time consuming for passing large data types
such as trees and arrays etc.
Parameter
passing in 2.Call by reference
RPC  A pointer is meaningful only within the address
space of the process in which it is being used.
 If an address 1000 on the client is passed to the
server as a parameter, then address 1000 can
point to some other value on the server machine.
3. Call by copy- restore

 Copy the array into the message and send it to the


server.
 The server stub can then call the server with a
Parameter pointer to this array, even though this pointer has a
different numerical value than the sender.
passing in
 Changes the server makes using the pointer (e.g.,
RPC storing data into it) directly affect the message
buffer inside the server stub. When the server
finishes, the original message can be sent back to
the client stub, which then copies it back to the
client. In effect, call-by-reference has been
replaced by copy/restore.
 To allow a client to call a server, it is necessary that the
server be registered and prepared to accept incoming calls.

 Registration of a server makes it possible for a client to


locate the server and bind to it. Server location is done in
two steps:
1. Locate the server's machine.
2. Locate the server (i.e., the correct
Parameter process) on that machine.
passing in
RPC
Need to agree on:
 Encoding rules (message format, representation
Parameter of simple data structures)
Specificatio  Actual exchange of messages (e.g., TCP/IP)
n and Stub  Implement the stubs
Generation  Stubs for the same protocol and different
procedures differ only in their interfaces to the
applications
 Interface Definition Language (IDL)

You might also like