Remote Procedure Call RPC is a highlevel model for clientsever communication It provides the programmers with a familiar mechanism for building distributed systems Examples File service Authentication service ID: 513480
Download Presentation The PPT/PDF document "Remote Procedure Call" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Remote Procedure CallSlide2
Remote Procedure Call (RPC) is a high-level model for client-sever communication.
It provides the programmers with a familiar mechanism for building distributed systems.Examples: File service, Authentication service.
IntroductionSlide3
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.Slide4
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.
IntroductionSlide5
The RPC model
Blocking state
client
server
request
reply
Executing state
Call procedure and wait for reply
Receive request and start process execution
Send reply and wait for next execution
Resume executionSlide6
The called procedure is in another process which may reside in another machine.
The processes do not share address space.Passing of parameters by reference and passing pointer values are not allowed.Parameters are passed by values.The called remote procedure executes within the environment of the server process.
The called procedure does not have access to the calling procedure's environment.
CharacteristicsSlide7
Simple call syntax
Familiar semanticsWell defined interface
Ease of use
Efficient
Can communicate between processes on the same machine or different machines
FeaturesSlide8
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);
Design IssuesSlide9
Based on concepts of stubs
Stub is a code used for converting parameter used in procedure callRPC involves Client & Server ProcessMechanism involves following five elements:The Client
The Client Stub
The
RPCRuntime
The Server Stub
The Server
RPC MechanismSlide10
RPC Mechanism
Return Call
Call Return
Unpack Pack
Unpack Pack
Receive Send
Receive Send
Client Stub
RPC Runtime
RPC Runtime
Server Stub
Client
Server
Call Packet
Result Packet
Client Machine
Server MachineSlide11
Client procedure
calls client stub in normal wayClient 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 stubStub
unpacks result, returns to client
Steps of a Remote Procedure CallSlide12
Client:
Initiates RPCMakes a local call that invokes a corresponding procedure in the client stubClient Stub:Receiving a call request from client:Packs the specification of the target procedure & the arguments into a messageAsks local RPCRuntime to send it to server stubReceiving result of procedure executionUnpacks the result & passes it to the client Slide13
RPCRuntime
:Client MachineReceive call request message from Client Stub & sends to server machineReceives the message containing the result of procedure execution from the server machine & sends to client stubServer Machine
Receives the message containing the result of procedure execution from the server stub & sends it to client machine
Receive call request message from the client machine & sends it to server stubSlide14
Server Stub:
Receiving a call request from local RPCRuntime:Unpacks & makes a normal call to invoke the appropriate procedure in ServerReceiving result of procedure executionPacks the result into a messageAsks local
RPCRuntime
to send it to client stub
Server:
Receiving a call request from the server stubExecutes the appropriate procedureReturns the result of execution to the server stubSlide15
Manually
The RPC implementor provides a set of translation functions from which a user can construct his/her own stubsIt is simple to implement and can handle very complex parameter typesAutomaticallyUses Interface Definition Language(IDL)Stub GenerationSlide16
The transfer of message data between two computers requires encoding & decoding of the message data
This operation in RPCs is known as MarshalingActions involved in MarshalingTaking the argumentsEncoding the message data on sender’s computerDecoding the message data on receiver’s computerMarshaling Arguments & ResultSlide17
Two issues in server management
Server ImplementationStateful ServerStateless ServerServer CreationInstance-per-call serverInstance-per-session serverPersistent servers
Server ManagementSlide18
Based on the style of implementation, it is of two types
Stateful ServersMaintains clients’ state informationFor eg: Consider a server for byte stream files that allows the following operations on file:Open(filename, mode)Read(fid, n, buffer)Write(fid, n, buffer)
Seek(fid, position)
Close(fid)
Server Implementation Slide19
Open(
filename,mode
)
Return(fid)
Return(bytes 0 to 99)
Return(bytes100 to199)
Read (fid, 100,
buf
)
Read (fid, 100,
buf
)
fid
Mode
R/W
ptr
Client Process
Server Process
Stateful
File ServerSlide20
Stateless Servers
Does not maintain any client state informationFor eg: Consider a server for byte stream files that allows the following operations on files is stateless:Read(filename, position, n ,buffer)write(filename, position, n ,buffer)Slide21
Return(bytes 0 to 99)
Return(bytes100 to199)
Read (fid, 100,
buf
)
Read (filename, 100,
buf
)
Client Process
Server Process
Stateless File Server
fid
Mode
R/W
ptrSlide22
Based on time duration for which RPC servers survive, it is classified into three
Instance-per-Call ServersExist only for the duration of a single callCreated by RPCRuntime -> when a call message arrivesInstance-per-Session ServersExist for the entire session for which a client & a server intractPersistent ServersRemains in existence
indefinetely
Server Creation Semantics