Remote Procedure Call (RPC) Protocol in Distributed System
โก Smart Summary
Remote Procedure Call (RPC) is an interprocess communication protocol that lets a program execute a procedure in another address space or machine, hiding network details behind an ordinary local function call in distributed client-server systems.

What is RPC?
Remote Procedure Call (RPC) is an interprocess communication technique used for client-server applications. The full form of RPC is Remote Procedure Call. RPC mechanisms are used when a computer program causes a procedure or subroutine to execute in a different address space, coded as a normal procedure call without the programmer explicitly coding the details for the remote interaction.
This procedure call also manages low-level transport protocols, such as UDP and TCP/IP, to carry the message data between programs.
Types of RPC
Three types of RPC are:
- Callback RPC
- Broadcast RPC
- Batch-mode RPC
Callback RPC
This type of RPC enables a peer-to-peer (P2P) paradigm between participating processes. It helps a process to act as both a client and a server.
Functions of Callback RPC:
- Handles remotely processed, interactive application problems.
- Provides the server with the client’s handle.
- Callback makes the client process wait.
- Manages callback deadlocks.
- It facilitates a peer-to-peer paradigm among participating processes.
Broadcast RPC
Broadcast RPC is a client’s request that is broadcast on the network and processed by all servers that have the method for processing that request.
Functions of Broadcast RPC:
- Allows you to specify that the client’s request message has to be broadcast.
- You can declare broadcast ports.
- It helps to reduce the load on the physical network.
Batch-mode RPC
Batch-mode RPC helps to queue separate RPC requests in a transmission buffer on the client side, and then send them over a network in one batch to the server.
Functions of Batch-mode RPC:
- It minimizes the overhead involved in sending a request, as it sends requests over the network in one batch to the server.
- This type of RPC protocol is only efficient for applications that need lower call rates.
- It needs a reliable transmission protocol.
RPC Architecture
RPC architecture has mainly five components of the program:
- Client
- Client Stub
- RPC Runtime
- Server Stub
- Server
RPC Architecture
How RPC Works?
The following steps take place during the RPC process:
Step 1) The client, the client stub, and one instance of the RPC runtime execute on the client machine.
Step 2) The client starts a client stub process by passing parameters in the usual way. The client stub is stored within the client’s own address space. It also asks the local RPC Runtime to send the request to the server stub.
Step 3) In this stage, the user accesses RPC by making a regular local procedure call. The RPC Runtime manages the transmission of messages between the client and server across the network. It also performs the job of retransmission, acknowledgment, routing, and encryption.
Step 4) After completing the server procedure, execution returns to the server stub, which packs (marshals) the return values into a message. The server stub then sends the message back to the transport layer.
Step 5) In this step, the transport layer sends the result message back to the client transport layer, which returns the message to the client stub.
Step 6) In this stage, the client stub demarshals (unpacks) the return parameters in the resulting packet, and execution returns to the caller.
Characteristics of RPC
Here are the essential characteristics of RPC:
- The called procedure is in another process, which is likely to reside on another machine.
- The processes do not share address space.
- Parameters are passed only by values.
- RPC executes within the environment of the server process.
- It does not offer access to the calling procedure’s environment.
Features of RPC
Here are the important features of RPC:
- Simple call syntax.
- Offers known semantics.
- Provides a well-defined interface.
- It can communicate between processes on the same or different machines.
Advantages of RPC
Here are the pros/benefits of RPC:
- RPC helps clients communicate with servers through the conventional use of procedure calls in high-level languages.
- RPC is modeled on the local procedure call, but the called procedure is most likely executed in a different process and usually on a different computer.
- RPC supports process-oriented and thread-oriented models.
- RPC makes the internal message-passing mechanism hidden from the user.
- It commits many of the protocol layers to improve performance.
- RPC provides abstraction; for example, the message-passing nature of network communication remains hidden from the user.
- RPC can be used in both distributed and local environments.
- The effort needed to re-write and re-develop the code is minimal.
Disadvantages of RPC
Here are the cons/drawbacks of using RPC:
- Remote Procedure Call passes parameters by values only; pointer (reference) values are not allowed.
- Remote procedure call (and return) time โ the overhead โ is significantly higher than for a local procedure.
- This mechanism is highly vulnerable to failure, as it involves a communication system, another machine, and another process.
- The RPC concept can be implemented in different ways, so there is no single standard.
- It does not offer flexibility for hardware architecture, as it is mostly interaction-based.
- The cost of the process increases because of the remote procedure call.

