Explain Marshalling/Unmarshaling mechanism in RPC/RMI.
1 Answer
  • Implementing RPC involves the transfer of arguments and results between client-server processes.
  • These arguments and results are language-level data structures which are transferred in the form of message data.
  • Transfer of message data between two computers requires encoding of the message data, which is known as marshalling.
  • Marshalling involves the following actions:

i. First the argument of client process or the result of a server process is taken which will form the message data to be sent to remote process.

ii. Encode the message data of step 1 on the sender’s computer. This encoding process will involve the conversion of program objects into a stream form that is suitable for transmission.

  • The decoding of the message data is known as unmarshalling which reverses the steps of marshalling.

i. Decode the message on receiver’s computer. This process involves the reconstruction of program objects from the message data that was received in stream form.

  • The order and the representation method used to marshal arguments and results must be known to the client and server of the RPC, which provides a degree of type safety.
  • Due to this the server does not accept a call from the client until the client uses the same interface definition as the server.
  • The marshalling process must reflect the structure of all types of program objects used in the concerned language which include primitive types, structured types and defined types.
  • Marshalling procedures are classified as follows:
    • Provided as part of the RPC software: This includes marshalling procedures for scalar data types along with procedures to marshal compound types built from scalar types.
    • Defined by the users of the RPC system: This group includes marshalling procedures for user-defined and pointer data types.
Please log in to add an answer.