Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transport Layer Outline Intro to transport UDP

Similar presentations


Presentation on theme: "Transport Layer Outline Intro to transport UDP"— Presentation transcript:

1 Transport Layer Outline Intro to transport UDP
Reliability (stop and wait, sliding window) CS 640

2 To Boldly Go Where We Have Yet to Go
Application Transport Network Link Physical 5 4 3 2 1 Recall Internet Architecture Layers used to define functionality Our focus up to now has been layer 5 Applications demand reliable transport Application may demand predictable delays We are now going up to layer 4 This layer is tricky! Goal at the end of the next few weeks is an understanding of the Reno version of TCP CS 640

3 End-to-End Protocols Underlying network is best-effort
drop messages re-orders messages delivers duplicate copies of a given message limits messages to some finite size delivers messages after an arbitrarily long delay Common end-to-end services guarantee message delivery deliver messages in the same order they are sent deliver at most one copy of each message support arbitrarily large messages support synchronization allow the receiver to flow control the sender support multiple application processes on each host CS 640

4 Basic function of transport layer
How can processes on different systems get the right messages? Ports are numeric locators which enable messages to be demultiplexed to proper process. Ports are addresses on individual hosts, not across the Internet. Ports are established using well-know values first Port 80 = http, port 53 = DNS Ports are typically implemented as message queues Simplest function of the transport layer: multiplexing/demultiplexing of messages Enables processes on different systems to communicate End-to-end since only processes on end hosts invoke this protocol CS 640

5 Other transport layer functions
Connection control Setting up and tearing down communication between processes Error detection within packets – our first focus Checksums Reliable, in order delivery of packets – our second focus Acknowledgement schemes Flow control Matching sending and receiving rates between end hosts Congestion control Managing congestion in the network CS 640

6 User Datagram Protocol (UDP)
Unreliable and unordered datagram service Adds multiplexing/demultiplexing Adds reliability through optional checksum No flow or congestion control Endpoints identified by ports servers have well-known ports see /etc/services on Unix Header format Optional checksum Computed over psuedo header + UDP header + data SrcPort DstPort Checksum Length Data 16 31 CS 640

7 UDP Checksums Optional in current Internet
Psuedoheader consists of 3 fields from IP header: protocol number (TCP or UDP), IP src, IP dst and UDP length field Psuedoheader enables verification that message was delivered between correct source and destination. IP dest address was changed during delivery, checksum would reflect this UDP uses the same checksum algorithm as IP Internet checksum CS 640

8 Basics of dealing with errors
Bit errors can be introduced in packets This problem has been studied for a long time Error detection (and correction) codes Cyclic redundancy check (CRC) is a common error detection method Basic idea of any scheme is to add redundant data Extreme example – send two identical copies of data Poor for many reasons A primary goal is to send minimal amount of redundant data CRC used in Ethernet has 32 bits for each 1500 byte packet Another goal is to make generation of checksum fast CS 640

9 Checksum basics contd. Simple parity is the most basic method for error detection Odd/even parity Internet Checksum Basic idea: sender adds up all words and transmit the sum Add using 16 bit one’s complement arithmetic then take one’s complement of the result to get checksum Receiver adds up all words and compares with checksum It’s very simple and efficient to code this Reason that this is used instead of CRC Not really great detecting errors CRC is much stronger Forward error correction is another possibility CS 640

10 UDP in practice Minimal specification makes UDP very flexible Examples
Any kind of end-to-end protocol can be implemented See programming assignment #1 TCP can be implemented using UDP Examples Most commonly used in multimedia applications These are frequently more robust to loss RPC’s Many others… CS 640

11 Reliability We’re heading toward TCP
Baby steps first… lets start with looking at minimal support for reliability CS 640

12 Methods of Reliability
Packets can be lost and/or corrupted during transmission Bit level errors due to noise Loss due to congestion Use checksums to detect bit level errors Internet Checksum is optionally used to detect errors in UDP Uses 16 bits to encode one’s complement sum of data + headers When bit level errors are detected, packets are dropped Build reliability into the transmission protocol Using acknowledgements and timeouts to signal lost or corrupt frame CS 640

