Goals for Today Finish e2e argument fate sharing Transport TCP UDP CS162 Operating Systems and Systems Programming Lecture 15 Reliability Flow control Reliability Transport Protocols March 16 2011 Ion Stoica http inst eecs berkeley edu cs162 3 16 Placing Network Functionality Ion Stoica CS162 UCB Spring 2011 Lec 15 2 Basic Observation Some types of network functionality can only be correctly implemented end to end Hugely influential paper End to End Arguments in System Design by Saltzer Reed and Clark 84 Reliability security etc Sacred Text of the Internet Because of this end hosts Endless disputes about what it means Everyone cites it as supporting their position Can satisfy the requirement without network s help Will must do so since can t rely on network s help Therefore don t go out of your way to implement them in the network 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 3 Page 1 Ion Stoica CS162 UCB Spring 2011 Lec 15 4 Example Reliable File Transfer Host A Solution 1 is incomplete Host B Appl OS Discussion What happens if memory is corrupted Receiver has to do the check anyway Appl OK OS Solution 2 is complete Full functionality can be entirely implemented at application layer with no need for reliability from lower layers Solution 1 make each step reliable and then concatenate them Is there any need to implement reliability at lower layers Solution 2 end to end check and try again if necessary 3 16 Ion Stoica CS162 UCB Spring 2011 Well it could be more efficient 3 16 Lec 15 5 Summary of End to End Principle Ion Stoica CS162 UCB Spring 2011 Lec 15 6 Conservative Interpretation of E2E Implementing this functionality in the network Doesn t reduce host implementation complexity Does increase network complexity Probably imposes delay and overhead on all applications even if they don t need functionality Don t implement a function at the lower levels of the system unless it can be completely implemented at this level Unless you can relieve the burden from hosts don t bother However implementing in network can enhance performance in some cases E g very losy link 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 7 Page 2 Ion Stoica CS162 UCB Spring 2011 Lec 15 8 Moderate Interpretation Related Notion of Fate Sharing Idea when storing state in a distributed system keep it co located with the entities that ultimately rely on the state Think twice before implementing functionality in the network Fate sharing is a technique for dealing with failure If hosts can implement functionality correctly implement it in a lower layer only as a performance enhancement Only way that failure can cause loss of the critical state is if the entity that cares about it also fails in which case it doesn t matter But do so only if it does not impose burden on applications that do not require that functionality Often argues for keeping network state at end hosts rather than inside routers In keeping with End to End principle E g packet switching rather than circuit switching E g NFS file handles HTTP cookies 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 9 Ion Stoica CS162 UCB Spring 2011 Reliable Transfer Lec 15 10 Stop Wait Send wait for ack If timeout retransmit else repeat Retransmit missing packets Numbering of packets and ACKs TRANS Do this efficiently DATA Receiver Sender Keep transmitting whenever possible Detect missing ACKs and retransmit quickly RTT ACK Inefficient if TRANS RTT Two schemes Stop Wait Sliding Window Go back n and Selective Repeat Time 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 11 Page 3 Ion Stoica CS162 UCB Spring 2011 Lec 15 12 Sliding Window Go Back n GBN window set of adjacent sequence numbers Transmit up to n unacknowledged packets The size of the set is the window size If timeout for ACK k retransmit k k 1 Assume window size is n Let A be the last ack d packet of sender without gap then window of sender A 1 A 2 A n Sender can send packets in its window Let B be the last received packet without gap by receiver then window of receiver B 1 B n Receiver can accept out of sequence if in window 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 13 Ion Stoica CS162 UCB Spring 2011 GBN Example w o Errors Sender Window 1 1 2 1 2 3 2 3 4 3 4 5 4 5 6 4 5 6 Timeout Packet 4 Window size 3 packets 3 16 Lec 15 15 Page 4 4 is missing 5 5 6 Sender Receiver Ion Stoica CS162 UCB Spring 2011 1 2 3 4 5 6 4 5 6 Time Sender 3 16 GBN Example with Errors Window size 3 packets Receiver Window 1 2 3 Lec 15 14 Receiver Ion Stoica CS162 UCB Spring 2011 Lec 15 16 Selective Repeat SR SR Example with Errors Sender transmit up to n unacknowledged packets assume packet k is lost 1 1 1 2 2 1 2 3 3 2 3 4 4 3 4 5 5 4 5 6 6 Receiver indicate packet k is missing Sender retransmit packet k Window size 3 packets Nack 4 4 5 6 4 Time 7 7 Sender 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 17 Observations Receiver Ion Stoica CS162 UCB Spring 2011 Lec 15 18 Motivation for Transport Protocols IP provides a weak but efficient service model best effort Packets can be delayed dropped reordered duplicated Packets have limited size why With sliding windows it is possible to fully utilize a link provided the window size is large enough Throughput is n RTT IP packets are addressed to a host Stop Wait is like n 1 How to decide which application gets which packets Sender has to buffer all unacknowledged packets because they may require retransmission How should hosts send packets into the network Too fast may overwhelm the network Too slow is not efficient Receiver may be able to accept out of order packets but only up to its buffer limits 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 19 Page 5 Ion Stoica CS162 UCB Spring 2011 Lec 15 20 Transport Layer Congestion vs Flow Control Provide a way to decide which packets go to which applications multiplexing demultiplexing Flow Control avoid overflowing the receiver Congestion Control avoid congesting the network Can What is network congestion Provide reliability in order delivery at most once delivery Support messages of arbitrary length Govern when hosts should send data can implement congestion and flow control 3 16 Ion Stoica CS162 UCB Spring 2011 3 16 Lec 15 21 Transport Layer cont d Ion Stoica CS162 UCB Spring 2011 Lec 15 22 Ports Need to decide which application gets which packets ports HTTP SSH DNS Application p1 p2 p1 p2 p3 p1 Solution map each socket to a port p2 Client must know server s port Transport Separate 16 bit port address …
View Full Document
Unlocking...