SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
© Peter R. Egli 2015
1/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
Peter R. Egli
INDIGOO.COM
OVERVIEW OF ONC RPC, AN
RPC TECHNOLOGY FOR UNIX BASED SYSTEMS
ONC RPCOPEN NETWORK COMPUTING
REMOTE PROCEDURE CALL
© Peter R. Egli 2015
2/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
Contents
1. What is RPC?
2. Local versus remote procedure call
3. RPC service daemon on the remote machine (portmapper)
4. RPC system components
5. RPC parameter passing
6. Network transport protocol for RPC
7. RPC interface description and code generation
8. RPC procedure call semantics
9. RPC remote procedure location and discovery
10. RPC interaction
© Peter R. Egli 2015
3/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
1. What is RPC?
RPC is an extension of conventional procedure calls:
RPC allows a client application to call procedures in a different address space on the same or
on a remote machine (= transfer of control and data to a different address space and process).
RPC as middleware for traditional client – server programming:
RPC extends sockets with remote procedure call semantics. RPC allows an application to call
a remote procedure just as it were a local procedure (location transparency).
Different flavors of RPC:
1. SUN-RPC (= ONC RPC):
ONC RPC = Open Network Computing RPC. Initially developed by Sun Microsystems.
First widely adopted RPC implementation.
Standards: RFC4506 XDR (Data presentation), RFC1057 RPC protocol specification.
2. DCE/RPC:
Distributed Computing Environment RPC by OSF (Open Software Foundation).
Not widely adopted by the IT industry.
3. MS RPC:
Microsoft’s extension of DCE/RPC.
© Peter R. Egli 2015
4/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
2. Local versus remote procedure call
Local procedure call:
Remote procedure call:
Client:
Calling
procedure
Server:
Called
procedure
Arguments
Results
The calling procedure executes the
called procedure in its own address
space and process.
Client:
Calling
procedure
Server:
Called
procedure
Client stub Server stub
Network
(TCP/IP)
Request
message
Request
message
Reply
message
Reply
message
Results
Client and server run as 2 separate processes
(on the same or on different machines).
ResultsCall with
arguments
Call with
arguments
Stubs allow communication between client and
server. These stubs map the local procedure call
to a series of network RPC function calls.
© Peter R. Egli 2015
5/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
3. RPC service daemon on the remote machine (portmapper)
How is the remote procedure called?
The remote procedure request message is received by a process (service daemon called
portmapper). The daemon dispatches the call to the appropriate server stub.
The service daemon listens on incoming requests.
callrpc() with
request
Dispatch service
procedure
Execute
procedure
Assemble reply
return() reply
Client is
blocked
Client
Service
daemon
Server
procedure
© Peter R. Egli 2015
6/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
4. RPC system components
Main RPC components:
The client stub is a proxy object that passes calls to the server stub. The message modules
pack and unpack the marshaled arguments in UDP packets.
Client:
Calling
procedure
Server:
Called
procedure
Client stub Server stub
Network
(TCP/IP)
Request
message
Request
message
Reply
message
Reply
message
Results Results
Message module
Portmapper with
Message module
Results Results
Client stub: Pack arguments (marshal)
Server Stub: Unpack arguments (unmarshal)
Message modules: Send & receive RPC messages.
The portmapper runs as a daemon process (listener
process).
Server daemon
Call with
arguments
Call with
arguments
Call with
arguments
Call with
arguments
© Peter R. Egli 2015
7/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
5. RPC parameter passing (1/2)
Local procedures:
The call of a local procedure allows pass-by-value and pass-by-reference.
Call by value example (plain old C):
int sqrt(int arg0)
{
return arg0 * arg0;
}
...
int number = 9;
int result;
result = sqrt(number);
Call-by-reference example (plain old C):
struct Arguments {
int number0;
int number1;
} args;
struct Arguments args;
...
int product(Arguments* args)
{
return args->number0 * args->number1;
}
...
int result = product(&args);
© Peter R. Egli 2015
8/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
5. RPC parameter passing (2/2)
Remote procedures / RPC:
RPC only allows pass-by-value because pointers are meaningless in the address space of the
remote process.
XDR (the RPC Interface Description Language, see below) allows declaring pointers to data
structures. But RPC does actually copy-in/copy-out parameter passing (passes full copies of
referenced data structures to the remote procedure).
Example:
XDR file with pointer argument:
/* msg.x: Remote msg printing protocol */
struct PrintArgs {
char* name;
int number;
};
program MSGPROG {
version PRINTMSGVERS {
int PRINTMSG(PrintArgs*) = 1;
} = 1;
} = 0x20000001;
Client application:
struct PrintArgs printArgs;
int* result;
result = printmsg_1(&printArgs, clnt);
© Peter R. Egli 2015
9/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
6. Network transport protocol for RPC
RPC uses the underlying network just as any other network application.
RPC may use connection oriented (TCP, SCTP) or connectionless transport protocols (UDP).
Usually RPC uses UDP because UDP (connectionless transport service) better supports the
RPC protocol because:
1. RPC interactions are generally short so connections are not really required.
2. Servers generally serve a large number of clients and maintaining state information on
connections means additional overhead for the server.
3. LANs are generally reliable so the reliable service of TCP is not needed.
Client:
Calling
procedure
Client stub
result = printmsg_1(&printArgs, clnt);
Message module
Socket
UDP
IP
Marshal parameters
Request packet
Create request message
RPC Request message
R
R+H
IPUR+H
Server:
Called
procedure
Server stub
Message module
Socket
UDP
IP
R
R+H
© Peter R. Egli 2015
10/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
Program number
Procedure declaration (procedure number 1)
Version of (remote) program (=1 in the example)
Name of the (remote) program
7. RPC interface description and code generation (1/2)
Interface definition:
The server procedure(s) are defined as an interface in a formal language (XDR) and then
compiled to source code (plain old C).
Elements of XDR (External Data Representation):
1. Interface definition language (IDL).
XDR defines procedure signatures (procedure names, parameters with types) and
user defined types.
2. Data encoding standard (how to encode data for transmission over the network).
XDR defines how to pack simple types like int and string into a byte stream.
Example XDR file:
/* msg.x: Remote msg printing protocol */
program MESSAGEPROG
{
version PRINTMESSAGEVERS
{
int PRINTMESSAGE(string) = 1;
} = 1;
} = 0x20000001;
© Peter R. Egli 2015
11/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
7. RPC interface description and code generation (2/2)
Code generation from XDR file:
The RPC compiler (ONC RPC: rpcgen) generates all the necessary C source files from the XDR
interface specification file (header files, stubs).
XDR
file
RPC
compiler
C
compiler +
linker
Client
appl.
Client
stub
Server
proc.
Server
stub
Client
executable
C
compiler +
linker
Server
executable
rpcgen
Shared
header
files
© Peter R. Egli 2015
12/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
8. RPC procedure call semantics (1/4)
Potential problems with RPC calls:
a. The request message may be lost (in the network, in the message module).
b. The reply message may be lost.
c. The server or client may crash during an RPC call.
In these cases, it is not clear to the client if the remote procedure has been called or not.
RPC incorporates different strategies for handling these situations.
Client:
Calling
procedure
Server:
Called
procedure
Client stub Server stub
Network
(UDP/IP)
Message module Message module
R
R
© Peter R. Egli 2015
13/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
8. RPC procedure call semantics (2/4)
RPC message delivery strategies:
1. Retry request message:
The client retransmits the request message until either a reply is received or the server is
assumed to have failed (timeout).
2. Duplicate filtering:
The server filters out duplicate request messages when retransmissions are used.
3. Retransmission of replies:
The server maintains a history of reply messages.
In case of a lost reply message, the server retransmit the reply without re-executing the server
operation.
© Peter R. Egli 2015
14/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
8. RPC procedure call semantics (3/4)
RPC supports 3 different “call semantics” that define the level of guarantee of requests:
1. maybe call semantics.
2. at-least-once call semantics.
3. at-most-once call semantics.
RPC mechanisms usually include timeouts to prevent clients waiting indefinitely for reply
messages.
1. maybe call semantics:
‱ No retransmission of request messages.
‱ Client is not certain whether the procedure has been executed or not.
‱ No fault-tolerance measures (RPC call may or may not be successful).
‱ Generally not acceptable (low level of guarantee).
2. at-least-once call semantics:
‱ The message module repeatedly resends request messages after timeouts occur until it
either gets a reply message or a maximum number of retries have been made.
‱ No duplicate request message filtering.
‱ The remote procedure is called at least once if the server is not down.
‱ The client does not know how many times the remote procedure has been called. This could
produce undesirable results (e.g., money transfer) unless the called procedure is
“idempotent” (= repeatable with the same effect as a single call).
© Peter R. Egli 2015
15/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
8. RPC procedure call semantics (4/4)
3. at-most-once call semantics:
‱ Retransmission of request messages.
‱ Duplicate request message filtering.
‱ If the server does not crash and the client receives the result of a call, then the procedure
has been called exactly once. Otherwise, an exception is reported and the procedure will
have been called either once or not at all.
‱ Works for both idempotent and non-idempotent operations.
‱ More complex support required due to the need for request message filtering and for
keeping track of replies.
Comparison of call semantics:
Delivery guarantees
RPC call semantics Retry request
message
Duplicate filtering Re-execute
procedure or
retransmit reply
Maybe No Not applicable Not applicable
At-least-once Yes No Re-execute
procedure
At-most-once Yes Yes Retransmit reply
© Peter R. Egli 2015
16/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
9. RPC remote procedure location and discovery (1/2)
How does the client find the IP address and port of the host hosting the remote procedure?
In RPC, binding refers to determining the location and identity of the called procedure.
The binder (RPCBIND, formerly portmapper) is a daemon that:
- is a registry for registering server procedures on the server,
- is a lookup service for the client to get the address of the server procedure host,
- runs on the host and listens on a well-known address (port number 111).
Client
Client
stub
Binder
Message
module
RPC
call
bind
LookUp
LookUp response
Message
module
Server
stub
Server
Register procedure
ACK
send
RPC request
call
RPC response
return
HostClient
© Peter R. Egli 2015
17/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
9. RPC remote procedure location and discovery (2/2)
Static versus dynamic binding:
Static binding:
‱ Binds the host address of a server into the client program at compilation time.
‱ Undesirable because the client and server programs are compiled separately and often at
different times and the server may be moved from one host to another.
Dynamic binding:
‱ Dynamic lookup of the server address (see previous slide).
‱ Allows servers to register and remove their exporting services.
‱ Allows clients to lookup the named service.
Binding API:
PROCEDURE Register (serviceName:String; serverPort:Port; version:integer)
Binder records the service name and server port of a service in its table, together with a
version number.
PROCEDURE Withdraw (serviceName:String; serverPort:Port; version:integer)
Binder removes the service from its table.
PROCEDURE LookUp (serviceName:String; version:integer): Port
The binder looks up the named service and returns its address (or set of addresses) if the
version number agrees with the one stored in its table.
© Peter R. Egli 2015
18/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
10. RPC interaction (1/3)
RPC allows synchronous and asynchronous interaction.
Synchronous RPC:
In synchronous RPC, the client is blocked until it received the server reply.
Synchronous RPC is the default mode of interaction.
Easier to program (no synchronization required on client).
Client is blocked during the entire RPC operation (waste of execution time, performance
negatively affected).
Client
Server
procedure
callrpc() with
request
Execute
procedure
return() reply
Client is
blocked
© Peter R. Egli 2015
19/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
10. RPC interaction (2/3)
Asynchronous RPC:
If a remote procedure does not require a response, the client can send a request to the server
without waiting for a reply and continue with its work.
The client is not blocked, can continue with its work.
Only possible for remote procedures that do not return a result (e.g. send a log message to a
log server).
Client
Server
procedure
callrpc() with
request
Server executes the
request asynchronously
return()
Client continues
with its work
© Peter R. Egli 2015
20/20
Rev. 2.00
SUN / ONC RPC (Remote Procedure Call) indigoo.com
10. RPC interaction (3/3)
Deferred synchronous RPC:
With deferred synchronous RPC, the client sends a request to the server and only waits for the
acceptance of the request. The server executes the request and sends an answer back to the
client.
This mode is useful in cases where the server procedure requires lengthy computations.
Client not blocked, can continue with its work.
More complicated synchronization required on the client.
Client
Server
procedure
callrpc() with
request
Server executes the
request asynchronously
Accept request
Client waits for
acceptance of
request and
then continues
with its work
Return result(s)Client is
interrupted,
processes the
result
ACK
Each pair of call and reply
message is matched by a
transaction ID (XID field).

