Remote Procedure Call – RPC Introduction

Placement-ready Courses: Enroll Now, Thank us Later!

Remote Procedure Call is an interprocess communication technique used to construct distributed and client-server. It is used when a process causes a subroutine (coded as a normal procedure call) to execute in a different address space. The procedure call manages low-level transport protocols.

During a Remote Procedure Call(RPC):

1. The OS suspends and transfers the calling environment and procedure parameters respectively, across the network and to the environment where the procedure executes.

2. The OS transfers back the result produced by a procedure to the calling environment. Execution also resumes just like a regular procedure call.

Remote Procedure Call Model

A client-server interaction suits an RPC more as the flow of control switches between the caller and callee. Instead of the client and server executing at the same time the thread of execution jumps between caller and callee.

Types of Remote Procedure Call

There are three types of RPC:

1. Callback RPC: This type enables a process to process paradigm between processes and helps a process be both a client and server service.

Functions of Callback RPC

  • Processes interactive application problems remotely.
  • Server with clients handle
  • Callbacks make client process wait
  • Manages callback deadlocks
  • Facilitates peer-to-peer paradigm amongst the participating processes.

2. Broadcast RPC: This type broadcasts a client’s request on the network that is then processed by all the servers that can process the request.

Functions of Broadcast RPC:

  • Allows specifying whether a client’s request message should be broadcast or not.
  • Declares broadcast ports.
  • Helps reduce the load on the physical network.

3. Batch-mode RPC: This type helps queue and separate RPC requests in a transmission buffer on the side of the client. It then sends these requests on a network to the server in a batch.

Functions of batch mode RPC:

  • Minimizes the overhead in sending a request.
  • Only efficient for applications with lower call rates.
  • Needs a reliable transmission protocol.

Components of Remote Procedure Call

The five components of an RPC structure are:
1. Client
2. Client Stub
3. RPC Runtime
4. Server Stub
5. Server

Working of RPC

The following steps take place during a Remote Procedure Call:

1. The client, client stub, and an instance of RPC runtime execute on the client machine.

2. A client passes parameters and starts a client stub process that is stored within the client’s address space. It asks the local RPC Runtime to send it back to the server stub.

3. The parameters are packed into a message by the client stub. It converts the representation of the parameters into a standard format and copies each parameter into the message.

4. The transport layer sends a message to the remote server machine after the client stub passes the message to it.

5. After the transport layer passes the message to a server stub, it unpacks the parameters and calls the desired server routine with the help of a regular procedure call mechanism.

6. After the completion of server procedures, it returns the server stub that packs the return values into a message and hands the message to the transport layer.

7. The transport layer then sends the result message to the client transport layer, from where the message goes back to the client stub.

8. The client stub unpacks the return parameters returning the execution to the caller.

Working of RPC

Issues in RPC

Following are the issues in RPC:

1. RPC Runtime: This is a library of routines and services that handles network communications. The client-side and server-side run-time systems’ code handle binding during an RPC call. Apart from this, they establish communication over an appropriate protocol, handle communications errors, and pass call data between the client and server.

2. Stub: A stub provides transparency to the programmer-written application code and handles the interface between the client’s local procedure call and run-time system. It packs and unpacks data, invokes RPC run-time protocol, and carries out some of the binding steps when necessary.

It provides an interface between the run-time system and the local manager procedures executed by the server. This takes place on the server-side.

3. Binding: Dynamic binding helps find the server at run time during the first formation of an RPC. It also contacts a server and determines the transport address where the server resides, when the client stub is first invoked.

Binding consists of two parts, naming and locating. A Server with a service to offer exports an interface for the service. This registers the server with the system so that clients can use it. A Client exports an interface before communication can begin.

4. Call semantics associated with RPC: Following choices are present in call semantics:

  • Retry request message: Retry sending a request message after a server failure or if the receiver did not receive a message.
  • Duplicate filtering: Removes duplicate server requests.
  • Retransmission of results: Resends lost messages without re-executing the operations at the server-side.

Characteristics of RPC

Following are the essential characteristics of Remote Procedure Call:

  • The called procedure is in another process and resides in another machine.
  • Processes do not share address space.
  • Parameters passed by value only.
  • It only executes within the server process environment.
  • No access to the calling procedure’s environment.

Features of RPC

Following are some important features of Remote Procedure Call

  • Simple call syntax
  • Provides known semantics
  • Provides a well-defined interface
  • Communicates between processes on same and different machines

Advantages of Remote Procedure Call

Following are the advantages of RPC:

  • It provides abstraction so that the message-passing nature is hidden from the user.
  • This omits protocol layers to improve performance.
  • It also enables application usage in the distributed environment.
  • Helps clients communicate with servers using procedure calls in HLL.
  • Supports process and thread-oriented models.
  • Minimum effort required to re-write and re-develop the code.

Disadvantages of Remote Procedure Call

Following are the disadvantages of RPC:

  • It passes parameters by values only and pointer values are not allowed.
  • Lower remote procedure calling and return time as compared to local procedure.
  • Highly vulnerable to failures due to communication systems.
  • One can implement this concept in various ways and is not standard.
  • No flexibility for hardware architecture.
  • Costly.

Summary

An RPC is an interprocess communication technique. There are three types of RPCs namely, callback RPC, broadcast RPC, and batch-mode RPC. There are five components in the RPC architecture. These are client, client stub, RPC runtime, server stub, and server.

Did we exceed your expectations?
If Yes, share your valuable feedback on Google

courses

DataFlair Team

DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today’s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.

Leave a Reply

Your email address will not be published. Required fields are marked *