DOC PREVIEW
Stanford CS 144 - Study Notes

This preview shows page 1-2-3-4-5-33-34-35-36-67-68-69-70-71 out of 71 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 71 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 71 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 71 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 71 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 71 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 71 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 71 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 71 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 71 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 71 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 71 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 71 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 71 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 71 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 71 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Slide 65Slide 66Slide 67Slide 68Slide 69Slide 70Slide 71Announcements●Lab 1 is being graded. We will try to get scores/feedback out to you soon.●Lab 2 is due Oct 12; Oct 14 (late).●Writing assignment 2 is due Oct 9.Outline●Lab 1 vs Lab 2 ●Lab 2 strategies●Lab 2 gotchas●Lecture review●QuestionsLab 1 vs Lab2: Differences●Multiple connections●Window size > 1Multiple ConnectionsSender ReceiverLab 1Multiple ConnectionsSender ReceiverLab 1Server ReceiverClient 1Client 2Lab 2Multiple ConnectionsSender ReceiverLab 1Server ReceiverClient 1Client 2Stream 1Stream 2rel_t_1rel_t_2Lab 2Window SizesSender ReceiverLab 1: Window size 1dataWindow SizesSender ReceiverLab 1: Window size 1dataSender ReceiverLab 2: Window size ndata2 data1data3Outline●Lab 1 vs Lab 2 ●Lab 2 strategies●Lab 2 gotchas●Lecture review●QuestionsBefore you begin: backup Lab 1 codecp -r reliable reliable.bak.0Before you begin: backup Lab 1 codecp -r reliable reliable.bak.0git commit -a -m “Lab 1 submission”...Decomposition●Break problem into pieces●Build each piece separately●Test each piece individually (as much as possible)Lab 1 vs Lab2: Differences●Multiple connections●Window size > 1Lab 1 vs Lab2: Differences●Multiple connections●Window size > 1Multiple ConnectionsSender ReceiverLab 1Server ReceiverClient 1Client 2Stream 1Stream 2rel_t_1rel_t_2Lab 2Code differencesrel_create:●Lab 1: SYSTEM calls●Lab 2: YOU callrel_recvpkt:●Lab 1: SYSTEM calls●Lab 2: YOU callrel_demux:●Lab 1: NO ONE calls●Lab 2: SYSTEM callspktrel_demux (pkt, pkt_size, sockaddr, ...) Lab 2: rel_demuxpktrel_demux (pkt, pkt_size, sockaddr, ...) Lab 2: rel_demuxackrel_demux (pkt, pkt_size, sockaddr, ...) seqno=1rel_demux (pkt, pkt_size, sockaddr, ...) eofrel_demux (pkt, pkt_size, sockaddr, ...) cksum:garbagerel_demux (pkt, pkt_size, sockaddr, ...) datarel_demux (pkt, pkt_size, sockaddr, ...)rel_demux: ack pkt●What should you do when you receive an ack packet in rel_demux?rel_demux: ack pkt●What should you do when you receive an ack packet in rel_demux?–Walk rel_list global variable–For each rel_t in rel_list, check if sockaddr_storage matches.rel_demux: ack pkt●What should you do when you receive an ack packet in rel_demux?–Walk rel_list global variable–For each rel_t in rel_list, check if sockaddr_storage matches.How?rel_demux: ack pkt●What should you do when you receive an ack packet in rel_demux?–Walk rel_list global variable–For each rel_t in rel_list, check if sockaddr_storage matches.How?addreq function provided in rlib.hrel_demux: ack pkt●What should you do when you receive an ack packet in rel_demux?–Walk rel_list global variable–For each rel_t in rel_list, check if sockaddr_storage matches.–If matches, call rel_recvpkt for matching rel_t and packet.rel_demux question●Checksums for Lab 1 were in rel_recvpkt. Does this work in Lab 2?rel_demux question●Checksums for Lab 1 were in rel_recvpkt. Does this work in Lab 2? Hint: Are there any cases where you would perform an action based on a packet before rel_recvpkt?rel_demux question●Checksums for Lab 1 were in rel_recvpkt. Does this work in Lab 2? Hint: Are there any cases where you would perform an action based on a packet before rel_recvpkt?rel_create must be called before rel_recvpktPerform a checksum in rel_demux.Window Sizes: DecompositionWindow Sizes: Decomposition IFundamental questions:–When should I send a data packet?–What should I do when I receive a packet that I cannot instantly output?Window Sizes: Decomposition IFundamental questions:–When should I send a data packet?–What should I do when I receive a packet that I cannot instantly output?Question: Can a sender with window 10 communicate with a receiver with window 1?Window Sizes: Decomposition IFundamental questions:–When should I send a data packet?–What should I do when I receive a packet that I cannot instantly output?Question: Can a sender with window 10 communicate with a receiver with window 1?YesDecompose: Build one before the other.Window Sizes: Decomposition 2●Student's window implementation:Warning: Example code doesn't have correct logic or syntax. It's just to demonstrate a point.struct rel_t{ … packet_t[] send_window; int [] send_window_map; int send_window_map_index; int send_window_size; …};Window Sizes: Decomposition 2rel_recvpkt(rel_t* r, packet_t* pkt, ...){ ... onAck: //check if acking a packet if (send_window_map[pkt->ackno % send_window_size]) { //try to send if have any data available if (send_window_map[send_window_map_index]) free(send_window[send_window_map_index]); (++send_window_map_index) %= send_window_size; } ...}rel_timer(rel_t* r, packet_t* pkt, ...){ onExpired: if (send_window_map[send_window_map_index]) conn_sendpkt(send_window[++send_window_map_index]); ...}Warning: Example code doesn't have correct logic or syntax. It's just to demonstrate a point.Window Sizes: Decomposition 2rel_recvpkt(rel_t* r, packet_t* pkt, ...){ ... onAck: //check if acking a packet if (send_window_map[pkt->ackno % send_window_size]) { //try to send if have any data available if (send_window_map[send_window_map_index]) free(send_window[send_window_map_index]); (++send_window_map_index) %= send_window_size; } ...}rel_timer(rel_t* r, packet_t* pkt, ...){ onExpired: if (send_window_map[send_window_map_index]) conn_sendpkt(send_window[++send_window_map_index]); ...}Warning: Example code doesn't have correct logic or syntax. It's just to demonstrate a point.Putting all this logic directly into your code is going to make Lab 2 very difficult to debug.Sending window functionalityList required functionality of sending window:–Check if have room in sending window–Check if have any partial packets in flight–Add packet to window–Etc.Sending window functionalityList required functionality of sending window:–Check if have


View Full Document

Stanford CS 144 - Study Notes

Documents in this Course
IP Review

IP Review

22 pages

Load more
Download Study Notes
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 Study Notes 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 Study Notes 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?