Remote Procedure Call

What is Remote Procedure Call?

In short, Remote Procedure Call (RPC) means allowing a program (caller) to call procedures located on other machines (callee). Caller sends an identifier of the procedure and parameters to the callee. The callee executes the procedure and sends the return value (if any) to the caller.

RPC acts as a middleware in between the OS and the application across many machines on a network.

Goal

The goal of RPC is transparency: the calling procedure should not be aware that the called procedure is executing on a different machine or vice versa. In other word, we want a remote procedure call to look like a local procedure call as much as possible.

How RPC Works

The client has a client stub and the server has a server stub. A remote procedure call is summarized as the following:

  1. The client procedure calls the client stub in the normal way.

  2. The client stub builds a message and calls the local operating system.

  3. The client's OS sends the message to the remote OS.

  4. The remote OS gives the message to the server stub.

  5. The server stub unpacks the parameter(s) and calls the server.

  6. The server does the work and returns the result to the stub.

  7. The server stub packs the result in a message and calls its local OS.

  8. The server's OS sends the message to the client's OS.

  9. The client's OS gives the message to the client stub.

  10. The stub unpacks the result and returns it to the client.

Variations on RPC

  1. Asynchronous RPC

    • The server immediately sends a reply back to the client the moment the RPC request is received, after which it locally calls the requested procedure.

    • The client will continue without further blocking as soon as it has received the server's acknowledgment.

  2. Multicast RPC

    • The client sends an RPC request to a group of servers

Last updated