CMSC621: Advanced Operating Systems Advanced Operating Systems

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
Communication Dr. Ying Lu CSCE455/855 Distributed Operating Systems.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
L-7 RPC 1. Last Lecture Important Lessons - Naming Naming is a powerful tool in system design  A layer of indirection can solve many problems Name+context.
Outcomes What is RPC? The difference between conventional procedure call and RPC? Understand the function of client and server stubs How many steps could.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Remote Procedure Calls. 2 Client/Server Paradigm Common model for structuring distributed computations A server is a program (or collection of programs)
EECS122 - UCB 1 CS 194: Distributed Systems Communication Protocols, RPC Computer Science Division Department of Electrical Engineering and Computer Sciences.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W
1 Chapter 2. Communication. STEM-PNU 2 Layered Protocol TCP/IP : de facto standard Our Major Concern Not always 7-layered Protocol But some other protocols.
Communication Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
Problems with Send and Receive Low level –programmer is engaged in I/O –server often not modular –takes 2 calls to get what you want (send, followed by.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
(a) Parameter passing in a local procedure call: the stack before the call (b) The stack while the called procedure is active. count =
Politecnico di Milano © 2001 William Fornaciari Operating Systems R P C Remote Procedure Call Lecturer: William Fornaciari Politecnico di Milano
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
 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.
Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
1 Developing Application in Distributed Computing Environment (DCE)
Remote Procedure Call Andy Wang Operating Systems COP 4610 / CGS 5765.
1 Conventional Procedure Call read(fd,buf,nbytes) a)Parameter passing in a local procedure call: the stack before the call to read b)The stack while the.
Remote Procedure Call RPC
Mark Stanovich Operating Systems COP Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
OS2-SUT– Sem ; R. Jalili Communication Chapter 2.
RPC Model, Stubs and Skeletons Divya Nampalli
1 Chapter 2. Communication. STEMPusan National University STEM-PNU 2 Layered Protocol TCP/IP : de facto standard Our Major Concern Not always 7-layered.
Computer Science Lecture 4, page 1 CS677: Distributed OS Last Class: RPCs RPCs make distributed computations look like local computations Issues: –Parameter.
Lecture 5: RPC (exercises/questions). 26-Jun-16COMP28112 Lecture 52 First Six Steps of RPC TvS: Figure 4-7.
OS2-Sharif University of Technology - Sem ; R. Jalili Communication Chapter 2.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
Prof. Leonardo Mostarda University of Camerino
CSE 486/586 Distributed Systems Remote Procedure Call
Remote Procedure Calls
Dave Eckhardt RPC Dave Eckhardt
IPC and RPC.
Remote Procedure Call present by :Enas Alkhoshi
Distributed Systems CS
Communication Chapter 2.
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Outline Communication Primitives - continued Theoretical Foundations
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Sarah Diesburg Operating Systems COP 4610
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
Remote Procedure Call (RPC) RPC – RMI - Web Services.
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Remote Procedure Call Hank Levy 1.
CS-502, Operating Systems Fall 2009 (EMC)
Lecture 6: RPC (exercises/questions)
Distributed Systems CS
Remote Procedure Call Hank Levy 1.
Lecture 6: RPC (exercises/questions)
Lecture 7: RPC (exercises/questions)
Remote Procedure Call Hank Levy 1.
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Distributed Systems CS
Presentation transcript:

CMSC621: Advanced Operating Systems Advanced Operating Systems Nilanjan Banerjee Associate Professor, University of Maryland Baltimore County nilanb@umbc.edu http://www.csee.umbc.edu/~nilanb/teaching/621/ Slide Credit: Dr. Ying Lu Advanced Operating Systems

Client-Server Communication Assume that you are developing a client-server application: How to let the two processes (client and server) located on two machines communicate with each other? Socket programming: using functions like connect(sd, (struct sockaddr *)&sin, sizeof(sin)), write(sd, buf, strlen(buf)) etc.

Remote Procedure Calls (RPC) Avoid explicit message exchange between processes Basic idea is to allow a process on a machine to call procedures on a remote machine Make a remote procedure possibly look like a local one Original paper on RPC: A. Birrell, B Nelson, “Implementing Remote Procedure Calls”, ACM Symposium on Operating System Principles, 1984

Conventional Procedure Call How are parameters passed in a local procedure call E.g., #include <sys/types.h> #include <unistd.h> ... char buf[20]; size_t nbytes; ssize_t bytes_read; int fd; nbytes = sizeof(buf); bytes_read = read(fd, buf, nbytes);

