DOC PREVIEW
Berkeley COMPSCI 162 - Lecture 24 Network Communication Abstractions / Distributed Programming

This preview shows page 1-2-15-16-31-32 out of 32 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS162 Operating Systems and Systems Programming Lecture 24 Network Communication Abstractions / Distributed ProgrammingReview: Window-Based Acknowledgements (TCP)Review: Socket Setup (Con’t)Goals for TodayDistributed ApplicationsUsing Messages: Send/Receive behaviorMessaging for Producer-Consumer StyleMessaging for Request/Response communicationGeneral’s ParadoxTwo-Phase CommitTwo phase commit exampleAdministriviaDistributed Decision Making DiscussionByzantine General’s ProblemByzantine General’s Problem (con’t)Remote Procedure CallRPC Information FlowRPC DetailsRPC Details (continued)Problems with RPCCross-Domain Communication/Location TransparencyMicrokernel operating systemsDistributed File SystemsVirtual File System (VFS)Simple Distributed File SystemUse of caching to reduce network loadFailuresSchematic View of NFS ArchitectureNetwork File System (NFS)NFS ContinuedNFS Cache consistencyConclusionCS162Operating Systems andSystems ProgrammingLecture 24Network Communication Abstractions /Distributed ProgrammingNovember 24, 2008Prof. John Kubiatowiczhttp://inst.eecs.berkeley.edu/~cs162Lec 24.211/24/08 Kubiatowicz CS162 ©UCB Fall 2008Seq:190Size:40Review: Window-Based Acknowledgements (TCP)Seq:230A:190/140Seq:260A:190/100Seq:300A:190/60Seq:190A:340/60Seq:340 A:380/20Seq:380 A:400/0A:100/300Seq:100A:140/260Seq:140A:190/210100Seq:100Size:40140Seq:140Size:50190Seq:230Size:30230 260Seq:260Size:40300Seq:300Size:40340Seq:340Size:40380Seq:380Size:20400Retransmit!Lec 24.311/24/08 Kubiatowicz CS162 ©UCB Fall 2008ServerSocketsocket socketconnectionRequest ConnectionnewsocketServerClientReview: Socket Setup (Con’t)•Things to remember:–Connection requires 5 values:[ Src Addr, Src Port, Dst Addr, Dst Port, Protocol ]–Often, Src Port “randomly” assigned»Done by OS during client socket setup–Dst Port often “well known”»80 (web), 443 (secure web), 25 (sendmail), etc»Well-known ports from 0—1023Lec 24.411/24/08 Kubiatowicz CS162 ©UCB Fall 2008Goals for Today•Messages–Send/receive–One vs. two-way communication•Distributed Decision Making–Two-phase commit/Byzantine Commit•Remote Procedure Call•Distributed File Systems (Part I)Note: Some slides and/or pictures in the following areadapted from slides ©2005 Silberschatz, Galvin, and Gagne Note: Some slides and/or pictures in the following areadapted from slides ©2005 Silberschatz, Galvin, and Gagne. Many slides generated from my lecture notes by Kubiatowicz.Lec 24.511/24/08 Kubiatowicz CS162 ©UCB Fall 2008Distributed Applications•How do you actually program a distributed application?–Need to synchronize multiple threads, running on different machines »No shared memory, so cannot use test&set–One Abstraction: send/receive messages»Already atomic: no receiver gets portion of a message and two receivers cannot get same message•Interface:–Mailbox (mbox): temporary holding area for messages»Includes both destination location and queue–Send(message,mbox)»Send message to remote mailbox identified by mbox–Receive(buffer,mbox)»Wait until mbox has message, copy into buffer, and return»If threads sleeping on this mbox, wake up one of themNetworkSendReceiveLec 24.611/24/08 Kubiatowicz CS162 ©UCB Fall 2008Using Messages: Send/Receive behavior•When should send(message,mbox) return?–When receiver gets message? (i.e. ack received)–When message is safely buffered on destination?–Right away, if message is buffered on source node?•Actually two questions here:–When can the sender be sure that receiver actually received the message?–When can sender reuse the memory containing message?•Mailbox provides 1-way communication from T1T2–T1bufferT2–Very similar to producer/consumer »Send = V, Receive = P»However, can’t tell if sender/receiver is local or not!Lec 24.711/24/08 Kubiatowicz CS162 ©UCB Fall 2008Messaging for Producer-Consumer Style•Using send/receive for producer-consumer style:Producer:int msg1[1000];while(1) {prepare message; send(msg1,mbox);}Consumer:int buffer[1000];while(1) {receive(buffer,mbox);process message;}•No need for producer/consumer to keep track of space in mailbox: handled by send/receive–One of the roles of the window in TCP: window is size of buffer on far end–Restricts sender to forward only what will fit in bufferSendMessageReceiveMessageLec 24.811/24/08 Kubiatowicz CS162 ©UCB Fall 2008Messaging for Request/Response communication•What about two-way communication?–Request/Response»Read a file stored on a remote machine»Request a web page from a remote web server–Also called: client-server»Client  requester, Server  responder»Server provides “service” (file storage) to the client•Example: File serviceClient: (requesting the file)char response[1000];send(“read rutabaga”, server_mbox);receive(response, client_mbox);Server: (responding with the file)char command[1000], answer[1000];receive(command, server_mbox);decode command;read file into answer;send(answer, client_mbox);RequestFileGetResponseReceiveRequestSendResponseLec 24.911/24/08 Kubiatowicz CS162 ©UCB Fall 2008•General’s paradox: –Constraints of problem: »Two generals, on separate mountains»Can only communicate via messengers»Messengers can be captured–Problem: need to coordinate attack»If they attack at different times, they all die»If they attack at same time, they win–Named after Custer, who died at Little Big Horn because he arrived a couple of days too early•Can messages over an unreliable network be used to guarantee two entities do something simultaneously?–Remarkably, “no”, even if all messages get through–No way to be sure last message gets through!Yeah, but what if youDon’t get this ack?General’s Paradox11 am ok?So, 11 it is?Yes, 11 worksLec 24.1011/24/08 Kubiatowicz CS162 ©UCB Fall 2008Two-Phase Commit•Since we can’t solve the General’s Paradox (i.e. simultaneous action), let’s solve a related problem–Distributed transaction: Two machines agree to do something, or not do it, atomically •Two-Phase Commit protocol does this–Use a persistent, stable log on each machine to keep track of whether commit has happened»If a machine crashes, when it wakes up it first checks its log to recover state of world at time of crash–Prepare Phase:»The global coordinator requests that all participants will promise to commit or rollback the transaction»Participants record promise in log, then acknowledge»If


View Full Document

Berkeley COMPSCI 162 - Lecture 24 Network Communication Abstractions / Distributed Programming

Documents in this Course
Lecture 1

Lecture 1

12 pages

Nachos

Nachos

41 pages

Security

Security

39 pages

Load more
Download Lecture 24 Network Communication Abstractions / Distributed Programming
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 24 Network Communication Abstractions / Distributed Programming and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 24 Network Communication Abstractions / Distributed Programming 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?