13 Acknowledgements & Timeouts
An acknowledgement (ACK) is a packet sent by one host in response to a packet it has received Making a packet an ACK is simply a matter of changing a field in the transport header Data can be piggybacked in ACKs A timeout is a signal that an ACK to a packet that was sent has not yet been received within a specified timeframe A timeout triggers a retransmission of the original packet from the sender How are timers set? CS 640

14 Acknowledgements & Timeouts
CS 640

15 Propagation Delay Propagation delay is defined as the delay between transmission and receipt of packets between hosts Propagation delay can be used to estimate timeout period How can propagation delay be measured? What else must be considered in the measurement? CS 640

16 Exponentially weighted moving average RTT estimation
EWMA was original algorithm for TCP Measure SampleRTT for each packet/ACK pair Compute weighted average of RTT EstRTT = a x EstimatedRTT + b x SampleRTT where a + b = 1 a between 0.8 and 0.9 b between 0.1 and 0.2 Set timeout based on EstRTT TimeOut = 2 x EstRTT CS 640

17 Stop-and-Wait Process
Sender Receiver Sender doesn’t send next packet until he’s sure receiver has last packet The packet/Ack sequence enables reliability Sequence numbers help avoid problem of duplicate packets Problem: keeping the pipe full Example 1.5Mbps link x 45ms RTT = 67.5Kb (8KB) 1KB frames imples 1/8th link utilization CS 640

18 Solution: Pipelining via Sliding Window
Allow multiple outstanding (un-ACKed) frames Upper bound on un-ACKed frames, called window Sender Receiver T ime CS 640

19 Buffering on Sender and Receiver
Sender needs to buffer data so that if data is lost, it can be resent Receiver needs to buffer data so that if data is received out of order, it can be held until all packets are received Flow control How can we prevent sender overflowing receiver’s buffer? Receiver tells sender its buffer size during connection setup How can we insure reliability in pipelined transmissions? Go-Back-N Send all N unACKed packets when a loss is signaled Inefficient Selective repeat Only send specifically unACKed packets A bit trickier to implement CS 640

20 Sliding Window: Sender
Assign sequence number to each frame (SeqNum) Maintain three state variables: send window size (SWS) last acknowledgment received (LAR) last frame sent (LFS) Maintain invariant: LFS - LAR <= SWS Advance LAR when ACK arrives Buffer up to SWS frames SWS LAR LFS CS 640

21 Sliding Window: Receiver
Maintain three state variables receive window size (RWS) largest frame acceptable (LFA) last frame received (LFR) Maintain invariant: LFA - LFR <= RWS Frame SeqNum arrives: if LFR < SeqNum < = LFA accept if SeqNum < = LFR or SeqNum > LFA discarded Send cumulative ACKs – send ACK for largest frame such that all frames less than this have been received RWS LFR LFA CS 640

22 Sequence Number Space SeqNum field is finite; sequence numbers wrap around Sequence number space must be larger then number of outstanding frames SWS <= MaxSeqNum-1 is not sufficient suppose 3-bit SeqNum field (0..7) SWS=RWS=7 sender transmit frames 0..6 arrive successfully, but ACKs lost sender retransmits 0..6 receiver expecting 7, 0..5, but receives the original incarnation of 0..5 SWS < (MaxSeqNum+1)/2 is correct rule Intuitively, SeqNum “slides” between two halves of sequence number space CS 640

23 Stop & wait sequence numbers
Sender Receiver Sender Receiver Sender Receiver Frame 0 Frame 0 Frame 0 imeout imeout ACK 0 T T ACK 0 ACK 0 Frame 0 Frame 1 Frame 0 imeout imeout T ACK 0 ACK 1 ACK 0 T Frame 0 (c) (d) ACK 0 (e) Simple sequence numbers enable the client to discard duplicate copies of the same frame Stop & wait allows one outstanding frame, requires two distinct sequence numbers CS 640

24 Sliding Window Example
Sender Receiver 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 A3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 4 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 A4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 CS 640

25 Sliding Window Summary
Sliding window is best known algorithm in networking First role is to enable reliable delivery of packets Timeouts and acknowledgements Second role is to enable in order delivery of packets Receiver doesn’t pass data up to app until it has packets in order Third role is to enable flow control Prevents server from overflowing receiver’s buffer CS 640


Download ppt "Transport Layer Outline Intro to transport UDP"

Similar presentations


Ads by Google