Weitere Àhnliche Inhalte

Was ist angesagt?

UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram ProtocolPeter R. Egli
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure CallAbdelrahman Al-Ogail
 
Remote procedure call
Remote procedure callRemote procedure call
Remote procedure callManojparihar16
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented CommunicationDilum Bandara
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method InvocationPaul Pajo
 
message passing
 message passing message passing
message passingAshish Kumar
 
Authentication techniques
Authentication techniquesAuthentication techniques
Authentication techniquesIGZ Software house
 
Agreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemoryAgreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemorySHIKHA GAUTAM
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsAya Mahmoud
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocolsN.Jagadish Kumar
 
Transport services
Transport servicesTransport services
Transport servicesNavin Kumar
 
Understanding TCP/IP
Understanding TCP/IPUnderstanding TCP/IP
Understanding TCP/IPmatthew_jenkins
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarpNita Dalla
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitivesStudent
 
Mobile transportlayer
Mobile transportlayerMobile transportlayer
Mobile transportlayerRahul Hada
 
Network File System in Distributed Computing
Network File System in Distributed ComputingNetwork File System in Distributed Computing
Network File System in Distributed ComputingChandan Padalkar
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocolN.Jagadish Kumar
 

Was ist angesagt? (20)

UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram Protocol
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure Call
 