Conventional Procedure Call http://linux.die.net/man/2/read Figure 4-5. (a) Parameter passing in a local procedure call: the stack before the call to read. (b) The stack while the called procedure is active.

Remote Procedure Calls (RPC) How are parameter passed in a remote procedure call, while making it look like a local procedure call?

Client and Server Stubs Principle of RPC between a client and server program.

Steps of a Remote Procedure Call Client procedure calls client stub in normal way Client stub builds message, calls local OS Client's OS sends message to remote OS Remote OS gives message to server stub Server stub unpacks parameters, calls server Server does work, returns result to the stub Server stub packs it in message, calls local OS Server's OS sends message to client's OS Client's OS gives message to client stub Stub unpacks result, returns to client

Passing Value Parameters (1) 2-8 Steps involved in doing remote computation through RPC

Passing Value Parameters (2) The usual contrast is between most versus least significant byte first, called big-endian and little-endian respectively.

Passing Value Parameters (3) Original message on the Pentium (little-endian) The message after receipt on the SPARC (big-endian) Note: the little numbers in boxes indicate the address of each byte

Passing Value Parameters (3) Original message on the Pentium (little-endian) The message after receipt on the SPARC (big-endian) The message after being inverted (integer 5, string: “LLIJ”) Note: the little numbers in boxes indicate the address of each byte

Passing reference parameters What is Call By Value and Call By Refernce? Example: call foo(int, int * ) or read(fd, buf, nbytes) Call by copy/restore The dreaded “pointer problem” Linked list Complex graph a b a’ b’ foo(a, &b ) Call foo(a, &b’ ) Copy value a and contents of loc b into a’ and loc b’ Return Copy contents of loc b’ into b Machine A Machine B

Marshalling Values must match cross the network Machine formats differ Integer byte order Little-endian or big-endian Floating point format IEEE 754 or not Marshalling  transferring data structure used in remote procedure call from one address space to another. Define a “network format”, for example following XDR (eXternal Data Representation) standard http://www.ietf.org/rfc/rfc1832.txt

RPC: The basic mechanism Client calls a local procedure on the client stub The client stub acts as a proxy and marshalls the call and the args. The client stub send this to the remote system (via TCP/UDP) The server stub unmarshalls the call and args from the client The server stub calls the actual procedure on the server The server stub marshalls the reply and sends it back to the client Client process Server process Client routines Server routines 1 5 Client stub Server stub 2 4 RPC runtime RPC runtime Process Process kernel kernel 3 6 Network routines Network routines Source: R. Stevens, Unix Network Programming (IPC) Vol 2, 1998

Binding a Client to a Server (1) Registration of a server makes it possible for a client to locate the server and bind to it. Server location is done in two steps: Locate the server’s machine. Locate the server on that machine.

Binding a Client to a Server (2) Figure 4-13. Client-to-server binding in DCE.

Asynchronous RPC (1) 2-12 The interconnection between client and server in a traditional RPC The interaction using asynchronous RPC

A client and server interacting through two asynchronous RPCs 2-13 One-Way RPC: The client invokes a remote procedure but it does not block or wait until it receives a return.

Client and server fail independently LPC v.s. RPC Global variables Client and server fail independently RPC: requires code to deal with server crashes

Semantics of remote procedure calls When Things Go Wrong Semantics of remote procedure calls Local procedure call: exactly once How many times a remote procedure call may be called? A remote procedure call may be called: 0 time: server crashed or server process died before executing server code 1 time: everything worked well 1 or more: due to excess latency or lost reply from server, client retransmitted Exactly once may be difficult to achieve with RPC

Most RPC systems will offer either: RPC Semantics Most RPC systems will offer either: at least once semantics or at most once semantics Understand application: Illustrate some applications that “at least once” is suitable? Idempotent functions: may be run any number of times without harm Illustrate some applications that “at most once” is suitable? At-most-once call semantics are for those RPC applications which require a guarantee that multiple invocations of the same RPC call by a client will not be processed on the server. An example of such an application is inventory control. Consider several point-of-sale (POS) workstations and a server which maintains inventory records. Each POS workstation makes an RPC call to the server when an item is sold. The call causes a count of the number of items left in the inventory to be decremented on the server. If a call indicating that five of the item X was sold is processed on the server more than once, then the inventory record for item X will be in error.