CS-502, Operating Systems Fall 2009 (EMC)

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

1 Communication in Distributed Systems REKs adaptation of Tanenbaums Distributed Systems Chapter 2.
CSE 486/586 Distributed Systems Remote Procedure Call
RPC Robert Grimm New York University Remote Procedure Calls.
Remote Procedure Call Design issues Implementation RPC programming
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.
Implementing Remote Procedure Calls Andrew Birrell and Bruce Nelson Presented by Kai Cong.
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
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.
Outcomes What is RPC? The difference between conventional procedure call and RPC? Understand the function of client and server stubs How many steps could.
Practical Issues of RPCCS-4513, D-Term Remote Procedure Call Practical Issues CS-4513 Distributed Computing Systems (Slides include materials from.
Remote Procedure CallCS-4513 D-term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System Concepts,
EEC-681/781 Distributed Computing Systems Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Remote Procedure Calls. 2 Client/Server Paradigm Common model for structuring distributed computations A server is a program (or collection of programs)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Remote Procedure CallCS-502 Fall Remote Procedure Call CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System Concepts,
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Other Topics RPC & Middleware.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W
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.
(a) Parameter passing in a local procedure call: the stack before the call (b) The stack while the called procedure is active. count =
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
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,
Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
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
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
09/14/05 1 Implementing Remote Procedure Calls* Birrell, A. D. and Nelson, B. J. Presented by Emil Constantinescu *ACM Trans. Comput. Syst. 2, 1 (Feb.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Computer Science Lecture 4, page 1 CS677: Distributed OS Last Class: RPCs RPCs make distributed computations look like local computations Issues: –Parameter.
Assignment 2 Multithreading/Synchronization UDP – How to maintain connections Testing: Mentioning test cases Plagiarism.
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.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
Prof. Leonardo Mostarda University of Camerino
CSE 486/586 Distributed Systems Remote Procedure Call
Remote Procedure Call present by :Enas Alkhoshi
CMSC621: Advanced Operating Systems Advanced Operating Systems
Communication Chapter 2.
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 Program Design
Remote Procedure Call (RPC) RPC – RMI - Web Services.
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Networks & Communication (continued)
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
Remote Procedure Call Hank Levy 1.
An Introduction to Internetworking
Remote invocation (call)
Remote Procedure Call Hank Levy 1.
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 7: RPC (exercises/questions)
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
Remote Procedure Call Hank Levy 1.
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

CS-502, Operating Systems Fall 2009 (EMC) Remote Procedure Call Assumptions: Graduate level Operating Systems Making Choices about operation systems Why a micro-century? …just about enough time for one concept CS-502, Operating Systems Fall 2009 (EMC) (Slides include materials from Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne, Distributed Systems: Principles & Paradigms, 2nd ed. By Tanenbaum and Van Steen, and Modern Operating Systems, 3nd ed., by Tanenbaum) CS-502 (EMC) Fall 2009 Remote Procedure Call

Review Definition — Protocol Formal set of rules that govern the formats, contents, and meanings of messages from computer to computer, process to process, etc. Must be agreed to by all parties to a communication May be defined in terms of other protocols E.g., 7-layer OSI model CS-502 (EMC) Fall 2009 Remote Procedure Call

Message-oriented Protocols Many in widespread use Traditional TCP/IP and Internet protocols Difficult to design and implement Especially with more sophisticated applications Many difficult implementation issues for each new protocol and each platform Formatting Uniform representation of data Client-server relationships … CS-502 (EMC) Fall 2009 Remote Procedure Call

Problem How to make sense out of many different kinds of protocols How to design new protocols for new, more sophisticated applications How to automate the nitty-gritty of protocol design and testing CS-502 (EMC) Fall 2009 Remote Procedure Call

Solution — Remote Procedure Call (RPC) The most common framework for newer protocols and for middleware Used both by operating systems and by applications NFS (Network File System) is implemented as a set of RPCs DCOM, CORBA, Java RMI, etc., are just RPC systems Reference Birrell, Andrew D., and Nelson, Bruce, “Implementing Remote Procedure Calls,” ACM Transactions on Computer Systems, vol. 2, #1, February 1984, pp 39-59. (.pdf) CS-502 (EMC) Fall 2009 Remote Procedure Call

Remote Procedure Call (RPC) Fundamental idea: – Server process exports an interface of procedures or functions that can be called by client programs similar to library API, class definitions, etc. Clients make local procedure/function calls As if directly linked with the server process Under the covers, procedure/function call is converted into a message exchange with remote server process CS-502 (EMC) Fall 2009 Remote Procedure Call

Ordinary procedure/function call count = read(fd, buf, bytes) CS-502 (EMC) Fall 2009 Remote Procedure Call

Remote Procedure Call Would like to do the same if called procedure or function is on a remote server CS-502 (EMC) Fall 2009 Remote Procedure Call

Solution — a pair of Stubs A client-side stub is a function that looks to the client as if it were a callable function of the service I.e., same API as the service’s implementation of the function A service-side stub looks like a client calling the service I.e., like a hunk of code invoking the service function The client program thinks it’s invoking the service but it’s calling into the client-side stub The service program thinks it’s called by the client but it’s really called by the service-side stub The stubs send messages to each other to make the RPC happen transparently (almost!) CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC Stubs Tanenbaum & Van Steen, Fig 4-7 CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC Stubs – Summary Client-side stub Server-side stub Looks like local server function to the client Same interface as local function Bundles arguments into a message, sends to server-side stub Waits for reply, un-bundles results returns Server-side stub Looks like local client function to server Listens on a socket for message from client stub Un-bundles arguments to local variables Makes a local function call to server Bundles result into reply message to client stub CS-502 (EMC) Fall 2009 Remote Procedure Call

Result – a very useful Abstraction The hard work of building messages, formatting, uniform representation, etc., is buried in the stubs Where it can be automated! Designers of client and server can concentrate on semantics of application Programs behave in familiar way CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC – Issues How to make the “remote” part of RPC invisible to the programmer? What are semantics of parameter passing? E.g., pass by reference? How to bind (locate & connect) to servers? How to handle heterogeneity? OS, language, architecture, … How to make it go fast? CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC Model A server defines the service interface using an interface definition language (IDL) the IDL specifies the names, parameters, and types for all client-callable server functions A stub compiler reads the IDL declarations and produces two stub functions for each server function Server-side and client-side CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC Model (continued) Linking:– Operation:– Server programmer implements the service’s functions and links with the server-side stubs Client programmer implements the client program and links it with client-side stubs Operation:– Stubs manage all of the details of remote communication between client and server CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC Stubs Tanenbaum & Van Steen, Fig 4-7 CS-502 (EMC) Fall 2009 Remote Procedure Call

Marshalling and Unmarshalling Arguments the packing of function parameters into a message Unmarshalling the extraction of parameters from a message Function call:– Client stub marshals the arguments into message Server stub unmarshals the arguments and uses them to invoke the service function Function return:– Server stub marshals return values into message Client stub unmarshals return values and returns them as results to client program CS-502 (EMC) Fall 2009 Remote Procedure Call

Issue #1 — representation of data Big endian vs. little endian Sent by Pentium Rec’d by SPARC After inversion CS-502 (EMC) Fall 2009 Remote Procedure Call

Representation of Data (continued) IDL must also define representation of data on network Multi-byte integers Strings, character codes Floating point, complex, … … example: Sun’s XDR (eXternal Data Representation) Each stub converts machine representation to/from network representation Clients and servers must not try to cast data! CS-502 (EMC) Fall 2009 Remote Procedure Call

Issue #2 — Pointers and References read(int fd, char* buf, int nbytes) Pointers are only valid within one address space Cannot be interpreted by another process Even on same machine! Pointers and references are ubiquitous in C, C++ Even in Java implementations! CS-502 (EMC) Fall 2009 Remote Procedure Call

Pointers and References — Restricted Semantics Option: call by value Sending stub dereferences pointer, copies result to message Receiving stub conjures up a new pointer Option: call by result Sending stub provides buffer, called function puts data into it Receiving stub copies data to caller’s buffer as specified by pointer CS-502 (EMC) Fall 2009 Remote Procedure Call

Pointers and References — Restricted Semantics (continued) Option: call by value-result Caller’s stub copies data to message, then copies result back to client buffer Server stub keeps data in own buffer, server updates it; server sends data back in reply Not allowed:– Call by reference Aliased arguments CS-502 (EMC) Fall 2009 Remote Procedure Call

Transport of Remote Procedure Call Option — TCP Connection-based, reliable transmission Useful but heavyweight, less efficient Necessary if repeating a call produces different result Alternative — UDP Unreliable transmission If message fails to arrive within a reasonable time, caller’s stub simply sends it again Okay if repeating a call produces same result CS-502 (EMC) Fall 2009 Remote Procedure Call

Asynchronous RPC Analogous to spawning a thread Caller must eventually wait for result Analogous to join CS-502 (EMC) Fall 2009 Remote Procedure Call

Asynchronous RPC (continued) Analogous to spawning a thread Caller must eventually wait for result Analogous to join Or be interrupted (software interrupt) CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC Binding Binding is the process of connecting the client to the server the server, when it starts up, exports its interface identifies itself to a network name server tells RPC runtime that it is alive and ready to accept calls the client, before issuing any calls, imports the server RPC runtime uses the name server to find the location of the server and establish a connection The import and export operations are explicit in the server and client programs CS-502 (EMC) Fall 2009 Remote Procedure Call

Remote Procedure Call is used … Between processes on different machines E.g., client-server model Between processes on the same machine More structured than simple message passing Between subsystems of an operating system Windows XP (called Local Procedure Call) CS-502 (EMC) Fall 2009 Remote Procedure Call

Questions? CS-502 (EMC) Fall 2009 Remote Procedure Call

Practical RPC Systems DCE (Distributed Computing Environment) Open Software Foundation Basis for Microsoft DCOM Tanenbaum & Van Steen, §4.2.4 Sun’s ONC (Open Network Computing) Very similar to DCE Widely used rpcgen http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-Q0R5B-TET1_html/TITLE.html CS-502 (EMC) Fall 2009 Remote Procedure Call

Practical RPC Systems (continued) Java RMI (Remote Method Invocation) java.rmi standard package Java-oriented approach — objects and methods CORBA (Common Object Request Broker Architecture) Standard, multi-language, multi-platform middleware Object-oriented Heavyweight … CS-502 (EMC) Fall 2009 Remote Procedure Call

Implementation Model for ONC program & version # program & version # XDR rpcgen CS-502 (EMC) Fall 2009 Remote Procedure Call

Validating a Remote Service Purpose Avoid binding to wrong service or wrong version DCE Globally unique ID Generated in template of IDL file Sun ONC Program numbers registered with Sun Version # and procedure # administered locally CS-502 (EMC) Fall 2009 Remote Procedure Call

RPC Binding — Sun ONC Service registers with portmapper service on server OS Program # and version # Optional static port # Client Must know host name or IP address clnt_create(host, prog, vers, proto) I.e., RPC to portmapper of host requesting to bind to prog, vers using protocol proto (tcp or udp) (Additional functions for authentication, etc.) Invokes remote functions by name CS-502 (EMC) Fall 2009 Remote Procedure Call

Sun ONC (continued) See also #include <rpc/rpc.h> rpcgen Header file for client and server rpcgen The stub compiler Compiles interface.x Produces .h files for client and service; also stubs See also rpcinfo RPC Programming Guide CS-502 (EMC) Fall 2009 Remote Procedure Call

Note on XDR (the Interface Definition Language for ONC) Much like C header file Exceptions string type – maps to char * bool type – maps to bool_t CS-502 (EMC) Fall 2009 Remote Procedure Call

Sun ONC Online tutorial Code samples Any other resources you can find http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-Q0R5B-TET1_html/TITLE.html Code samples http://web.cs.wpi.edu/~rek/DCS/D04/SunRPC.html http://web.cs.wpi.edu/~goos/Teach/cs4513-d05/ http://web.cs.wpi.edu/~cs4513/b05/week4-sunrpc.pdf Any other resources you can find CS-502 (EMC) Fall 2009 Remote Procedure Call

Next Topic — Distributed File Systems Questions? Next Topic — Distributed File Systems CS-502 (EMC) Fall 2009 Remote Procedure Call