Remote procedure call
Remote procedure callRemote procedure call
Remote procedure call
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented Communication
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
POP3 Post Office Protocol
POP3 Post Office ProtocolPOP3 Post Office Protocol
POP3 Post Office Protocol
 
message passing
 message passing message passing
message passing
 
Tcp
TcpTcp
Tcp
 
Authentication techniques
Authentication techniquesAuthentication techniques
Authentication techniques
 
Agreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemoryAgreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared Memory
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systems
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Transport services
Transport servicesTransport services
Transport services
 
Understanding TCP/IP
Understanding TCP/IPUnderstanding TCP/IP
Understanding TCP/IP
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitives
 
Web Security
Web SecurityWeb Security
Web Security
 
Mobile transportlayer
Mobile transportlayerMobile transportlayer
Mobile transportlayer
 
Network File System in Distributed Computing
Network File System in Distributed ComputingNetwork File System in Distributed Computing
Network File System in Distributed Computing
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
 

Andere mochten auch

Rpc (Distributed computing)
Rpc (Distributed computing)Rpc (Distributed computing)
Rpc (Distributed computing)Sri Prasanna
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computingSatya P. Joshi
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationRJ Mehul Gadhiya
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process CommunicationAnil Kumar Pugalia
 

Andere mochten auch (6)

