Implementing Remote Procedure Call Landon Cox February 12, 2016.

Slides:



Advertisements
Similar presentations
RPC Robert Grimm New York University Remote Procedure Calls.
Advertisements

Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Distributed systems Programming with threads. Reviews on OS concepts Each process occupies a single address space.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented by Alana Sweat.
Distributed systems Programming with threads. Reviews on OS concepts Each process occupies a single address space.
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.
Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
Outcomes What is RPC? The difference between conventional procedure call and RPC? Understand the function of client and server stubs How many steps could.
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)
CS510 Concurrent Systems Jonathan Walpole. Lightweight Remote Procedure Call (LRPC)
Distributed Systems. Interprocess Communication (IPC) Processes are either independent or cooperating – Threads provide a gray area – Cooperating processes.
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.
Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.
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.
Implementing Remote Procedure Calls Authored by Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presented by Lars Larsson.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Advanced Computer Networks Topic 2: Characterization of Distributed Systems.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
 Remote Procedure Call (RPC) is a high-level model for client-sever communication.  It provides the programmers with a familiar mechanism for building.
CSE 451: Operating Systems Winter 2015 Module 22 Remote Procedure Call (RPC) Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Remote Procedure Call Andy Wang Operating Systems COP 4610 / CGS 5765.
Networking Implementations (part 1) CPS210 Spring 2006.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
Remote Procedure Call RPC
Mark Stanovich Operating Systems COP Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.
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.
Implementing Remote Procedure Calls Andrew D. Birrell and Bruce Jay Nelson 1894 Xerox Palo Alto Research Center EECS 582 – W16.
RPC Model, Stubs and Skeletons Divya Nampalli
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.
Lecture 5: RPC (exercises/questions). 26-Jun-16COMP28112 Lecture 52 First Six Steps of RPC TvS: Figure 4-7.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Implementing Remote Procedure Call
Modularity Most useful abstractions an OS wants to offer can’t be directly realized by hardware Modularity is one technique the OS uses to provide better.
Client-Server Communication
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
CS533 Concepts of Operating Systems
IPC and RPC.
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Sarah Diesburg Operating Systems COP 4610
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
Remote Procedure Call Landon Cox February 7, 2018.
Chapter 40 Remote Method Invocation
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
Chapter 46 Remote Method Invocation
Remote Procedure Call Hank Levy 1.
Chapter 46 Remote Method Invocation
Lecture 6: RPC (exercises/questions)
Remote Procedure Call Hank Levy 1.
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
Remote Procedure Call Hank Levy 1.
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

Implementing Remote Procedure Call Landon Cox February 12, 2016

Modularity so far Procedures as modules What is private and what is shared between procedures? Local variables are private Stack, heap, global variables are shared Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far Procedures as modules How is control transferred between procedures? Caller adds arguments and RA to stack, jumps into callee code Callee sets up local variables, runs code, jumps to RA Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far Procedures as modules Is modularity between procedures enforced? No, either module can corrupt the other No guarantee that callee will return to caller either Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far MULTICS processes as modules What is private, shared btw MULTICS processes? Address spaces are private Segments can be shared Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far MULTICS processes as modules How is control transferred between MULTICS processes? Use synchronization primitives from supervisor Lock/unlock, wait/notify Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far MULTICS processes as modules Is modularity btw MULTICS processes enforced? Yes, modules cannot corrupt private state of the other Isolate shared state inside common segments Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far UNIX processes as modules What is private and what is shared btw UNIX processes? Address spaces are private File system and pipes are shared Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far UNIX processes as modules How is control transferred between UNIX processes? Use synchronization primitives from supervisor Block by reading from pipe, notify by writing to pipe Module 1Module 2 Code Private state Code Private state Shared state

Modularity so far UNIX processes as modules Is modularity between UNIX processes enforced? Yes, modules cannot corrupt private state of the other Protect shared state using pipe buffer and FS access control Module 1Module 2 Code Private state Code Private state Shared state

Network programming Now say two modules are on different machines What is the standard abstraction for communication? Sockets Each end of socket is bound to an pair Module 1Module 2 Code Private state Code Private state Shared state

Network programming Now say two modules are on different machines Which approach to comm. are sockets most like? Most like pipes Use read/write primitives for synchronized access to buffer What are the downsides of socket programming? Adds complexity to a program Blocking conditions depend on data received Data structures copied into and out of messages or streams All of this work can be tedious and error-prone Idea: programmers are used to local procedures Try to make network programming as easy as procedure calls

Remote procedure call (RPC) RPC makes request/response look local Provides the illusion of a function call RPC isn’t a really a function call In a normal call, the PC jumps to the function Function then jumps back to caller This is similar to request/response though Stream of control goes from client to server And then returns back to the client

The RPC illusion How to make send/recv look like a function call? Client wants Send to server to look like calling a function Reply from server to look like function returning Server wants Receive from client to look like a function being called Wants to send response like returning from function

