RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY.

Slides:



Advertisements
Similar presentations
RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY.
Advertisements

CSE 486/586 Distributed Systems Remote Procedure Call
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
CS6223: Distributed Systems Remote Procedure Call (RPC)
Lecture 20 Remote Procedure Call eXternal Data Representation CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Distributed Systems Lecture #3: Remote Communication.
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
Remote Procedure Call Chin-Chih Chang. Remote Procedure Call Remote Procedure Call (RPC) is a protocol that allows programs to call procedures located.
Introduction to Remote Method Invocation (RMI)
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Practical Issues of RPCCS-4513, D-Term Remote Procedure Call Practical Issues CS-4513 Distributed Computing Systems (Slides include materials from.
Netprog RPC Overview1 Distributed Program Design n Communication-Oriented Design –Design protocol first. –Build programs that adhere to the protocol.
EEC-681/781 Distributed Computing Systems Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
.NET Mobile Application Development Remote Procedure Call.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Remote Procedure CallCS-502 Fall Remote Procedure Call CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System Concepts,
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Other Topics RPC & Middleware.
1 Chapter 38 RPC and Middleware. 2 Middleware  Tools to help programmers  Makes client-server programming  Easier  Faster  Makes resulting software.
Remote Procedure Call Andrew Whitaker CSE451. Remote Procedure Call RPC exposes a programming interface across machines: interface PriceService { Price.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
Distributed (Operating) Systems -Communication in Distributed Systems- Fall 2011 Kocaeli University Computer Engineering Department.
Chapter 4: Interprocess Communication‏ Pages
1 XDR External Data Representation Process A XDR Encode/Decode Transport Process B XDR Encode/Decode Transport.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
CSE 451: Operating Systems Winter 2015 Module 22 Remote Procedure Call (RPC) Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Netprog: RPC Programming1 RPC Programming with rpcgen Issues: –Protocol Definition File –Client Programming Creating an "RPC Handle" to a server Calling.
Remote Procedure Calls CS587x Lecture Department of Computer Science Iowa State University.
Remote Procedure CallCS-502 Fall Remote Procedure Call (continued) CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Remote Procedure Call RPC
1 Chapter 38 RPC and Middleware. 2 Middleware  Tools to help programmers  Makes client-server programming  Easier  Faster  Makes resulting software.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
Distributed objects and remote invocation Pages
1 Remote Procedure Calls External Data Representation (Ch 19) RPC Concept (Ch 20)
Distributed Systems Lecture 8 RPC and marshalling 1.
Computer Science Lecture 4, page 1 CS677: Distributed OS Last Class: RPCs RPCs make distributed computations look like local computations Issues: –Parameter.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
CSE 486/586 Distributed Systems Remote Procedure Call
MCA – 405 Elective –I (A) Java Programming & Technology
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Distributed Program Design
XDR External Data Representation
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Spring 2012 Module 22 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CS-502, Operating Systems Fall 2009 (EMC)
Lecture 6: RPC (exercises/questions)
Remote invocation (call)
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 6: RPC (exercises/questions)
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY

Y KermarrecNetprog: RPC Overvie w 2 Distributed Program Design Communication-Oriented Design Design protocol first. Build programs that adhere to the protocol. Application-Oriented Design Build application(s). Divide programs up and add communication protocols. TypicalSocketsApproach RPC

Y KermarrecNetprog: RPC Overvie w 3 RPC Remote Procedure Call Call a procedure (subroutine) that is running on another machine. Issues: identifying and accessing the remote procedure parameters return value

Y KermarrecNetprog: RPC Overvie w 4 blah, blah, blah bar = foo(a,b); blah, blah, blah bar = foo(a,b); blah, blah, blah int foo(int x, int y ) { if (x>100) return(y-2); else if (x>10) return(y-x); else return(x+y); } int foo(int x, int y ) { if (x>100) return(y-2); else if (x>10) return(y-x); else return(x+y); } Client Server protocol Remote Subroutine

Y KermarrecNetprog: RPC Overvie w 5 Sun RPC There are a number of popular RPC specifications. Sun RPC (ONC RPC) is widely used. NFS (Network File System) is RPC based. Rich set of support tools.

Y Kermarrec Classic Procedure Call Call Stack Parameter Passing Error and exception Semantics

Y Kermarrec Implementing RPC Seems to be complex as we need to go through the network The trick: Create stub functions to make it appear to the user that the call is local Stub function contains the function’s interface

Y Kermarrec clientserver Stub functions network routines server functions server stub (skeleton) network routines 1. Client calls stub (params on stack) client functions client stub

Y Kermarrec clientserver Stub functions server functions server stub (skeleton) network routines 2. Stub marshals params to net message client functions client stub network routines

Y Kermarrec clientserver Stub functions 3. Network message sent to server client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec clientserver Stub functions 4. Receive message: send to stub client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec clientserver Stub functions 5. Unmarshal parameters, call server func client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec clientserver Stub functions 6. Return from server function client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec clientserver Stub functions 7. Marshal return value and send message client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec clientserver Stub functions 8. Transfer message over network client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec clientserver Stub functions 9. Receive message: direct to stub client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec clientserver Stub functions 10. Unmarshal return, return to client code client functions client stub network routines server functions server stub (skeleton) network routines

Y Kermarrec RPCL : an example program MESSAGE_PROG { version MESSAGE_VERS { int PRINT_MESSAGE (string) = 1 ; } = 1 ; } = 0x ;

Y KermarrecNetprog: RPC Overvie w 19 Procedure Arguments To reduce the complexity of the interface specification, Sun RPC includes support for a single argument to a remote procedure.* Typically the single argument is a structure that contains a number of values (the parameters). * Newer versions can handle multiple args.

Y KermarrecNetprog: RPC Overvie w 20 Procedure Identification Each procedure is identified by: Hostname (IP Address) Program identifier (32 bit integer) Procedure identifier (32 bit integer) –Program Version identifier »for testing and migration »Used also to detect out dated version of a server

Y KermarrecNetprog: RPC Overvie w 21 Procedure Identifiers & Program Version Numbers Procedure Identifiers usually start at 1 and are numbered sequentially Version Numbers typically start at 1 and are numbered sequentially. Service number is coded on 32 bits Possible user value range : 0x à 0x 3fff ffff

Y KermarrecNetprog: RPC Overvie w 22 Iterative Server Sun RPC specifies that at most one remote procedure within a program can be invoked at any given time. If a 2nd procedure is called, the call blocks until the 1st procedure has completed.

Y KermarrecNetprog: RPC Overvie w 23 Call Semantics What does it mean to call a local procedure? the procedure is run exactly one time. What does it mean to call a remote procedure? It might not mean "run exactly once"!

Y KermarrecNetprog: RPC Overvie w 24 Remote Call Semantics To act like a local procedure (exactly one invocation per call) - a reliable transport (TCP) is necessary. Sun RPC does not support reliable call semantics. "At Least Once" Semantics "Zero or More" Semantics

Y KermarrecNetprog: RPC Overvie w 25 Sun RPC Call Semantics At Least Once Semantics if we get a response (a return value) Zero or More Semantics if we don't hear back from the remote subroutine.

Y KermarrecNetprog: RPC Overvie w 26 Remote Procedure deposit() deposit(DavesAccount,$100) Always remember that you don't know how many times the remote procedure was run! The net can duplicate the request (UDP).

Y KermarrecNetprog: RPC Overvie w 27 Network Communication The actual network communication is nothing new - it's just TCP/IP. Many RPC implementations are built upon the sockets library. the RPC library does all the work! The programmer may select UDP or TCP based on his/her requirements

Y KermarrecNetprog: RPC Overvie w 28 Dynamic Port Mapping How to determine where the server is waiting requests ? Servers typically do not use well known protocol ports Clients know the Program ID (and host IP address). RPC includes support for looking up the port number of a remote program.

Y KermarrecNetprog: RPC Overvie w 29 The portmapper Each system which will support RPC servers runs a port mapper server that provides a central registry for RPC services. Servers tell the port mapper what services they offer.

Y KermarrecNetprog: RPC Overvie w 30 More on the portmapper Clients ask a remote port mapper for the port number corresponding to Remote Program ID. The portmapper is itself an RPC server! The portmapper is available on a well-known port (111).

Y KermarrecNetprog: RPC Overvie w 31 RPCGEN There is a tool for automating the creation of RPC clients and servers. The program rpcgen does most of the work for you. The input to rpcgen is a protocol definition in the form of a list of remote procedures and parameter types.

Y Kermarrec Protocol Definition: simp.x struct operands { int x; int y; }; program SIMP_PROG { version SIMP_VERSION { int ADD(operands) = 1; int SUB(operands) = 2; } = VERSION_NUMBER; } = ; RPC Programming32

Y KermarrecNetprog: RPC Overvie w 33 RPCGEN Input File rpcgen Client Stubs XDR filtersheader file Server skeleton C Source Code ProtocolDescription

Y KermarrecNetprog: RPC Overvie w 34 rpcgen Output Files > rpcgen –C foo.x foo_clnt.c (client stubs) foo_svc.c (server main) foo_xdr.c (xdr filters) foo.h (shared header file)

Y Kermarrec RPC compiler in action IDL RPC compiler client code (main) server functions client stub headers server skeleton data conv. compiler server client Code you write Code RPC compiler generates

Y Kermarrec XDR Powerful paradigm for creation and transfer of complex data structures XDR provides a service associated with the OSI Presentation Layer. Common data representation Library -not part of the O.S. Easy to port to new architectures Independence from transport layer XDR36

Y Kermarrec Data Conversion Asymmetric Data Conversion client always converts to the server’s data representation. Symmetric Data Conversion both client and server convert to/from some standard representation. XDR is Symmetric Data Conversion XDR37

Y Kermarrec Implicit vs. Explicit Typing Explicit typing each piece of data includes information about the type Implicit typing the sender and receiver must agree on the order and type of all data XDR uses Implicit Typing XDR38

Y Kermarrec XDR Data Types boolean char short int long float double XDR39  enumeration  structure  string  fixed length array (1-D)  variable length array (1-D)  union  opaque data

Y Kermarrec XDR Programming XDR libraries are based on a stream paradigm The process of converting local data to XDR also puts the data in the XDR stream When extracting an item from a stream, conversion is done to the local representation Streams can be attached to a file, pipe, socket or memory Individual data items are added to (removed from) the stream one at a time XDR40

Y Kermarrec Conversion Terminology Converting from local representation to XDR representation is called Encoding. Converting from XDR representation to local representation is called Decoding. XDR41 Sender Receiver XDR ENCODE DECODE

Y Kermarrec Information for the labs You are going to experiment : how to go from a classic procedure call to an RPC How to run a server and activate clients calls What is the magic (the work of rpcgen) behind the scene in terms of socket management, connections, errors and fault detection. Get the initial insights for all the other paradigms (distributed object, Java RMI, web services…) work and are handled

Y Kermarrec Survey RPC is a powerful way to program distributed system quite easily It was initialy an OS feature that has been moved to the programmer’s world Numerous benefits in terms of transparencies and above all fault tolerance