Rpc (Distributed computing)
Rpc (Distributed computing)Rpc (Distributed computing)
Rpc (Distributed computing)
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computing
 
RPC
RPCRPC
RPC
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 

Ähnlich wie Sun RPC (Remote Procedure Call)

Distributes objects and Rmi
Distributes objects and RmiDistributes objects and Rmi
Distributes objects and RmiMayank Jain
 
Remote procedure calls
Remote procedure callsRemote procedure calls
Remote procedure callsimnomus
 
Dos(rpc)avishek130650107020
Dos(rpc)avishek130650107020Dos(rpc)avishek130650107020
Dos(rpc)avishek130650107020Avishek Sarkar
 
Topic2 Understanding Middleware
Topic2 Understanding MiddlewareTopic2 Understanding Middleware
Topic2 Understanding Middlewaresanjoysanyal
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIPrajakta Rane
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure CallNadia Nahar
 
Byte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptxByte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptxRockyBhai46825
 
DCE daemonless and outbound-only communication with hp open view operations
DCE daemonless and outbound-only communication with hp open view operationsDCE daemonless and outbound-only communication with hp open view operations
DCE daemonless and outbound-only communication with hp open view operationsStefan Bergstein
 
Chapter 2B-Communication.ppt
Chapter 2B-Communication.pptChapter 2B-Communication.ppt
Chapter 2B-Communication.pptsirajmohammed35
 
Jaimin chp-6 - transport layer- 2011 batch
Jaimin   chp-6 - transport layer- 2011 batchJaimin   chp-6 - transport layer- 2011 batch
Jaimin chp-6 - transport layer- 2011 batchJaimin Jani
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemPoojaBele1
 
Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Sri Prasanna
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3farshad33
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3sehrish saba
 
Firewalls
FirewallsFirewalls
Firewallshemantag
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programmingelliando dias
 

Ähnlich wie Sun RPC (Remote Procedure Call) (20)

Lecture9
Lecture9Lecture9
Lecture9
 
Distributes objects and Rmi
Distributes objects and RmiDistributes objects and Rmi
Distributes objects and Rmi
 
Remote procedure calls
Remote procedure callsRemote procedure calls
Remote procedure calls
 
Dos(rpc)avishek130650107020
Dos(rpc)avishek130650107020Dos(rpc)avishek130650107020
Dos(rpc)avishek130650107020
 
