2. INTRODUCTION
● Remote Procedure Call (RPC) is a high-level model for
client-server communication.
● 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.
3. INTRODUCTION
● 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.
● Examples: File service, Authentication service.
4. INTRODUCTION
❖ Why we need Remote Procedure Call (RPC)?
● The client needs a easy way to call the procedures of
the server to get some services.
● RPC enables clients to communicate with servers by
calling procedures in a similar way to the
conventional use of procedure calls in high-level
languages.
● RPC is modeled on the local procedure call, but the
called procedure is executed in a different process
and usually a different computer.
5. INTRODUCTION
❖ How to operate RPC?
● When a process on machine A calls a procedure on
machine B, the calling process on A is suspended,
and the execution of the called procedure takes place
on B.
● Information can be transported from the caller to the
callee in the parameters and can come back in the
procedure result.
● No message passing or I/O at all is visible to the
programmer.
6. TYPES OF RPC
❖ Three types of RPC are:
➔ Callback RPC
➔ Broadcast RPC
➔ Batch-mode RPC
7. CALLBACK RPC
➔ This type of RPC enables a P2P paradigm
between participating processes. It helps a
process to be both client and server
services.
8. 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.
9. 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.
10. FUNCTIONS OF BROADCAST RPC:
★ Allows you to specify that the client’s
request message has to be broadcasted.
★ You can declare broadcast ports.
★ It helps to reduce the load on the physical
network.
11. BATCH-MODE RPC
➔ 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.
12. FUNCTIONS OF BATCH-MODE RPC:
★ It minimizes overhead involved in sending a
request as it sends them over the network in
one batch to the server.
★ This type of RPC protocol is only efficient for
the application that needs lower call rates.
★ It needs a reliable transmission protocol.
14. DESIGN ISSUES
★ Exception handling
➔ Necessary because of possibility of network
and nodes failures;
➔ RPC uses return value to indicate errors;
★ Transparency
➔ Syntactic - achievable, exactly the same
syntax as a local procedure call.
➔ Semantic - impossible because of RPC
limitation: failure (similar but not exactly the
same).
15. RPC MECHANISM
● Based on concepts of stubs
● Stub is a code used for converting parameter
used in procedure call
● RPC involves Client & Server Process
★ Mechanism involves following five elements:
❏ The Client
❏ The Client Stub
❏ The RPCRuntime
❏ The Server Stub
❏ The Server
17. Steps of a Remote Procedure Call
➢ Client procedure calls client stub in normal way
➢ Client stub builds message, calls local OS
➢ Client's OS sends message to remote OS
➢ Remote OS gives message to server stub
➢ Server stub unpacks parameters, calls server
➢ Server does work, returns result to the stub
➢ Server stub packs it in message, calls local OS
➢ Server's OS sends message to client's OS
➢ Client's OS gives message to client stub
➢ Stub unpacks result, returns to client
18. ★ Client:
➢ Initiates RPC
➢ Makes a local call that invokes a
corresponding procedure in the client stub
★ Client Stub:
1. Receiving a call request from client:
➢ Packs the specification of the target
procedure & the arguments into a message
➢ Asks local RPCRuntime to send it to server
stub
1. Receiving result of procedure execution
➢ Unpacks the result & passes it to the client
19. RPCRuntime:
★ Client Machine
1. Receive call request message from Client
Stub & sends to server machine
2. Receives the message containing the result
of procedure execution from the server
machine & sends to client stub
★ Server Machine
1. Receives the message containing the result
of procedure execution from the server stub
& sends it to client machine
2. Receive call request message from the client
machine & sends it to server stub
20. ★ Server Stub:
1. Receiving a call request from local
RPCRuntime:
● Unpacks & makes a normal call to
invoke the appropriate procedure in
Server
● Receiving result of procedure
execution
I. Packs the result into a message
II. Asks local RPCRuntime to send it to
client stub
21. ★ Server:
1. Receiving a call request from the server
stub
● Executes the appropriate procedure
● Returns the result of execution to the
server stub
22. STUB GENERATION
★ Manually
1. The RPC implementor provides a set of
translation functions from which a user
can construct his/her own stubs
2. It is simple to implement and can
handle very complex parameter types
★ Automatically
1. Uses Interface Definition Language(IDL)
23. MARSHALING ARGUMENTS & RESULT
❏ The transfer of message data between
two computers requires encoding &
decoding of the message data
❏ This operation in RPCs is known as
Marshaling
➔ Actions involved in Marshaling
1. Taking the arguments
2. Encoding the message data on sender’s
computer
3. Decoding the message data on
receiver’s computer
24. CHARACTERISTICS
★ The called procedure is in another
process which may reside in another
machine.
★ The processes do not share address
space.
★ Parameters are passed by values.
25. CHARACTERISTICS
★ The called remote procedure executes
within the environment of the server
process.
1. The called procedure does not have
access to the calling procedure environment.
26. FEATURES
➔ Simple call syntax
➔ Familiar semantics
➔ Well defined interface
➔ Ease of use
➔ Efficient
Can communicate between processes on
the same machine or different machines
27. ADVANTAGE 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.
28. ADVANTAGE OF REMOTE PROCEDURE CALL
➔ 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.
29. DISADVANTAGE 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.