RPC Implementation Mechanism in Distributed System

  • RPC is an effective mechanism for building client-server systems that are distributed.
  • RPC enhances the power and ease of programming of the client/server computing concept. It's a protocol that allows one software to seek a service from another program on another computer in a network without having to know about the network. The software making the request is called a client, and the program providing the service is called a server.
  • The calling parameters are sent to the remote process during a Remote Procedure Call, and the caller waits for a response from the remote procedure. Pasted image 20240401145850

Semantic Transparency

  • This implies that there should be a similarity between the remote process and a local procedure.
  • This implies that there should be similarity in the semantics i.e. meaning of a remote process and a local procedure.

Working of RPC

  • There are 5 elements used in the working of RPC:
    • Client
    • Client Stub
    • RPC Runtime
    • Server Stub
    • Server
Pasted image 20240401150223
  • Client: The client process initiates RPC. The client makes a standard call, which triggers a correlated procedure in the client stub.
  • Client Stub: Stubs are used by RPC to achieve semantic transparency. The client calls the stub. Client stub does these tasks:
    1. It receives a request from a client, packs(marshals) the parameters an required specifications for remote/target procedure in messages.
    2. Upon receiving the result values after execution, it unpacks (unmarshaled) those results and sends them to the Client.
  • RPC Runtime: The RPC runtime is in charge of message transmission between client and server via network. Retransmission, acknowledgement, routing, and encryption are all tasks performed by it. On the client-side, it receives the result values in a message from the server-side, and then it further sends it to the client stub whereas, on the server-side, RPC Runtime got the same message from the server stub when then it forwards to the client machine. It also accepts and forwards client machine call request messages to the server stub.
  • Server Stub: It does these tasks:
    1. Unpacks(unmarshaled) the call request message which is received from the local RPC Runtime and makes a regular call to invoke the required procedure in the server.
    2. When it receives the server's procedure execution result, it packs it into a message and asks the local RPC Runtime to transmit it to the client sub where it is unpacks.
  • Server: After receiving a call request from the client machine, the server stub passes it to the server. The execution of the required procedure is made by the server and finally, it return result to the server stub so that is can be passed to the client machine using the local RPC Runtime.

RPC Process

  • The client, the client stub, and one instance of RPC Runtime are all running on the client machine.
  • A client initiates a client stub process by giving parameters as normal. The client stub acquires storage in the address space of the client.
  • User can access RPC by using a normal Local Procedure Call. The RPC Runtime is in charge of message transmission between client and server via the network. Retransmission, acknowledgement, routing, and encyption are all tasks performed by it.
  • On the server-side, values are returned to the server stub, after the completion of server operation (packing/marshaling the return values into a message). The transport layer receives a message from the server stub.
  • The resulting message is transmitted by the transport layer to the client transport layer, which then sends a message back to the client stub.
  • The client stub unpacks/unmarshalling the return arguments in the resulting packet, and the execution process rerturns to the caller at this point.
Pasted image 20240401160214 Pasted image 20240401160226
Built with LogoFlowershow