Distributed Systems. How do regular procedure calls work in programming languages? Problems with sockets RPC. Regular procedure calls

Similar documents
Distributed Systems 8. Remote Procedure Calls

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

Remote Procedure Calls (RPC)

Distributed Systems. 03. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Fall 2017

CS 417 9/18/17. Paul Krzyzanowski 1. Socket-based communication. Distributed Systems 03. Remote Procedure Calls. Sample SMTP Interaction

C 1. Recap: Finger Table. CSE 486/586 Distributed Systems Remote Procedure Call. Chord: Node Joins and Leaves. Recall? Socket API

CHAPTER - 4 REMOTE COMMUNICATION

416 Distributed Systems. RPC Day 2 Jan 12, 2018

Remote Procedure Call (RPC) and Transparency

416 Distributed Systems. RPC Day 2 Jan 11, 2017

Today CSCI Communication. Communication in Distributed Systems. Communication in Distributed Systems. Remote Procedure Calls (RPC)

Remote Procedure Calls

REMOTE PROCEDURE CALLS EE324

Last Class: RPCs. Today:

Communication. Distributed Systems Santa Clara University 2016

Distributed Systems Theory 4. Remote Procedure Call. October 17, 2008

Building up to today. Remote Procedure Calls. Reminder about last time. Threads - impl

Overview. Communication types and role of Middleware Remote Procedure Call (RPC) Message Oriented Communication Multicasting 2/36

Administrivia. Remote Procedure Calls. Reminder about last time. Building up to today

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

CSE 358 Spring 2006 Selected Notes Set 8

Communication in Distributed Systems

Operating Systems Design Exam 3 Review: Spring 2011

The RPC abstraction. Procedure calls well-understood mechanism. - Transfer control and data on single computer

Distributed Systems. Lecture 06 Remote Procedure Calls Thursday, September 13 th, 2018

Lecture 8: February 17

Remote Procedure Call

RMI: Design & Implementation

Distributed Systems [Fall 2013]

Lecture 5: Object Interaction: RMI and RPC

CSci Introduction to Distributed Systems. Communication: RPC

Chapter 4 Communication

Two Phase Commit Protocol. Distributed Systems. Remote Procedure Calls (RPC) Network & Distributed Operating Systems. Network OS.

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

CSCI-1680 RPC and Data Representation John Jannotti

Lecture 15: Network File Systems

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

Distributed Systems. The main method of distributed object communication is with remote method invocation

Operating Systems Design Exam 3 Review: Spring Paul Krzyzanowski

Lecture 8: February 19

DISTRIBUTED COMPUTER SYSTEMS

CS454/654 Midterm Exam Fall 2004

Distributed Systems. Lec 4: Remote Procedure Calls (RPC)

Lecture 12 RPC RPC RPC. Writing an RPC Program. Sun RPC RPC. February 9+11, 2005

Remote Procedure Calls CS 707

DISTRIBUTED FILE SYSTEMS & NFS

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

Presentation Services. Presentation Services: Motivation

External Data Representation (XDR)

RPC Paradigm. Lenuta Alboaie Andrei Panu

IPC. Communication. Layered Protocols. Layered Protocols (1) Data Link Layer. Layered Protocols (2)

03 Remote invoaction. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

How do modules communicate? Enforcing modularity. Modularity: client-server organization. Tradeoffs of enforcing modularity

a. Under overload, whole network collapsed iii. How do you make an efficient high-level communication mechanism? 1. Similar to using compiler instead

Distributed Information Processing

Remote Invocation. To do. Request-reply, RPC, RMI. q Today q. q Next time: Indirect communication

COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC)

Distributed Systems. 5. Remote Method Invocation

XDR External Data Representation. XDR as a case study XDR

Remote Invocation. Today. Next time. l Indirect communication. l Request-reply, RPC, RMI

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Pointers (1A) Young Won Lim 2/10/18

SAI/ST course Distributed Systems

Lecture 06: Distributed Object

Communication. Communication. Distributed Systems. Networks and protocols Sockets Remote Invocation Messages Streams. Fall /10/2001 DoCS

Chapter 5: Remote Invocation. Copyright 2015 Prof. Amr El-Kadi

A Report on RMI and RPC Submitted by Sudharshan Reddy B

Desarrollo de Aplicaciones en Red. El modelo de comunicación. General concepts. Models of communication. Message Passing

MODELS OF DISTRIBUTED SYSTEMS

3. Remote Procedure Call

Network Communication and Remote Procedure Calls


Remote Procedure Call Implementations

Remote Procedure Calls

Pointers (1A) Young Won Lim 2/6/18

Chapter 3: Client-Server Paradigm and Middleware

CS 416: Operating Systems Design April 22, 2015

Operating Systems. Week 13 Recitation: Exam 3 Preview Review of Exam 3, Spring Paul Krzyzanowski. Rutgers University.

