Computing Systems 15, 2015 Next up Client-server model RPC Mutual exclusion.

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
Spring Remote Procedure Call (5.3) Outline Protocol Stack Presentation Formatting.
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.
Jan 28, 2003CS475: Internetworking with UNIX TCP/IP1 XDR, RPC, NFS Internetworking with UNIX TCP/IP Winter
Outcomes What is RPC? The difference between conventional procedure call and RPC? Understand the function of client and server stubs How many steps could.
16: Distributed Systems1 DISTRIBUTED SYSTEM STRUCTURES NETWORK OPERATING SYSTEMS The users are aware of the physical structure of the network. Each site.
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.
EECS122 - UCB 1 CS 194: Distributed Systems Communication Protocols, RPC Computer Science Division Department of Electrical Engineering and Computer Sciences.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00 – 6:00 PM.
Networked File System CS Introduction to Operating Systems.
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.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Chapter 4: Interprocess Communication‏ Pages
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.
NFS : Network File System SMU CSE8343 Prof. Khalil September 27, 2003 Group 1 Group members: Payal Patel, Malka Samata, Wael Faheem, Hazem Morsy, Poramate.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
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.
The Peregrine High-Performance RPC System David B. Johnson Willy Zwaenepoel Software—Practice & Experience February 1993.
Remote Procedure CallCS-502 Fall Remote Procedure Call (continued) CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System.
Remote Procedure Call Andy Wang Operating Systems COP 4610 / CGS 5765.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Remote Procedure Call RPC
- Manvitha Potluri. Client-Server Communication It can be performed in two ways 1. Client-server communication using TCP 2. Client-server communication.
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.
Reliable Client-Server Communication. Reliable Communication So far: Concentrated on process resilience (by means of process groups). What about reliable.
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
Fault Tolerance CSCI 4780/6780. RPC Semantics in Presence of Failures 5 types of exceptions Client cannot locate server Request to server is lost Server.
1 Chapter 2. Communication. STEMPusan National University STEM-PNU 2 Layered Protocol TCP/IP : de facto standard Our Major Concern Not always 7-layered.
UDP : User Datagram Protocol 백 일 우
© 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.
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.
Communication in Distributed Systems. . The single most important difference between a distributed system and a uniprocessor system is the interprocess.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
Prof. Leonardo Mostarda University of Camerino
Distributed OS.
Communication in Distributed Systems
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
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
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
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
Remote Procedure Call Hank Levy 1.
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.
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

Computing Systems 15, 2015 Next up Client-server model RPC Mutual exclusion

Computing Systems 15, 2015 Client-server model Protocols address the problem of getting bits between machines How do we structure programs? The simplest design is client/server –The OS is structured as a group of cooperating processes called servers that offer services to users, called clients

Computing Systems 15, 2015 Client-server

Computing Systems 15, 2015 Client-server protocol Usually connectionless (UDP) NFS –Client sends a request (read a block from a file) –Server returns a response (here is the block, no such block, etc) Unix system/libc calls –int socketd = socket(domain, type, protocol) –bind(socketd, address) –sendmsg(socketd, &msg, flags) –recvmsg(socketd, &msg, flags)

Computing Systems 15, 2015 Addressing (naming) How do we find a server? Simplest scheme: –Address is IP/port pair (to distinguish between multiple servers running on the same machine) –Server address is coded into client either as a parameter, in a file, or hard-coded

Computing Systems 15, 2015 Hard-coded addressing

Computing Systems 15, 2015 Broadcast lookup Used for ARP (determine Ethernet address from IP address) Servers just pick a name from a large, sparse space (say a 64-bit identifier) Steps –1. Client broadcasts “where are you?” –2. Server responds “here I am” –3. Client sends request –4. Server replies Caching can help avoid repeated broadcasts

Computing Systems 15, 2015 Broadcast lookup

Computing Systems 15, 2015 Using a nameserver DNS (maps IP names to IP numbers) The nameserver is a distributed database of location info –Servers register services

Computing Systems 15, 2015 Nameserver

Computing Systems 15, 2015 Problems Hard-coded: not transparent Broadcast: transparent, but extra system load Name server: may not be scalable What about faults?

Computing Systems 15, 2015 Reliability Messages may get lost Handshaking –When a message is sent, the client blocks –When the message is received, the server kernel sends an ACK –Server sends result –Client kernel sends ACK –Client returns If a message is lost, it can be discovered by a timeout Idempotent?

Computing Systems 15, 2015 Client-server protocols REQ: request: client wants service REP: reply: response from the server ACK: acknowledgement: the previous packet arrived AYA: are you alive? IAA: I am alive TA: try again (out of resources) AU: address unknown

