Lecture - Introduction To RPC
Lecture - Introduction To RPC
• Remote Procedure Call is a software communication protocol that one program can use to
request a service from a program located in another computer on a network without having
to understand the network's details.
• RPC is used to call other processes on the remote systems like a local system.
• A procedure call is also sometimes known as a function call or a subroutine call.
• RPC uses the client-server model. The requesting program is a client, and the service-
providing program is the server.
• An RPC is analogous to a function call. Like a function call, when an RPC is made, the
calling arguments are passed to the remote procedure and the caller waits for a response to
be returned from the remote procedure.
Remote Procedure Call(RPC)
Remote Procedure Architecture
Remote Procedure Architecture
• Client: A process, such as a program or task, that requests a service provided by another program.
• Server: A process, such as a program or task, that responds to requests from a client.
• Client Stub: Module within a client application containing all of the functions necessary for the client to make
remote procedure calls using the model of a traditional function call in a standalone application. Stubs are
compiled and linked with the client application during development. Stubs are placeholder functions that make
the calls to the run-time library functions. Instead of containing code that implements the remote procedure, the
client stub code retrieves the required parameters from the client address space and delivers them to the client
runtime library.
• Runtime library : Manages the remote procedure call. Runtime library then translates the parameters as needed
into a standard Network Data Representation (NDR) format for transmission to the server.
• Server Stub: Module within a server application or service that contains all of the functions.
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.
Following steps take place during the RPC process:
1) The client, the client stub, and one instance of RPC run time execute on the client machine.
2) A client starts a client stub process by passing parameters in the usual way. The client stub stores within the
client’s own address space. It also asks the local RPC Runtime to send back to the server stub.
3) RPC Runtime manages the transmission of messages between the network across client and server. It also
performs the job of retransmission, acknowledgment, routing, and encryption.
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.
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.
6) In this stage, the client stub demarshalls (unpack) the return parameters, in the resulting packet, and the
execution process returns to the caller.
Characteristics of RPC
• 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.
Features of RPC
•Simple call syntax
•Offers known semantics
•Provide a well-defined interface
•It can communicate between processes on the same or different machines.
Advantages of RPC
• RPC method helps clients to communicate with servers by the conventional use of procedure
calls in high-level languages.
• RPC method is modeled on the local procedure call, but the called procedure is most likely
to be executed in a different process and usually a different computer.
• RPC supports process and thread-oriented models.
• RPC makes the internal message passing mechanism hidden from the user.
• The effort needs to re-write and re-develop the code is minimum.
• Remote procedure calls can be used for the purpose of distributed and the local environment.
• It commits many of the protocol layers to improve performance.
• RPC provides abstraction. For example, the message-passing nature of network
communication remains hidden from the user.
• RPC allows the usage of the applications in a distributed environment that is not only in the
local environment.
• With RPC code, re-writing and re-developing effort is minimized.
• Process-oriented and thread-oriented models support by RPC.
Disadvantages of RPC
• Remote Procedure Call Passes Parameters by values only and pointer values, which is not
allowed.
• Remote procedure calling (and return) time (i.e., overheads) can be significantly lower than
that for a local procedure.
• This mechanism is highly vulnerable to failure as it involves a communication system,
another machine, and another process.
• RPC concept can be implemented in different ways, which is can’t standard.
• Not offers any flexibility in RPC for hardware architecture as It is mostly interaction-based.
• The cost of the process is increased because of a remote procedure call.
Types of RPC
i. Callback RPC
ii. Broadcast RPC
iii. Batch-mode RPC
11
Types of RPC
i. Callback RPC- This type of RPC enables a Peer 2 Peer paradigm between participating processes.
It helps a process to be both a client and a server. Server may make several call backs to client
before returning result of initial call to client.
ii. An example is remote debugging, where the client is a window system program, and the server is a
debugger running on the remote machine.
Functions of Callback RPC:
Remotely processed interactive application problems
Offers server with clients handle
Callback makes the client process wait
Manage callback deadlocks
It facilitates a peer-to-Peer paradigm among participating processes.
12
Types of RPC
ii. Broadcast RPC- Broadcast RPC is a client's request, that is broadcast on the network,
processed by all servers which have the method for processing that request.
Functions of Broadcast RPC:
Broadcast RPC expects one or more answers from each responding machine.
Treats unsuccessful responses as garbage by filtering them out.
All broadcast msgs are sent to port mapping port.
Uses connectionless protocol like UDP.
It helps to reduce the load on the physical network
13
Batch-mode RPC
iii. Batch-mode RPC helps to queue, separate RPC requests, in a transmission buffer,
on the client-side, and then send them on a network in one batch to the server.
3. PDF Link.
URL :
http://zai.lecturer.pens.ac.id/Kuliah/Komunikasi%20Data/Buku%20Referensi/Data%20
Communications%20and%20Networking%20By%20Behrouz%20A.Forouzan.pdf
.