Topic2 Understanding Middleware
Topic2 Understanding MiddlewareTopic2 Understanding Middleware
Topic2 Understanding Middleware
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMI
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure Call
 
Byte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptxByte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptx
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure Call
 
Rpc
RpcRpc
Rpc
 
DCE daemonless and outbound-only communication with hp open view operations
DCE daemonless and outbound-only communication with hp open view operationsDCE daemonless and outbound-only communication with hp open view operations
DCE daemonless and outbound-only communication with hp open view operations
 
Chapter 2B-Communication.ppt
Chapter 2B-Communication.pptChapter 2B-Communication.ppt
Chapter 2B-Communication.ppt
 
Jaimin chp-6 - transport layer- 2011 batch
Jaimin   chp-6 - transport layer- 2011 batchJaimin   chp-6 - transport layer- 2011 batch
Jaimin chp-6 - transport layer- 2011 batch
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed System
 
Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3
 
Firewalls
FirewallsFirewalls
Firewalls
 
Rpc mechanism
Rpc mechanismRpc mechanism
Rpc mechanism
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
 

Mehr von Peter R. Egli

LPWAN Technologies for Internet of Things (IoT) and M2M Scenarios
LPWAN Technologies for Internet of Things (IoT) and M2M ScenariosLPWAN Technologies for Internet of Things (IoT) and M2M Scenarios
LPWAN Technologies for Internet of Things (IoT) and M2M ScenariosPeter R. Egli
 
Data Networking Concepts
Data Networking ConceptsData Networking Concepts
Data Networking ConceptsPeter R. Egli
 
Communication middleware
Communication middlewareCommunication middleware
Communication middlewarePeter R. Egli
 
Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)Peter R. Egli
 
Business Process Model and Notation (BPMN)
Business Process Model and Notation (BPMN)Business Process Model and Notation (BPMN)
Business Process Model and Notation (BPMN)Peter R. Egli
 
Microsoft .NET Platform
Microsoft .NET PlatformMicrosoft .NET Platform
Microsoft .NET PlatformPeter R. Egli
 
Overview of Cloud Computing
Overview of Cloud ComputingOverview of Cloud Computing
Overview of Cloud ComputingPeter R. Egli
 
MQTT - MQ Telemetry Transport for Message Queueing
MQTT - MQ Telemetry Transport for Message QueueingMQTT - MQ Telemetry Transport for Message Queueing
MQTT - MQ Telemetry Transport for Message QueueingPeter R. Egli
 
Enterprise Application Integration Technologies
Enterprise Application Integration TechnologiesEnterprise Application Integration Technologies
Enterprise Application Integration TechnologiesPeter R. Egli
 
Overview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyOverview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyPeter R. Egli
 
Android Native Development Kit
Android Native Development KitAndroid Native Development Kit
Android Native Development KitPeter R. Egli
 
Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Peter R. Egli
 
Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Peter R. Egli
 
Overview of Spanning Tree Protocol (STP & RSTP)
Overview of Spanning Tree Protocol (STP & RSTP)Overview of Spanning Tree Protocol (STP & RSTP)
Overview of Spanning Tree Protocol (STP & RSTP)Peter R. Egli
 
MSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message QueueingMSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message QueueingPeter R. Egli
 
Common Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBACommon Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBAPeter R. Egli
 
Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)Peter R. Egli
 
JMS - Java Messaging Service
JMS - Java Messaging ServiceJMS - Java Messaging Service
JMS - Java Messaging ServicePeter R. Egli
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Peter R. Egli
 

Mehr von Peter R. Egli (20)

LPWAN Technologies for Internet of Things (IoT) and M2M Scenarios
LPWAN Technologies for Internet of Things (IoT) and M2M ScenariosLPWAN Technologies for Internet of Things (IoT) and M2M Scenarios
LPWAN Technologies for Internet of Things (IoT) and M2M Scenarios
 
Data Networking Concepts
Data Networking ConceptsData Networking Concepts
Data Networking Concepts
 
Communication middleware
Communication middlewareCommunication middleware
Communication middleware
 
Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)
 
Business Process Model and Notation (BPMN)
Business Process Model and Notation (BPMN)Business Process Model and Notation (BPMN)
Business Process Model and Notation (BPMN)
 
Microsoft .NET Platform
Microsoft .NET PlatformMicrosoft .NET Platform
Microsoft .NET Platform
 
Overview of Cloud Computing
Overview of Cloud ComputingOverview of Cloud Computing
Overview of Cloud Computing
 
