Netprog 2001 - RPC Overview1 Distributed Program Design n Communication-Oriented Design –Design protocol first. –Build programs that adhere to the protocol.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY.
CSE 486/586 Distributed Systems Remote Procedure Call
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
RPC Remote Procedure Call Dave Hollinger Rensselaer Polytechnic Institute Troy, NY.
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.
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.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
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.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
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.
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
Client Server Model and Software Design TCP/IP allows a programmer to establish communication between two application and to pass data back and forth.
1 Network File System. 2 Network Services A Linux system starts some services at boot time and allow other services to be started up when necessary. These.
Linux RPC Comer Chapter 21 (RPCgen Concept) RFC 1057 – RPC Spec. UNIX Network Programming - Stevens 1.
IPv6 Extensions to RPC Sumandra Majee Sun Microsystems Inc.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
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,
CSE 486/586 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
Sun RPC also called ONC (Open Network Computing) RPC originally designed for client-server communication for Sun Network File System (NFS) provides an.
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.
Inter-process communication: Socket. socket Internet socket From Wikipedia, the free encyclopedia Jump to: navigation,
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
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.
Netprog: RPC Programming1 RPC Programming with rpcgen Issues: –Protocol Definition File –Client Programming Creating an "RPC Handle" to a server Calling.
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.
Part 4: Network Applications Client-server interaction, example applications.
Remote Procedure Call RPC
Remote Procedure Call and Serialization BY: AARON MCKAY.
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?
Chap 35 Remote Procedure Calls RPC allows one host to make a procedure call that appears to be part of a local process (fig 35.1), but is really executed.
Remote Procedure Call (Introduction)
1 Remote Procedure Calls External Data Representation (Ch 19) RPC Concept (Ch 20)
Netprog: Client/Server Issues1 Issues in Client/Server Programming Refs: Chapter 27.
Netprog Java RMI1 Remote Method Invocation.
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.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
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
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Chapter 40 Remote Method Invocation
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Distributed Program Design
Issues in Client/Server Programming
Chapter 46 Remote Method Invocation
CS-502, Operating Systems Fall 2009 (EMC)
Chapter 46 Remote Method Invocation
Remote invocation (call)
Java Remote Method Invocation
Last Class: Communication in Distributed Systems
Exceptions and networking
Presentation transcript:

Netprog RPC Overview1 Distributed Program Design n Communication-Oriented Design –Design protocol first. –Build programs that adhere to the protocol. n Application-Oriented Design –Build application(s). –Divide programs up and add communication protocols. TypicalSocketsApproach RPC

Netprog RPC Overview2 RPC Remote Procedure Call n Call a procedure (subroutine) that is running on another machine. n Issues: –identifying and accessing the remote procedure –parameters –return value

Netprog RPC Overview3 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

Netprog RPC Overview4 Sun RPC n There are a number of popular RPC specifications. n Sun RPC (ONC RPC) is widely used. n NFS (Network File System) is RPC based. n Rich set of support tools.

Netprog RPC Overview5 Sun RPC Organization Procedure 1 Procedure 2 Procedure 3 Shared Global Data Remote Program

Netprog RPC Overview6 Procedure Arguments n To reduce the complexity of the interface specification, Sun RPC includes support for a single argument to a remote procedure.* n Typically the single argument is a structure that contains a number of values. * Newer versions can handle multiple args.

Netprog RPC Overview7 Procedure Identification n Each procedure is identified by: –Hostname (IP Address) –Program identifier (32 bit integer) –Procedure identifier (32 bit integer)

Netprog RPC Overview8 Procedure Identification n 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.

Netprog RPC Overview9 Program Identifiers n Each remote program has a unique ID. n Sun divided up the IDs: 0x x1fffffff 0x x3fffffff 0x x5fffffff 0x xffffffff SunSysAdminTransientReserved

Netprog RPC Overview10 Procedure Identifiers & Program Version Numbers n Procedure Identifiers usually start at 1 and are numbered sequentially n Version Numbers typically start at 1 and are numbered sequentially.

Netprog RPC Overview11 Iterative Server n Sun RPC specifies that at most one remote procedure within a program can be invoked at any given time. n If a 2nd procedure is called, the call blocks until the 1st procedure has completed.

Netprog RPC Overview12 Iterative can be good n Having an iterative server is useful for applications that may share data among procedures. n Example: database - to avoid insert/delete/modify collisions. n We can provide concurrency when necessary...

Netprog RPC Overview13 Call Semantics n What does it mean to call a local procedure? –the procedure is run exactly one time. n What does it mean to call a remote procedure? –It might not mean "run exactly once"!

