What is Remote Procedure Call?

Remote Procedure call (RPC) is the type of call which is used to access the programs from the network services.

When a computer program is to access or need to be executed from another service network instead of sending and receiving from that network the call has been taken up by the server itself to take that call and access that program in that network service only, without the help of any programmer from any remote location. This all helps in making the local procedure call to be taken up by the server from any remote location.

When the remote call is to be called the calling environment is suspended. All the procedures are to be transferred to another network where the call must be executed.

When the call is executed in another network environment then the call is returned to the calling environment with all the procedures, where the execution resumes its regular procedure call.

The main use or goal of RPC is to hide the existence of the network. The procedure which is taking up the call will hide all the information of the user. It omits all the protocols to improve its performance.

This RPC is best suited for the client-server interaction. The client-server cannot execute the programs at the same time.

Steps during RPC

The following steps are to be taken up during the RPC −

  • The client invokes a "client stub" which resides in the client’s own address space.

  • This stub converts the message into the standard format according to the client's network services.

  • Then it transfers the message to the remote network service.

  • On the other side, the server invokes the "server stub" which decodes the transferred message according to its standard format and takes up the regular procedure call.

  • Once the call is executed according to its procedure the call is returned to the server stub and it transfers the message to the transport layer.

  • Then the transport layer sends back the message to the client server stub.

  • Then the client server stubs decode the message into its standard form and the call gets completed.

Remote Procedure call (RPC) is diagrammatically represented as follows −

Pseudo code/ steps

The pseudo code / steps for the RPC are as follows −

  • Client calls the client stub.

  • Stub generates a system call to forward the message and adds parameters to the message.

  • Message forwarding from client to server via client OS.

  • Message further passes to server stub with the help of OS.

  • Message parameters are removed.

  • Server stub calls the server procedure.

Updated on: 13-Sep-2021

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started