You are on page 1of 6

Remote Procedure Calls (RPC)

Introduction:
IPC part of distributed system can often be conveniently handled by message-passing model. It
doesn't offer a uniform panacea for all the needs.RPC emerged as a result of this. It can be said
as the special case of message-passing model.
Remote Procedure Call (RPC) is an inter process communication technique to allo client and
server softare to communicate. RPC is a poerful technique for constructing distributed! client-
server based applications. It is based on e"tending the notion of conventional or local procedure
calling! so that the called procedure need not e"ist in the same address space as the calling
procedure. #he to processes may be on the same system! or they may be on different systems
ith a netor$ connecting them. %y using RPC! programmers of distributed applications avoid
the details of the interface ith the netor$.
It has become idely accepted because of the folloing features&
'imple call synta" and similarity to local procedure calls.
It specifies a ell defined interface and this property supports compile-time type
chec$ing and automated interface generation.
Its ease of use! efficiency and generality.
It can be used as an IPC mechanism beteen
Processes on different machines and also beteen different processes on
the same machine.
Transparency of RPC:
( transparent RPC is one in hich the local and remote procedure calls are indistinguishable.
#ypes of transparencies&
Syntactic transparency: ( remote procedure call should have
e"actly the same synta" as a local procedure call.
Semantic transparency: #he semantics of a remote procedure call
are identical to those of a local procedure call.
'yntactic transparency is not an issue but semantic transparency is difficult.
Remote procedure calls vs. Local procedure calls:
)ifference beteen remote procedure calls and local procedure calls&
1
*. +nli$e local procedure calls! ith remote procedure calls!
i. )is,oint (ddress 'pace
ii. (bsence of shared memory.
iii. -eaningless ma$ing call by reference! using addresses in arguments and
pointers.
.. RPC/s are more vulnerable to failure because of&
i. Possibility of processor crashes or
ii. communication problems of a netor$.
0. RPC/s are much more time consuming than 1PC/s due to the involvement of
communication netor$.
)ue to these reasons! total semantic transparency is impossible.
RPC Model:
It is similar to commonly used procedure call model. It or$s in the folloing manner&
2or ma$ing a procedure call! the caller places arguments to the procedure in some
ell specified location.
Control is then transferred to the sequence of instructions that constitutes the body
of the procedure.
#he procedure body is e"ecuted in a nely created e"ecution environment that
includes copies of the arguments given in the calling instruction.
(fter the procedure e"ecution is over! control returns to the calling point!
returning a result.
#he RPC enables a call to be made to a procedure that does not reside in the address space of the
calling process. 'ince the caller and the callee processes have dis,oint address space! the remote
procedure has no access to data and variables of the caller/s environment. RPC facility uses a
message-passing scheme for information e"change beteen the caller and the callee processes.
3n arrival of request message! the server processes the folloing tas$s&
e"tracts the procedure/s parameters!
computes the result!
sends a reply message! and
then aaits the ne"t call message.
2
Implementing RPC Mechanism:
#o achieve semantic transparency! implementation of RPC mechanism is based on the concepts
of stubs.
'tubs& It Provide a normal 4 local procedure call abstraction by concealing the
underlying RPC mechanism. ( separate stub procedure is associated ith both the
client and server processes. #o hide the underlying communication netor$! RPC
communication pac$age $non as RPC Runtime is used on both the sides.
#hus implementation of RPC involves the five elements of program&
o Client
o Client 'tub
o RPC Runtime
o 'erver stub
o 'erver
#he client! the client stub! and one instance of RPCRuntime e"ecute on the client
machine.
#he server! the server stub! and one instance of RPCRuntime e"ecute on the server
machine.
3
(s far as the client is concerned! remote services are accessed by the user by ma$ing
ordinary 1PC
Client 'tub&
It is responsible for the folloing to tas$s&
3n receipt of a call request from the client!
o It pac$s specifications of the target procedure and the arguments into a
message and as$s the local RPC Runtime to send it to the server stub.
3n receipt of the result of procedure e"ecution! it unpac$s the result and
passes it to the client.
RPC Runtime&
It handles transmission of messages across the netor$ beteen Client and the server
machine.
It is responsible for Retransmission! (c$noledgement! Routing and
5ncryption.
'erver 'tub&
It is responsible for the folloing to tas$s&
4
3n receipt of a call request message from the local RPCRuntime! it unpac$s it and
ma$es a perfectly normal call to invo$e the appropriate procedure in the server.
3n receipt of the result of procedure e"ecution from the server! it unpac$s the
result into a message and then as$s the local RPCRuntime to send it to the client
stub.
ome special types or RPCs:
Callbac$ RPC& It facilitates a peer-to-Peer paradigm among participating processes. It
allos a process to be both a client and a server. Remotely processed interactive
(pplication
%roadcast RPC& ( client/s request is broadcast on the netor$ and is processed by all
servers that have the procedure for processing that request.
%atch-mode RPC & %atch-mode RPC is used to queue separate RPC requests in a
transmission buffer on the client side and then send them over the netor$ in one batch to
the server.
RPC! a Practical "#ample:
#he folloing steps have to be ta$en to establish a RPC.
)ecide hat are methods that you/ll be RPC.
6enerate ++I) (+niversal +nique I)entifier)
o uuidgen 4i 4o75&8Interface.idl7
)eveloping I)1 file.
)eveloping (pplication Configuration 2ile ((C2)
Implementing the RPC (hether in server or standalone application)
6enerating stub file (9' or -I)1)
)eveloping the client side
o (dding client stub file amd generated header file.
o RpcStringBindingCompose
Combines an ob,ect ++I)! a protocol sequence! a netor$ address! an
endpoint and other netor$ options into a string representation of a
binding handle.
o RpcBindingFromStringBinding
Creates a server binding handle from a string representation of a binding
handle.
5
o Call RPC using Rpc#ry5"cept
o 2ree&
RpcStringFree
RpcBindingFree
)eveloping the server side
o RpcServerUseProtseqEp
#ells the RPC run-time library to use the specified protocol sequence
combined ith the specified endpoint for receiving remote procedure
calls.
o RpcServerRegisterIf
Registers an interface ith the RPC run-time library
o RpcServerListen
( server calls RpcServerListen hen the server is ready to process
remote procedure calls.
6

You might also like