Netprog RPC Overview14 Remote Call Semantics n To act like a local procedure (exactly one invocation per call) - a reliable transport (TCP) is necessary. n Sun RPC does not support reliable call semantics. ! n At Least Once Semantics n Zero or More Semantics

Netprog RPC Overview15 Sun RPC Call Semantics n At Least Once Semantics –if we get a response (a return value) n Zero or More Semantics –if we don't hear back from the remote subroutine.

Netprog RPC Overview16 Remote Procedure deposit() deposit(DavesAccount,$100) n Always remember that you don't know how many times the remote procedure was run! –The net can duplicate the request (UDP).

Netprog RPC Overview17 Network Communication n The actual network communication is nothing new - it's just TCP/IP. n Many RPC implementations are built upon the sockets library. –the RPC library does all the work! n We are just using a different API, the underlying stuff is the same!

Netprog RPC Overview18 Dynamic Port Mapping n Servers typically do not use well known protocol ports! n Clients known the Program ID (and host IP address). n RPC includes support for looking up the port number of a remote program.

Netprog RPC Overview19 Port Lookup Service n A port lookup service runs on each host that contains RPC servers. n RPC servers register themselves with this service: –"I'm program 17 and I'm looking for requests on port 1736"

Netprog RPC Overview20 The portmapper n Each system which will support RPC servers runs a port mapper server that provides a central registry for RPC services. n Servers tell the port mapper what services they offer.

Netprog RPC Overview21 More on the portmapper n Clients ask a remote port mapper for the port number corresponsing to Remote Program ID. n The portmapper is itself an RPC server! n The portmapper is available on a well- known port (111).

Netprog RPC Overview22 Sun RPC Programming n The RPC library is a collection of tools for automating the creation of RPC clients and servers. n RPC clients are processes that call remote procedures. n RPC servers are processes that include procedure(s) that can be called by clients.

Netprog RPC Overview23 RPC Programming n RPC library –XDR routines –RPC run time library »call rpc service »register with portmapper »dispatch incoming request to correct procedure –Program Generator

Netprog RPC Overview24 RPC Run-time Library n High- and Low-level functions that can be used by clients and servers. n High-level functions provide simple access to RPC services.

Netprog RPC Overview25 High-level Client Library int callrpc( char *host, u_long prognum, u_long versnum, u_long procnum, xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);

Netprog RPC Overview26 High-Level Server Library int registerrpc( u_long prognum, u_long versnum, u_long procnum, char *(*procname)() xdrproc_t inproc, xdrproc_t outproc);

Netprog RPC Overview27 High-Level Server Library (cont.) void svc_run(); svc_run() is a dispatcher. svc_run() is a dispatcher. n A dispatcher waits for incoming connections and invokes the appropriate function to handle each incoming request.

Netprog RPC Overview28 High-Level Library Limitation n The High-Level RPC library calls support UDP only (no TCP). n You must use lower-level RPC library functions to use TCP. n The High-Level library calls do not support any kind of authentication.

Netprog RPC Overview29 Low-level RPC Library n Full control over all IPC options –TCP & UDP –Timeout values –Asynchronous procedure calls n Multi-tasking Servers n Broadcasting IPC is InterProcess Communication

Netprog RPC Overview30 RPCGEN n There is a tool for automating the creation of RPC clients and servers. n The program rpcgen does most of the work for you. n The input to rpcgen is a protocol definition in the form of a list of remote procedures and parameter types.

Netprog RPC Overview31 RPCGEN Input File rpcgen Client Stubs XDR filtersheader file Server skeleton C Source Code ProtocolDescription

Netprog RPC Overview32 rpcgen Output Files > rpcgen foo.x foo_clnt.c (client stubs) foo_svc.c (server main) foo_xdr.c (xdr filters) foo.h (shared header file)

Netprog RPC Overview33 Client Creation > gcc -o fooclient foomain.c foo_clnt.c foo_xdr.c n foomain.c is the client main() (and possibly other function) that call rpc services via the client stub functions in foo_clnt.c n The client stubs use the xdr functions.

Netprog RPC Overview34 Server Creation gcc -o fooserver fooservices.c foo_svc.c foo_xdr.c n fooservices.c contains the definitions of the actual remote procedures.

Netprog RPC Overview35 Example Protocol Definition struct twonums { int a; int b; }; program UIDPROG { version UIDVERS { int RGETUID(string ) = 1; string RGETLOGIN( int ) = 2; int RADD(twonums) = 3; } = 1; } = 0x ;