RPC. Remote Procedure Calls. Robert Grimm New York University

Remote Procedure Call

Chapter IV INTERPROCESS COMMUNICATION. Jehan-François Pâris

Communication. Overview

Networks and Operating Systems Chapter 3: Remote Procedure Call (RPC)

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016

Remote Invocation Vladimir Vlassov and Johan Montelius

Type (1A) Young Won Lim 2/17/18

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Web Services Architecture and Programming

Outline. Interprocess Communication. Interprocess Communication. Communication Models: Message Passing and shared Memory.

Pointers (1A) Young Won Lim 1/22/18

Distributed Systems Lecture 2 1. External Data Representation and Marshalling (Sec. 4.3) Request reply protocol (failure modes) (Sec. 4.

struct foomsg { u_int32_t len; }

RPC and RMI. 2501ICT Nathan

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

Pointers (1A) Young Won Lim 1/14/18

Distributed Systems. Pre-Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2015

Verteilte Systeme (Distributed Systems)

Transcription:

Problems with sockets Distributed Systems Sockets interface is straightforward [connect] read/write [disconnect] Remote Procedure Calls BUT it forces read/write mechanism We usually use a procedure call Paul Krzyzanowski pxk@cs.rutgers.edu Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License. Page 1 To make distributed computing look more like centralized: I/O is not the way to go Page 2 RPC 1984: Birrell & Nelson Mechanism to call procedures on other machines Remote Procedure Call How do regular procedure calls work in programming languages? Goal: it should appear to the programmer that a normal call is taking place Page 3 Page 4 Regular procedure calls Machine instructions for call & return but the compiler really makes the procedure call abstraction work: Parameter passing Local variables Return data 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 5 Page 6 1

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 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 7 Page 8 1. Client calls stub (params on stack) 2. Stub marshals params to net message functions functions functions functions stub stub Page 9 Page 10 3. Network message sent to 4. Receive message: send to stub functions functions functions functions stub stub Page 11 Page 12 2

5. Unmarshal parameters, call func 6. Return from function functions functions functions functions stub stub Page 13 Page 14 7. Marshal return value and send message 8. Transfer message over network functions functions functions functions stub stub Page 15 Page 16 9. Receive message: direct to stub 10. Unmarshal return, return to code functions functions functions functions stub stub Page 17 Page 18 3

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 has issues RPC: presentation layer in OSI model Page 19 Page 20 Parameter passing Pass by value Easy: just copy data to network message Pass by reference Makes no sense without shared memory Pass by reference? 1. Copy items referenced to message buffer 2. Ship them over 3. Unmarshal data at 4. Pass local pointer to stub function 5. Send new values back To support complex structures Copy structure into pointerless representation Transmit Reconstruct structure with local pointers on Page 21 Page 22 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 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 Intel I-32 (x86/pentium) use little endian main() { unsigned int n; char *a = (char *)&n; } n = 0x11223344; 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 23 Page 24 4

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) 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 25 Page 26 Where to bind? Where to bind? Solution 1 Need to locate host and correct process Maintain centralized DB that can locate a host that provides a particular service (Birrell & Nelson s 1984 proposal) Page 27 Page 28 Where to bind? Solution 2 A on each host maintains a DB of locally provided services Solution 1 is problematic for Sun NFS identical file s serve different file systems Transport protocol Which one? Some implementations may offer only one (e.g. TCP) Most support several Allow programmer (or end user) to choose Page 29 Page 30 5

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 When things go wrong Semantics of remote procedure calls Local procedure call: exactly once A remote procedure call may be called: 0 times: crashed or process died before executing code 1 time: everything worked well 1 or more: excess latency or lost reply from and retransmission Page 31 Page 32 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 More issues Performance RPC is slower a lot slower Security messages visible over network Authenticate Authenticate Page 33 Page 34 Programming with RPC Language support Most programming languages (C, C++, Java, ) have no concept of remote procedure calls Language compilers will not generate and stubs Common solution: Use a separate compiler to generate stubs (precompiler) Interface Definition Language Allow programmer to specify remote procedure interfaces (names, parameters, return values) Pre-compiler can use this to generate and stubs: Marshaling code Unmarshaling code Network transport routines Conform to defined interface Similar to function prototypes Page 35 Page 36 6

RPC compiler Writing the program code (main) data conv. compiler Client code has to be modified Initialize RPC-related options Transport type Locate /service Handle failure of remote procedure call IDL RPC compiler headers data conv. compiler Server functions Generally need little or no modification skeleton Code you write functions Code RPC compiler generates Page 37 Page 38 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 / communications using appropriate protocol (establish endpoints) Endpoint operations Listen for requests, export endpoint to name RPC API What kind of services does an RPC system need? Security operations Authenticate / 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 39 Page 40 The end. Page 41 7