Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.

Slides:



Advertisements
Similar presentations
1 Communication in Distributed Systems REKs adaptation of Tanenbaums Distributed Systems Chapter 2.
Advertisements

CSE 486/586 Distributed Systems Remote Procedure Call
RPC Robert Grimm New York University Remote Procedure Calls.
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.
Implementing Remote Procedure Calls Andrew Birrell and Bruce Nelson Presented by Kai Cong.
CS6223: Distributed Systems Remote Procedure Call (RPC)
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.
CS533 - Concepts of Operating Systems 1 Remote Procedure Calls - Alan West.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Communication in Distributed Systems –Part 2
Remote Procedure Calls. 2 Client/Server Paradigm Common model for structuring distributed computations A server is a program (or collection of programs)
.NET Mobile Application Development Remote Procedure Call.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo.
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.
Communication Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
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.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
Chapter 4: Interprocess Communication‏ Pages
 Remote Procedure Call (RPC) is a high-level model for client-sever communication.  It provides the programmers with a familiar mechanism for building.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
IT 344: Operating Systems Winter 2008 Module 19 Networking & Remote Procedure Call (RPC) Chia-Chi Teng CTB 265.
CSE 451: Operating Systems Winter 2015 Module 22 Remote Procedure Call (RPC) Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
IS473 Distributed Systems CHAPTER 5 Distributed Objects & Remote Invocation.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
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.
Remote Procedure Call RPC
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Manish Kumar,MSRITSoftware Architecture1 Remote procedure call Client/server architecture.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
RPC Model, Stubs and Skeletons Divya Nampalli
1 Remote Procedure Calls External Data Representation (Ch 19) RPC Concept (Ch 20)
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
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.
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
Prof. Leonardo Mostarda University of Camerino
CSE 486/586 Distributed Systems Remote Procedure Call
CMSC621: Advanced Operating Systems Advanced Operating Systems
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
DISTRIBUTED COMPUTING
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 Computing
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)
Lecture 7: 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:

Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License.

Page 2 Problems with sockets Sockets interface is straightforward –[connect] –read/write –[disconnect] BUT … it forces read/write mechanism –We usually use a procedure call To make distributed computing look more like centralized: –I/O is not the way to go

Page 3 RPC 1984: Birrell & Nelson –Mechanism to call procedures on other machines Remote Procedure Call Goal: it should appear to the programmer that a normal call is taking place

Page 4 How do regular procedure calls work in programming languages?

Page 5 Regular procedure calls Machine instructions for call & return but the compiler really makes the procedure call abstraction work: –Parameter passing –Local variables –Return data

Page 6 Regular procedure calls You write: x = f(a, “test”, 5); The compiler parses this and generates code to: a.Push the value 5 on the stack b.Push the address of the string “test” on the stack c.Push the current value of a on the stack d.Generate a call to the function f In compiling f, the compiler generates code to: a.Push registers that will be clobbered on the stack to save the values b.Adjust the stack to make room for local and temporary variables c.Before a return, unadjust the stack, put the return data in a register, and issue a return instruction

Page 7 Implementing RPC No architectural support for remote procedure calls Simulate it with tools we have (local procedure calls) Simulation makes RPC a language-level construct instead of an operating system construct

Page 8 Implementing RPC The trick: Create stub functions to make it appear to the user that the call is local Stub function contains the function’s interface

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

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

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

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

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

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

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

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

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

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

Page 19 Benefits Procedure call interface Writing applications is simplified –RPC hides all network code into stub functions –Application programmers don’t have to worry about details Sockets, port numbers, byte ordering RPC: presentation layer in OSI model

Page 20 RPC has issues

Page 21 Parameter passing Pass by value –Easy: just copy data to network message Pass by reference –Makes no sense without shared memory

Page 22 Pass by reference? 1.Copy items referenced to message buffer 2.Ship them over 3.Unmarshal data at server 4.Pass local pointer to server stub function 5.Send new values back To support complex structures –Copy structure into pointerless representation –Transmit –Reconstruct structure with local pointers on server

Page 23 Representing data No such thing as incompatibility problems on local system Remote machine may have: –Different byte ordering –Different sizes of integers and other types –Different floating point representations –Different character sets –Alignment requirements

Page 24 Representing data IP (headers) forced all to use big endian byte ordering for 16 and 32 bit values –Most significant byte in low memory Sparc, 680x0, MIPS, PowerPC G5 x86/Pentiums use little endian main() { unsigned int n; char *a = (char *)&n; n = 0x ; printf("%02x, %02x, %02x, %02x\n", a[0], a[1], a[2], a[3]); } Output on a Pentium: 44, 33, 22, 11 Output on a PowerPC: 11, 22, 33, 44

Page 25 Representing data Need standard encoding to enable communication between heterogeneous systems –e.g. Sun’s RPC uses XDR (eXternal Data Representation) –ASN.1 (ISO Abstract Syntax Notation)

Page 26 Representing data Implicit typing –only values are transmitted, not data types or parameter info –e.g., Sun XDR Explicit typing –Type is transmitted with each value –e.g., ISO’s ASN.1, XML

Page 27 Where to bind? Need to locate host and correct server process

Page 28 Where to bind? – Solution 1 Maintain centralized DB that can locate a host that provides a particular service (Birrell & Nelson’s 1984 proposal)

Page 29 Where to bind? – Solution 2 A server on each host maintains a DB of locally provided services Solution 1 is problematic for Sun NFS – identical file servers serve different file systems

Page 30 Transport protocol Which one? Some implementations may offer only one (e.g. TCP) Most support several –Allow programmer (or end user) to choose

Page 31 When things go wrong Local procedure calls do not fail –If they core dump, entire process dies More opportunities for error with RPC: Transparency breaks here –Applications should be prepared to deal with RPC failure

Page 32 When things go wrong Semantics of remote procedure calls –Local procedure call: exactly once A remote procedure call may be called: –0 times: server crashed or server process died before executing server code –1 time: everything worked well –1 or more: excess latency or lost reply from server and client retransmission

Page 33 RPC semantics Most RPC systems will offer either: –at least once semantics –or at most once semantics Understand application: –idempotent functions: may be run any number of times without harm –non-idempotent functions: side-effects

Page 34 More issues Performance –RPC is slower … a lot slower Security –messages visible over network –Authenticate client –Authenticate server

Page 35 Programming with RPC Language support –Most programming languages (C, C++, Java, …) have no concept of remote procedure calls –Language compilers will not generate client and server stubs Common solution: –Use a separate compiler to generate stubs (pre- compiler)

Page 36 Interface Definition Language Allow programmer to specify remote procedure interfaces (names, parameters, return values) Pre-compiler can use this to generate client and server stubs: –Marshaling code –Unmarshaling code –Network transport routines –Conform to defined interface Similar to function prototypes

Page 37 RPC compiler 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

Page 38 Writing the program Client code has to be modified –Initialize RPC-related options Transport type Locate server/service –Handle failure of remote procedure call Server functions –Generally need little or no modification

Page 39 RPC API What kind of services does an RPC system need? Name service operations –Export/lookup binding information (ports, machines) –Support dynamic ports Binding operations –Establish client/server communications using appropriate protocol (establish endpoints) Endpoint operations –Listen for requests, export endpoint to name server

Page 40 RPC API What kind of services does an RPC system need? Security operations –Authenticate client/server Internationalization operations Marshaling/data conversion operations Stub memory management –Dealing with “reference” data, temporary buffers Program ID operations –Allow applications to access IDs of RPC interfaces

Page 41 The end.