Site icon DataFlair

Remote Procedure Call – RPC Introduction

Remote Procedure Call

FREE Online Courses: Dive into Knowledge for Free. Learn More!

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.

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

Technology is evolving rapidly!
Stay updated with DataFlair on WhatsApp!!

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:

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:

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.

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:

Characteristics of RPC

Following are the essential characteristics of Remote Procedure Call:

Features of RPC

Following are some important features of Remote Procedure Call

Advantages of Remote Procedure Call

Following are the advantages of RPC:

Disadvantages of Remote Procedure Call

Following are the disadvantages of RPC:

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.

Exit mobile version