0% found this document useful (0 votes)
12 views5 pages

Remote Procedure Call

Remote Procedure Call (RPC) is an interprocess communication method used in client-server applications, allowing clients to execute procedures on remote servers. It involves a sequence of steps where the client sends a request to the server, which processes it and returns a response, while the client remains blocked until the server completes the call. RPC has advantages such as minimal code rewriting and support for distributed environments, but it also has disadvantages like lack of standardization and increased costs.

Uploaded by

yashi.bajpai18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

Remote Procedure Call

Remote Procedure Call (RPC) is an interprocess communication method used in client-server applications, allowing clients to execute procedures on remote servers. It involves a sequence of steps where the client sends a request to the server, which processes it and returns a response, while the client remains blocked until the server completes the call. RPC has advantages such as minimal code rewriting and support for distributed environments, but it also has disadvantages like lack of standardization and increased costs.

Uploaded by

yashi.bajpai18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Remote Procedure Call (RPC)

A remote procedure call is an interprocess communication technique that is used for client-
server-based applications. It is also known as a subroutine call or a function call.
A client has a request message that the RPC translates and sends to the server. This request may
be a procedure or a function call to a remote server. When the server receives the request, it
sends the required response back to the client. The client is blocked while the server is
processing the call and only resumed execution after the server is finished.
The sequence of events in a remote procedure call are given as follows −

 The client stub is called by the client.


 The client stub makes a system call to send the message to the server and puts the parameters
in the message.
 The message is sent from the client to the server by the client’s operating system.
 The message is passed to the server stub by the server operating system.
 The parameters are removed from the message by the server stub.
 Then, the server procedure is called by the server stub.
A diagram that demonstrates this is as follows −

Advantages of Remote Procedure Call


Some of the advantages of RPC are as follows −
 Remote procedure calls support process oriented and thread oriented models.
 The internal message passing mechanism of RPC is hidden from the user.
 The effort to re-write and re-develop the code is minimum in remote procedure calls.
 Remote procedure calls can be used in distributed environment as well as the local
environment.
 Many of the protocol layers are omitted by RPC to improve performance.
Disadvantages of Remote Procedure Call
Some of the disadvantages of RPC are as follows −

 The remote procedure call is a concept that can be implemented in different ways. It is not a
standard.
 There is no flexibility in RPC for hardware architecture. It is only interaction based.
 There is an increase in costs because of remote procedure call.

How RPC works?


When a remote procedure call is invoked, the calling environment is suspended, the procedure
parameters are transferred across the network to the environment where the procedure is to
execute, and the procedure is then executed in that environment.

When the procedure finishes, the results are transferred back to the calling environment, where
execution resumes as if returning from a regular procedure call.
A remote procedure call (RPC) works in the following steps in an operating system:

Step 1: The client, client stub, and RPC run time execute on the client machine.

Step 2: A client starts a client stub process by passing parameters in the usual way. The packing
of the procedure parameters is called marshalling. The client stub stores within the client's own
address space, and it also asks the local RPC Runtime to send back to the server stub.

Step 3: In this stage, the user can access RPC by making regular Local Procedural Call. RPC
Runtime manages the transmission of messages between the network across client and server,
and it also performs the job of retransmission, acknowledgment, routing, and encryption.

Step 4: After completing the server procedure, it returns to the server stub, which packs
(marshalls) the return values into a message. The server stub then sends a message back to the
transport layer.

Step 5: In this step, the transport layer sends back the result message to the client transport layer,
which returns back a message to the client stub.
Step 6: In this stage, the client stub demarshalls (unpack) the return parameters in the resulting
packet, and the execution process returns to the caller.

Issues of Remote Procedure Call (RPC)


In an operating system, Remote procedure call or RPC faced some issues that must be
addressed, such as:

1. RPC Runtime

The RPC runtime system is a library of routines and services that handle the network
communications that underlie the RPC mechanism. In the course of an RPC call, client-side and
server-side runtime systems code handle binding, establish communications over an appropriate
protocol, pass call data between the client and server, and handle communications errors.

2. Stub

The function of the stub is to provide transparency to the programmer-written application code.

 On the client-side: The stub handles the interface between the client's local procedure call
and the runtime system, marshaling and unmarshaling data, invoking the RPC runtime
protocol, and if requested, carrying out some of the binding steps.
 On the server-side: The stub provides a similar interface between the runtime system and
the local manager procedures executed by the server.

3. Binding

How does the client know who to call and where the service resides?
The most flexible solution is to use dynamic binding and find the server at run time when the
RPC is first made. The first time the client stub is invoked, it contacts a name server to determine
the transport address at which the server resides. The binding consists of two parts:

 Naming: A Serverhaving a service to offer exports an interface for it. Exporting an interface
registers it with the system so that clients can use it.
 Locating: A Clientmust import an (exported) interface before communication can begin.

4. The calling semantics associated with RPC

It is mainly classified into the following choices,

 Retry request message: Whether to retry sending a request message when a server has
failed, or the receiver didn't receive the message.
 Duplicate filtering: Remove the duplicate server requests.
 Retransmission of results: To resend lost messages without re-executing the operations at
the server-side.

Characteristics of RPC
Here are the essential characteristics of remote procedure call:

 The called procedure is in another process, which is likely to reside in 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 doesn't offer access to the calling procedure's environment.

You might also like