Skip to content
Related Articles

Related Articles

What is RPC Mechanism in Distributed System?

Improve Article
Save Article
  • Last Updated : 19 Mar, 2022
Improve Article
Save Article

Remote Procedure Call (RPC) is a communication technology that is used by one program to make a request to another program for utilizing its service on a network without even knowing the network’s details. A function call or a subroutine call are other terms for a procedure call.

It is based on the client-server concept. The client is the program that makes the request, and the server is the program that gives the service. An RPC, like a local procedure call, is based on the synchronous operation that requires the requesting application to be stopped until the remote process returns its results. Multiple RPCs can be executed concurrently by utilizing lightweight processes or threads that share the same address space. Remote Procedure Call program as often as possible utilizes the Interface Definition Language (IDL), a determination language for describing a computer program component’s Application Programming Interface (API). In this circumstance, IDL acts as an interface between machines at either end of the connection, which may be running different operating systems and programming languages.

Working Procedure for RPC Model:

  • The process arguments are placed in a precise location by the caller when the procedure needs to be called.
  • Control at that point passed to the body of the method, which is having a series of instructions.
  • The procedure body is run in a recently created execution environment that has duplicates of the calling instruction’s arguments.
  • At the end, after the completion of the operation, the calling point gets back the control, which returns a result.
    • The call to a procedure is possible only for those procedures that are not within the caller’s address space because both processes (caller and callee) have distinct address space and the access is restricted to the caller’s environment’s data and variables from the remote procedure.
    • The caller and callee processes in the RPC communicate to exchange information via the message-passing scheme.
    • The first task from the server-side is to extract the procedure’s parameters when a request message arrives, then the result, send a reply message, and finally wait for the next call message.
    • Only one process is enabled at a certain point in time.
    • The caller is not always required to be blocked.
    • The asynchronous mechanism could be employed in the RPC that permits the client to work even if the server has not responded yet.
    • In order to handle incoming requests, the server might create a thread that frees the server for handling consequent requests.

Working Procedure for RPC Model

Types of RPC:

Callback RPC: In a Callback RPC, a P2P (Peer-to-Peer)paradigm opts between participating processes. In this way, a process provides both client and server functions which are quite helpful. Callback RPC’s features include:

  • The problems encountered with interactive applications that are handled remotely
  • It provides a server for clients to use.
  • Due to the callback mechanism, the client process is delayed.
  • Deadlocks need to be managed in callbacks.
  • It promotes a Peer-to-Peer (P2P) paradigm among the processes involved.

RPC for Broadcast: A client’s request that is broadcast all through the network and handled by all servers that possess the method for handling that request is known as a broadcast RPC. Broadcast RPC’s features include:

  • You have an option of selecting whether or not the client’s request message ought to be broadcast.
  • It also gives you the option of declaring broadcast ports.
  • It helps in diminishing physical network load.

Batch-mode RPC: Batch-mode RPC enables the client to line and separate RPC inquiries in a transmission buffer before sending them to the server in a single batch over the network. Batch-mode RPC’s features include:

  • It diminishes the overhead of requesting the server by sending them all at once using the network.
  • It is used for applications that require low call rates.
  • It necessitates the use of a reliable transmission protocol.

 Local Procedure Call Vs Remote Procedure Call:

  • Remote Procedure Calls have disjoint address space i.e. different address space, unlike Local Procedure Calls.
  • Remote Procedure Calls are more prone to failures due to possible processor failure or communication issues of a network than Local Procedure Calls.
  • Because of the communication network, remote procedure calls take longer than local procedure calls.

Advantages of Remote Procedure Calls:

  • The technique of using procedure calls in RPC permits high-level languages to provide communication between clients and servers.
  • This method is like a local procedure call but with the difference that the called procedure is executed on another process and a different computer.
  • The thread-oriented model is also supported by RPC in addition to the process model.
  • The RPC mechanism is employed to conceal the core message passing method.
  • The amount of time and effort required to rewrite and develop the code is minimal.
  • The distributed and local environments can both benefit from remote procedure calls.
  • To increase performance, it omits several of the protocol layers.
  • Abstraction is provided via RPC.  To exemplify, the user is not known about the nature of message-passing in network communication.
  • RPC empowers the utilization of applications in a distributed environment.

Disadvantages of Remote Procedure Calls:

  • In Remote Procedure Calls parameters are only passed by values as pointer values are not allowed.
  • It involves a communication system with another machine and another process, so this mechanism is extremely prone to failure.
  • The RPC concept can be implemented in a variety of ways, hence there is no standard.
  • Due to the interaction-based nature, there is no flexibility for hardware architecture in RPC.
  • Due to a remote procedure call, the process’s cost has increased.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!