Computing Systems 15, 2015 Remote procedure calls Client-server model is awkward Based on sending and receiving message (I/O) Not a natural concept RPC: provide a function-call like interface Server publishes a function –read(int fd, char *buf, int nbytes) Client calls remote function –read(int fd, char *buf, int nbytes)

Computing Systems 15, 2015 RPC design Usually based on function stubs Client has a function stub that formats a message Server has a stub to unformat the message

Computing Systems 15, 2015 RPC sequence Client procedure calls client stub Client stub builds a message, traps to kernel Kernel sends message to remove kernel Remote kernel gives messages to server stub Server stub unpacks parameters and calls server Server does the work, and returns result to server stub Server stub packs the message and traps to kernel Remote kernel sends a message to client kernel Client kernel gives message to client stub Client stub unpacks result and returns to client

Computing Systems 15, 2015 RPC parameter passing RPC should appear transparent: its not possible to tell between a local and remote procedure call (in C this is hard) Packing parameters into a message is called parameter marshaling Simple example: sum(int i, int j)

Computing Systems 15, 2015 RPC: sum

Computing Systems 15, 2015 RPC: heterogeneous systems Homogeneous distributed systems: every machine is the same Multiple kinds of machines (for example Intel/SPARC/Alpha) Character representations may differ (ASCII vs EBCDIC) Integers (1s complement vs 2s complement) Byte orders: little-endian (Intel) vs big-endian (SPARC) Word sizes: 32 bit ints vs 64 bit ints (Alpha)

Computing Systems 15, 2015 Parameter marshaling Another problem: the bytes in an int must be reordered, but the bytes in a string must not The types can be used to determine how to marshal Next problem: what is the network format for message? –Canonical ASCII for strings 0/1 for Booleans IEEE floats –Client-based: client sends in native format, but indicates the format in the first byte

Computing Systems 15, 2015 RPC programming semantics Calling styles –Call-by-name –Call-by-value –RPC: call-by-copy? How do we marshal pointers?

Computing Systems 15, 2015 Call-by-copy example

Computing Systems 15, 2015 Reading from a file int read(int fd, char *buf, int size) Marshal: –Send the file descriptor –Send the buffer (should be at least size bytes long) –Send the size Server –Get fd, size –Copy the buffer –Read data into buffer and send it back Client unmarshal –Receive data –Copy it into the buffer

Computing Systems 15, 2015 Marshaling What to do about arbitrary data structures The compiler/run-time can marshal arbitrary objects by following pointers –Current compilers can’t do this –Poor behavior in the presence of side-effects –May send too much data (all the reachable data) The client can send a reference –If server accesses data, it has to get it from the client

Computing Systems 15, 2015 How to locate the server? Server specification

Computing Systems 15, 2015 Name lookup Server registers services with binder (portmapper) –Each procedure gets a unique ID During linking, client obtains server port from binder Advantages –Flexible Disadvantages –Overhead (each client starts over; cache the binding?) –Multiple binders (extra overhead to keep them consistent)

Computing Systems 15, 2015 Failures Lots of opportunities for failure –Client may fail –Server may fail –Network may fail –Messages may be lost

Computing Systems 15, 2015 Lost request messages Have the kernel start a timer If request is not ACKed within timeout, send it again What if ACK was lost? –Server may get duplicate requests –Add unique identifier (sequence number) to each request What if network is bad, or server is slow –Client may falsely conclude server is down

Computing Systems 15, 2015 Lost reply messages Harder If client times out, send request again –Is server slow, or did the reply get lost? –Should the server buffer the reply? –What about requests that have side-effects? Requests that have no ill-effects on repeated use are called idempotent –e.g. transferring money into my bank account (not!) Can use a sequence number to identify repeated requests

Computing Systems 15, 2015 Server crashes What to do for the two cases

Computing Systems 15, 2015 Server crashes Three semantics At least once –Keep trying until the server responds –Works ok for idempotent requests –RPC will be executed once or many times At most once –Always report error on failure –RPC may be executed up to one time Exactly once –RPC is always carried out exactly once –Not computable

Computing Systems 15, 2015 Client crashes Client sends a requests to a server, then crashes The executing process is called an orphan Ties up resources What if client reboots and immediately gets a reply (for what?)

Computing Systems 15, 2015 Client crashes Extermination –Client keeps a log, kills orphans on reboot Reincarnation –Client broadcasts the beginning of a new epoch when it reboots –All remote processes are tagged with their epoch Gentle reincarnation –Servers kill process at the start of a new epoch Expiration –Give each RPC process a quantum T –When quantum expires, the client must be contacted