Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
• Layered protocols • Remote Procedure Call (RPC) • Issues: – Parameter passing – Binding – Failure handling – Performance and implementation issues CS550: Advanced Operating Systems 2 • Protocols are agreements/rules on communication • Protocols could be connection-oriented or connectionless CS550: Advanced Operating Systems 3 • A typical message as it appears on the network. 2-2 CS550: Advanced Operating Systems 4 • Goal: ? • Sample Issues: – – – – how to encode a 0 Vs. 1? what voltage should be used? how long does a bit need to be signaled? what does the cable, plug, antenna, etc. look like? • Examples: – modems – “knock once for yes, twice for no” – X.21 CS550: Advanced Operating Systems 5 • Goal: ? • Sample Issues: – how big is a frame? (framing) – can I detect an error in sending the frame? (error control) – what demarks the end of the frame? – how to control access to a shared channel? (flow control) • Examples: – Ethernet framing, Serial line IP (SLIP), Point-to-point protocol (PPP) CS550: Advanced Operating Systems 6 • Goal: ? • Sample Issues: – how to route packets that have to travel several hops? – Congestion control algorithm: traffic shaping, flow specifications, and bandwidth reservation – accounting - charge for use of the network – fragment or combine packets depending on rules of link layer • Examples: – IP CS550: Advanced Operating Systems 7 • Goal: ? • Sample Issues: – how to order messages and detect duplicates – error detection (corrupt packets) and retransmission – connectionless or connection-oriented • Examples: – TCP (transmission control protocol) – UDP (universal datagram protocol) CS550: Advanced Operating Systems 8 • Goal: ? • Sample Issues: – Session layer: Allows users on different machines to establish sessions between them; Provides dialog control, to keep track of which party is currently talking, and synchronize – Presentation layer: Encodes data in a standard agreed upon way; Allows users to insert checkpoints into long transfer • Examples: – eXternal Data Representation (XDR) CS550: Advanced Operating Systems 9 • Goal: ? • Sample Issues: – when sending email, what demarks the subject field – how to represent cursor movement in a terminal • Examples: – Simple Mail Transport Protocol (SMTP), File Transfer Protocol (FTP), Hyper-Text Transport Protocol (HTTP), Simple Network Management Protocol (SNMP), Network File System (NFS), Network Time Protocol (NTP), Net News Transport Protocol (NNTP), X (X Window Protocol) CS550: Advanced Operating Systems 10 • Middleware: – An application that logically lives in the application layer – Contains many general-purpose protocols that warrant their own layers CS550: Advanced Operating Systems 11 • Client-Server provides a mechanism for services in distributed systems BUT –requires explicit communication (sendreceive) • Q: How do me make “distributed computing look like traditional (centralized) computing”? • Can we use procedure calls? CS550: Advanced Operating Systems 12 • In Distributed systems: the callee may be on a different system –Remote Procedure Call (RPC) –NO EXPLICIT MESSAGE PASSING • Goal: Make RPC look like local procedure call CS550: Advanced Operating Systems 13 • Parameter passing • Binding • Reliability/How to handle failures –messages losses –client crash –server crash • Performance and implementation issues • Exception handling • Interface definition CS550: Advanced Operating Systems 14 count=read(fd,buf,nbytes); a) Parameter passing in a b) The stack while the called local procedure call: the procedure is active stack before the call to CS550: Advanced Operating Systems read 15 • Parameters (in C): –call-by-reference OR call-by-value • Value parameter (e.g., fd, nbytes) • Reference parameter (array buf) • Many options are language dependent CS550: Advanced Operating Systems 16 • Local procedure parameter passing – Call-by-value – Call-by-reference • Remote procedure calls simulate this through: – Stubs – proxies – Marshaling • How about global variables? CS550: Advanced Operating Systems 17 • Client makes procedure call (just like a local procedure call) to the client stub • Server is written as a standard procedure • Stubs take care of packaging arguments and sending messages • Packaging is called marshaling • Stub compiler generates stub automatically from specs in an Interface Definition Language (IDL) CS550: Advanced Operating Systems 18 • Principle of RPC between a client and server program. CS550: Advanced Operating Systems 19 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 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 CS550: Advanced Operating Systems 20 • Steps involved in doing remote computation through RPC CS550: Advanced Operating Systems 21 • Problem: different machines have different data formats – Intel: little endian, SPARC: big endian • Solution: ? CS550: Advanced Operating Systems 22 • Problem: how do we pass pointers? – If it points to a well-defined data structure, ? – What about data structures containing pointers? • Marshalling: transform parameters/results into a byte stream CS550: Advanced Operating Systems 23 • Problem: how does a client locate a server? • Binder can be a bottleneck • Binder can do load balancing CS550: Advanced Operating Systems 24 • Client unable to locate server: return error • Lost request messages: simple timeout mechanisms • Lost replies: timeout mechanisms – Make operation idempotent – Use sequence numbers, mark retransmissions • Server failures: did failure occur before or after operation? – – – – At least once semantics (SUNRPC) At most once No guarantee Exactly once: desirable but difficult to achieve • Client failures CS550: Advanced Operating Systems 25 • Reasons: –server may be down –new version of server but older client • Solutions –respond with error type “cannot locate server” –raise exception CS550: Advanced Operating Systems 26 • Time Out –Kernel starts timer when request sent –If timer expires, resend message –If message was lost - server cannot tell the difference –If message lost too many times ==> “cannot locate server” CS550: Advanced Operating Systems 27 • More difficult to handle • Rely on timer again? • Problem: Client’s kernel doesn't know why no answer! • Must distinguish between –request/reply got lost? –server slow • Why? CS550: Advanced Operating Systems 28 • When server crashes? – After execution – After receiving message but BEFORE execution • Solutions: – Wait until server reboots (or rebind) – Give up immediately and report failure – Guarantee nothing – “exactly once semantics” CS550: Advanced Operating Systems 29 • Client sends a request and crashes –Computation active - but no parent active –unwanted computation called “orphan” • Orphan’s can create problems:? • Solutions: – – – – Extermination: Reincarnation: Gentle reincarnation: Expiration: CS550: Advanced Operating Systems 30 CS550: Advanced Operating Systems 31