MQTT - MQ Telemetry Transport for Message Queueing
MQTT - MQ Telemetry Transport for Message QueueingMQTT - MQ Telemetry Transport for Message Queueing
MQTT - MQ Telemetry Transport for Message Queueing
 
Enterprise Application Integration Technologies
Enterprise Application Integration TechnologiesEnterprise Application Integration Technologies
Enterprise Application Integration Technologies
 
Overview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyOverview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technology
 
Android Native Development Kit
Android Native Development KitAndroid Native Development Kit
Android Native Development Kit
 
Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)
 
Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)
 
Web services
Web servicesWeb services
Web services
 
Overview of Spanning Tree Protocol (STP & RSTP)
Overview of Spanning Tree Protocol (STP & RSTP)Overview of Spanning Tree Protocol (STP & RSTP)
Overview of Spanning Tree Protocol (STP & RSTP)
 
MSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message QueueingMSMQ - Microsoft Message Queueing
MSMQ - Microsoft Message Queueing
 
Common Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBACommon Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBA
 
Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)
 
JMS - Java Messaging Service
JMS - Java Messaging ServiceJMS - Java Messaging Service
JMS - Java Messaging Service
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 

KĂŒrzlich hochgeladen

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

KĂŒrzlich hochgeladen (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Sun RPC (Remote Procedure Call)

  • 1. © Peter R. Egli 2015 1/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com Peter R. Egli INDIGOO.COM OVERVIEW OF ONC RPC, AN RPC TECHNOLOGY FOR UNIX BASED SYSTEMS ONC RPCOPEN NETWORK COMPUTING REMOTE PROCEDURE CALL
  • 2. © Peter R. Egli 2015 2/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com Contents 1. What is RPC? 2. Local versus remote procedure call 3. RPC service daemon on the remote machine (portmapper) 4. RPC system components 5. RPC parameter passing 6. Network transport protocol for RPC 7. RPC interface description and code generation 8. RPC procedure call semantics 9. RPC remote procedure location and discovery 10. RPC interaction
  • 3. © Peter R. Egli 2015 3/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 1. What is RPC? RPC is an extension of conventional procedure calls: RPC allows a client application to call procedures in a different address space on the same or on a remote machine (= transfer of control and data to a different address space and process). RPC as middleware for traditional client – server programming: RPC extends sockets with remote procedure call semantics. RPC allows an application to call a remote procedure just as it were a local procedure (location transparency). Different flavors of RPC: 1. SUN-RPC (= ONC RPC): ONC RPC = Open Network Computing RPC. Initially developed by Sun Microsystems. First widely adopted RPC implementation. Standards: RFC4506 XDR (Data presentation), RFC1057 RPC protocol specification. 2. DCE/RPC: Distributed Computing Environment RPC by OSF (Open Software Foundation). Not widely adopted by the IT industry. 3. MS RPC: Microsoft’s extension of DCE/RPC.
  • 4. © Peter R. Egli 2015 4/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 2. Local versus remote procedure call Local procedure call: Remote procedure call: Client: Calling procedure Server: Called procedure Arguments Results The calling procedure executes the called procedure in its own address space and process. Client: Calling procedure Server: Called procedure Client stub Server stub Network (TCP/IP) Request message Request message Reply message Reply message Results Client and server run as 2 separate processes (on the same or on different machines). ResultsCall with arguments Call with arguments Stubs allow communication between client and server. These stubs map the local procedure call to a series of network RPC function calls.
  • 5. © Peter R. Egli 2015 5/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 3. RPC service daemon on the remote machine (portmapper) How is the remote procedure called? The remote procedure request message is received by a process (service daemon called portmapper). The daemon dispatches the call to the appropriate server stub. The service daemon listens on incoming requests. callrpc() with request Dispatch service procedure Execute procedure Assemble reply return() reply Client is blocked Client Service daemon Server procedure
  • 6. © Peter R. Egli 2015 6/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 4. RPC system components Main RPC components: The client stub is a proxy object that passes calls to the server stub. The message modules pack and unpack the marshaled arguments in UDP packets. Client: Calling procedure Server: Called procedure Client stub Server stub Network (TCP/IP) Request message Request message Reply message Reply message Results Results Message module Portmapper with Message module Results Results Client stub: Pack arguments (marshal) Server Stub: Unpack arguments (unmarshal) Message modules: Send & receive RPC messages. The portmapper runs as a daemon process (listener process). Server daemon Call with arguments Call with arguments Call with arguments Call with arguments
  • 7. © Peter R. Egli 2015 7/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 5. RPC parameter passing (1/2) Local procedures: The call of a local procedure allows pass-by-value and pass-by-reference. Call by value example (plain old C): int sqrt(int arg0) { return arg0 * arg0; } ... int number = 9; int result; result = sqrt(number); Call-by-reference example (plain old C): struct Arguments { int number0; int number1; } args; struct Arguments args; ... int product(Arguments* args) { return args->number0 * args->number1; } ... int result = product(&args);
  • 8. © Peter R. Egli 2015 8/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 5. RPC parameter passing (2/2) Remote procedures / RPC: RPC only allows pass-by-value because pointers are meaningless in the address space of the remote process. XDR (the RPC Interface Description Language, see below) allows declaring pointers to data structures. But RPC does actually copy-in/copy-out parameter passing (passes full copies of referenced data structures to the remote procedure). Example: XDR file with pointer argument: /* msg.x: Remote msg printing protocol */ struct PrintArgs { char* name; int number; }; program MSGPROG { version PRINTMSGVERS { int PRINTMSG(PrintArgs*) = 1; } = 1; } = 0x20000001; Client application: struct PrintArgs printArgs; int* result; result = printmsg_1(&printArgs, clnt);
  • 9. © Peter R. Egli 2015 9/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 6. Network transport protocol for RPC RPC uses the underlying network just as any other network application. RPC may use connection oriented (TCP, SCTP) or connectionless transport protocols (UDP). Usually RPC uses UDP because UDP (connectionless transport service) better supports the RPC protocol because: 1. RPC interactions are generally short so connections are not really required. 2. Servers generally serve a large number of clients and maintaining state information on connections means additional overhead for the server. 3. LANs are generally reliable so the reliable service of TCP is not needed. Client: Calling procedure Client stub result = printmsg_1(&printArgs, clnt); Message module Socket UDP IP Marshal parameters Request packet Create request message RPC Request message R R+H IPUR+H Server: Called procedure Server stub Message module Socket UDP IP R R+H
  • 10. © Peter R. Egli 2015 10/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com Program number Procedure declaration (procedure number 1) Version of (remote) program (=1 in the example) Name of the (remote) program 7. RPC interface description and code generation (1/2) Interface definition: The server procedure(s) are defined as an interface in a formal language (XDR) and then compiled to source code (plain old C). Elements of XDR (External Data Representation): 1. Interface definition language (IDL). XDR defines procedure signatures (procedure names, parameters with types) and user defined types. 2. Data encoding standard (how to encode data for transmission over the network). XDR defines how to pack simple types like int and string into a byte stream. Example XDR file: /* msg.x: Remote msg printing protocol */ program MESSAGEPROG { version PRINTMESSAGEVERS { int PRINTMESSAGE(string) = 1; } = 1; } = 0x20000001;
  • 11. © Peter R. Egli 2015 11/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 7. RPC interface description and code generation (2/2) Code generation from XDR file: The RPC compiler (ONC RPC: rpcgen) generates all the necessary C source files from the XDR interface specification file (header files, stubs). XDR file RPC compiler C compiler + linker Client appl. Client stub Server proc. Server stub Client executable C compiler + linker Server executable rpcgen Shared header files
  • 12. © Peter R. Egli 2015 12/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 8. RPC procedure call semantics (1/4) Potential problems with RPC calls: a. The request message may be lost (in the network, in the message module). b. The reply message may be lost. c. The server or client may crash during an RPC call. In these cases, it is not clear to the client if the remote procedure has been called or not. RPC incorporates different strategies for handling these situations. Client: Calling procedure Server: Called procedure Client stub Server stub Network (UDP/IP) Message module Message module R R
  • 13. © Peter R. Egli 2015 13/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 8. RPC procedure call semantics (2/4) RPC message delivery strategies: 1. Retry request message: The client retransmits the request message until either a reply is received or the server is assumed to have failed (timeout). 2. Duplicate filtering: The server filters out duplicate request messages when retransmissions are used. 3. Retransmission of replies: The server maintains a history of reply messages. In case of a lost reply message, the server retransmit the reply without re-executing the server operation.
  • 14. © Peter R. Egli 2015 14/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 8. RPC procedure call semantics (3/4) RPC supports 3 different “call semantics” that define the level of guarantee of requests: 1. maybe call semantics. 2. at-least-once call semantics. 3. at-most-once call semantics. RPC mechanisms usually include timeouts to prevent clients waiting indefinitely for reply messages. 1. maybe call semantics: ‱ No retransmission of request messages. ‱ Client is not certain whether the procedure has been executed or not. ‱ No fault-tolerance measures (RPC call may or may not be successful). ‱ Generally not acceptable (low level of guarantee). 2. at-least-once call semantics: ‱ The message module repeatedly resends request messages after timeouts occur until it either gets a reply message or a maximum number of retries have been made. ‱ No duplicate request message filtering. ‱ The remote procedure is called at least once if the server is not down. ‱ The client does not know how many times the remote procedure has been called. This could produce undesirable results (e.g., money transfer) unless the called procedure is “idempotent” (= repeatable with the same effect as a single call).
  • 15. © Peter R. Egli 2015 15/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 8. RPC procedure call semantics (4/4) 3. at-most-once call semantics: ‱ Retransmission of request messages. ‱ Duplicate request message filtering. ‱ If the server does not crash and the client receives the result of a call, then the procedure has been called exactly once. Otherwise, an exception is reported and the procedure will have been called either once or not at all. ‱ Works for both idempotent and non-idempotent operations. ‱ More complex support required due to the need for request message filtering and for keeping track of replies. Comparison of call semantics: Delivery guarantees RPC call semantics Retry request message Duplicate filtering Re-execute procedure or retransmit reply Maybe No Not applicable Not applicable At-least-once Yes No Re-execute procedure At-most-once Yes Yes Retransmit reply
  • 16. © Peter R. Egli 2015 16/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 9. RPC remote procedure location and discovery (1/2) How does the client find the IP address and port of the host hosting the remote procedure? In RPC, binding refers to determining the location and identity of the called procedure. The binder (RPCBIND, formerly portmapper) is a daemon that: - is a registry for registering server procedures on the server, - is a lookup service for the client to get the address of the server procedure host, - runs on the host and listens on a well-known address (port number 111). Client Client stub Binder Message module RPC call bind LookUp LookUp response Message module Server stub Server Register procedure ACK send RPC request call RPC response return HostClient
  • 17. © Peter R. Egli 2015 17/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 9. RPC remote procedure location and discovery (2/2) Static versus dynamic binding: Static binding: ‱ Binds the host address of a server into the client program at compilation time. ‱ Undesirable because the client and server programs are compiled separately and often at different times and the server may be moved from one host to another. Dynamic binding: ‱ Dynamic lookup of the server address (see previous slide). ‱ Allows servers to register and remove their exporting services. ‱ Allows clients to lookup the named service. Binding API: PROCEDURE Register (serviceName:String; serverPort:Port; version:integer) Binder records the service name and server port of a service in its table, together with a version number. PROCEDURE Withdraw (serviceName:String; serverPort:Port; version:integer) Binder removes the service from its table. PROCEDURE LookUp (serviceName:String; version:integer): Port The binder looks up the named service and returns its address (or set of addresses) if the version number agrees with the one stored in its table.
  • 18. © Peter R. Egli 2015 18/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 10. RPC interaction (1/3) RPC allows synchronous and asynchronous interaction. Synchronous RPC: In synchronous RPC, the client is blocked until it received the server reply. Synchronous RPC is the default mode of interaction. Easier to program (no synchronization required on client). Client is blocked during the entire RPC operation (waste of execution time, performance negatively affected). Client Server procedure callrpc() with request Execute procedure return() reply Client is blocked
  • 19. © Peter R. Egli 2015 19/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 10. RPC interaction (2/3) Asynchronous RPC: If a remote procedure does not require a response, the client can send a request to the server without waiting for a reply and continue with its work. The client is not blocked, can continue with its work. Only possible for remote procedures that do not return a result (e.g. send a log message to a log server). Client Server procedure callrpc() with request Server executes the request asynchronously return() Client continues with its work
  • 20. © Peter R. Egli 2015 20/20 Rev. 2.00 SUN / ONC RPC (Remote Procedure Call) indigoo.com 10. RPC interaction (3/3) Deferred synchronous RPC: With deferred synchronous RPC, the client sends a request to the server and only waits for the acceptance of the request. The server executes the request and sends an answer back to the client. This mode is useful in cases where the server procedure requires lengthy computations. Client not blocked, can continue with its work. More complicated synchronization required on the client. Client Server procedure callrpc() with request Server executes the request asynchronously Accept request Client waits for acceptance of request and then continues with its work Return result(s)Client is interrupted, processes the result ACK Each pair of call and reply message is matched by a transaction ID (XID field).