Implementing RPC Primary challenges How to name, locate the remote code to invoke? How to handle arguments containing pointers? How to handle failures?

RPC architecture ClientServer Client code Client stub Server code Server stub RPC runtime RPC runtime Network Interface Who imports and who exports the interface? Import Export

RPC architecture ClientServer Client code Client stub Server code Server stub RPC runtime RPC runtime Network Interface Who defines the interface?The programmer Import Export

RPC architecture ClientServer Client code Client stub Server code Server stub RPC runtime RPC runtime Network Interface Who writes the client and server code?The programmer Import Export

RPC architecture ClientServer Client code Client stub Server code Server stub RPC runtime RPC runtime Network Interface Who writes the stub code?An automated stub generator (rmic in Java) Import Export

RPC architecture ClientServer Client code Client stub Server code Server stub RPC runtime RPC runtime Network Interface Why can stub code be generated automatically?Interface precisely defines behavior What data comes in, what is returned Import Export

RPC architecture ClientServer Client code Client stub Server code Server stub RPC runtime RPC runtime Network Interface Where else have we seen automated control transfer?Compilers + procedure calls Import Export

RPC stub functions call Serve r stub Client stub send recvcall return send recv

RPC stub functions Client stub 1) Builds request message with server function name and parameters 2) Sends request message to server stub Transfer control to server stub: clients-side code is paused 8) Receives response message from server stub 9) Returns response value to client Server stub 3) Receives request message 4) Calls the right server function with the specified parameters 5) Waits for the server function to return 6) Builds a response message with the return value 7) Sends response message to client stub

Binding What is binding? Establishing map from symbolic name  object In an RPC system what needs to be bound? Client code uses interface as a symbolic name RPC system must bind those names to real code instances In Cedar what managed this mapping? The Grapevine distributed database Types are listed as symbolic names Instances are listed as machine addresses

Binding Is anyone allowed to export any interface? No, this is regulated through Grapevine access controls Users allowed to export an interface are explicit in group Only group owner can allow someone to export Is anyone allowed to import an interface? Yes, authentication of clients at higher level What other distributed database is Grapevine like? Domain name service (DNS) Contains mapping from symbolic names to IP addrs Grapevine Group map: interfaces  user ids Individual map: user id  network address

Binding Is anyone allowed to export any interface? No, this is regulated through Grapevine access controls Users allowed to export an interface are explicit in group Only group owner can allow someone to export Is anyone allowed to import an interface? Yes, authentication of clients at higher level Are permissions same or different than DNS? Basically the same DNS updates are controlled DNS retrievals are not Grapevine Group map: interfaces  user ids Individual map: user id  network address

Shared state What is the shared state of the RPC abstraction? Arguments passed through function call What is the actual shared state in RPC? The underlying messages between client and server ClientServer Code Private state Code Private state Shared state

Shared state Why is translating arguments into messages tricky? Data structures have pointers Client and server run in different address spaces Need to ensure that pointer on client = pointer on server ClientServer Code Private state Code Private state Shared state

Shared state How do we ensure that a data structure is safely transferred? Must know the semantics of data structure (typed object references) Must then replace pointers on client with valid pointers on server Requires explicit help of programmer to get right Cannot just pass arbitrary C-style structs and hope to work correctly ClientServer Code Private state Code Private state Shared state

Shared state What about after server code completes? Must synchronize updates to arguments Changes by server must be reflected in client before returning ClientServer Code Private state Code Private state Shared state

Shared state What about multi-threaded client code? Must be handled carefully in RPC systems Client and server cannot synchronize at fine-grain Client threads must not update state accessible to remote server code Have to either partition data or properly lock around RPC call ClientServer Code Private state Code Private state Shared state

Faults With procedures, what happens if a module faults? No isolation, program crashes Result of sharing the same address space With pipes, what happens if a module faults? Faulting module (process) crashes OS makes pipe unreadable and unwritable Cannot just return an error code through client stub Bad idea to overload errors Want to distinguish network failures from incorrectness

Faults How are RPC faults handled in practice? Usually through a software exception Often supported by language So how “pure” is the RPC abstraction? Not totally pure Programmer still knows which calls are local vs remote Have to write code for handling failures So is RPC a good abstraction? In some cases yes, hides a lot of the complexity However, it often comes at a steep performance penalty What part of RPC is slowest? Argument packing and unpacking Java class introspection for shipping data structures is particularly painful

Structuring a concurrent system Talked about two ways to build a system

Alternative structure Can also give cooperating threads own address spaces Each thread is basically a separate process Use messages instead of shared data to communicate Why would you want to do this? Protection Each module runs in its own address space Reasoning behind micro-kernels Each service runs as a separate process Mach from CMU (influenced parts Mac OS X) Vista/Win7’s handling of device drivers

Course administration Project 2 Write a shell Was released yesterday Due in two weeks Questions?