Reliable Transport 14-740: Fundamentals of Computer Networks Bill Nace Material from Computer Networking: A Top Down Approach, 6 th edition. J.F. Kurose and K.W. Ross
Administration Stuff is due HW #1 was due 2 slides ago Lab #1 on Thursday Quiz #1 regrade requests due Thursday 2
Last Lecture Transport Layer Mission: Logical connection, App App Tools: {De}Multiplex Port Numbers Segmentation UDP Simple segment blaster 3
traceroute RDT Theory and Tools Stop-and-wait Protocol Motivates Pipelining Sliding-window Protocols Go-back-N (GBN) Selective Repeat (SR) 4
RDT: Requirements Reliable Data Transfer (RDT) Reliable channel service abstraction No transferred bits are corrupted All bits are delivered (and no extras)...... in the order sent Generally bidirectional Today, we talk about unidirectional 5
Fault Models Network-layer may have faults Bit-errors Lossy: i.e. segment can go missing Duplicate delivery Out-of-order delivery 6
Tools Receiver feedback Positive acknowledgement (ACK) Good segment received Negative acknowledgement (NACK) Bad segment received 7
Tools (2) Error detection Checksum -- Segment received, but bit errors exist Timer expiration -- Segment or receiver feedback is lost 8
Tools (3) Retransmission Sender sends another copy of segment Sequence number Distinguish between old and new Gaps let receiver detect lost segment Window, pipelining Control sending of multiple segments 9
traceroute RDT Theory and Tools Stop-and-wait Protocol Motivates Pipelining Sliding-window Protocols Go-back-N (GBN) Selective Repeat (SR) 10
Stop-and-wait Simplest Protocol that will handle bit errors and segment loss Example of how to use: checksum acknowledgement sequence numbers (1 bit) timers 11
The protocol (v1) Tools used: Checksum, ACK and NAK When sending a segment When segment is received Wait to get an ACK/NAK If NAK, resend the segment Then go back to waiting If ACK, great! Examine checksum Reply with ACK for good segment Deliver to App layer NAK for corrupted ones Protocol does not create duplicate segments
Stop-and-wait in Action Version 1 Checksum: Detects flipped bits ACK / NAK: Feedback segment is good segment is damaged Sender send segment rcv NAK send segment rcv ACK Receiver rcv segment send NAK rcv segment send ACK 13
The protocol (v2) Tools used: Cksm, ACK/NAK, 1-bit seq number When sending a segment seq # = 1 - last seq # Wait to get ACK/NAK If corrupted or NAK, resend Otherwise, great! When segment is received Reply with ACK for good segments NAK for corrupted ones If seq # is last seq # Deliver to App Layer Protocol retransmits a damaged ACK/NAK
Stop-and-wait in Action Version 2 Checksum: Detects flipped bits in segment or ACK / NAK Sequence Number: Detects duplicate segments Sender send seg0 rcv NAK send seg0 rcv ACK send seg1 rcv ACK send seg1 rcv ACK Receiver rcv seg0 send NAK rcv seg0 send ACK deliver to App rcv seg1 send ACK deliver to App rcv seg1 send ACK Duplicate! Not delivered to App layer 15
The protocol (v3) Tools used: Cksm, ACK/NAK, seq numbers, timers When sending a segment, set timer, include seq number When ACK received, remove timer and proceed with next segment NACK: reset timer, resend If timer goes off, resend (and set the timer) When segment is received ACK for good segments NAK for corrupted ones Include seq number If seq # is last seq # Deliver to App Layer Protocol retransmits lost segments
Stop-and-wait in Action Sender Receiver Sender Receiver send seg0 rcv seg0 send ACK0 send seg0 rcv seg0 send ACK0 rcv ACK0 send seg1 rcv ACK1 send seg0 rcv seg1 send ACK1 rcv seg0 send ACK0 Operation with no loss rcv ACK0 send seg1 timeout timeout resend seg1 rcv ACK1 send seg0 rcv seg1 send ACK1 rcv seg0 send ACK0 Lost Segment
Sequence Numbers Sender send seg0 rcv ACK0 send seg1 timeout timeout resend seg1 rcv ACK1 send seg0 Receiver rcv seg0 send ACK0 rcv seg1 send ACK1 rcv seg1 send ACK1 rcv seg0 send ACK0 Without sequence numbers, receiver doesn t know if retransmitted segment is new data or old Lost ACK and Lost Segment are identical to sender Lost ACK
Sequence Numbers (2) Sender send seg0 rcv ACK0 send seg1 timeout timeout resend seg1 rcv ACK1 send seg0 rcv ACK1 do nothing Receiver rcv seg0 send ACK0 rcv seg1 send ACK1 rcv seg1 send ACK1 rcv seg0 send ACK0 Sender can t distinguish first and second ACK1 Sequence number indicates duplicate Sender waiting for ACK0 Does nothing on ACK1 Premature Timeout
Stop-and-wait has a problem Sender Receiver first segment bit transmitted, t=0 last segment bit transmitted, t = L / R RTT ACK arrives. First bit of next segment, t = RTT + L / R first segment bit arrives last segment bit arrives, send ACK L = 1000B segment R = 1.5Mbps RTT = 45 ms Usender = L / R =.0053 = 0.1059 L / R + RTT.0503 Blech!
How can U be One? Bandwidth-Delay Product Amount of data that could be in transit Sender could pump this much data without awaiting an ACK Example RTT = 45ms, R = 1.5Mbps BWxDelay = R x RTT = 67.5Kb If L = 1KB, (i.e. 8Kb) 8 segments could be in flight 21
Pipelined Protocols Pipelining: send multiple, in-flight, yetto-be-acknowledged segments Data segment Data segments ACK segments A stop-and-wait protocol A pipelined protocol 22
Pipelining: Increased Utilization Sender Receiver first segment bit transmitted, t=0 last segment bit transmitted, t = L / R RTT first segment bit arrives last segment bit arrives, send ACK ACK arrives. First bit of next segment, t = RTT + L / R last bit of 2nd seg arrives, send ACK last bit of 3rd seg arrives, send ACK Increased utilization by a factor of 3! Usender = 3 x L / R = 0.016 = 0.317 L / R + RTT.0503 23
traceroute RDT Theory and Tools Stop-and-wait Protocol Motivates Pipelining Sliding-window Protocols Go-back-N (GBN) Selective Repeat (SR) 24
Sliding-window Protocols A mechanism to control multiple, in-flight segments without overwhelming receiver Sender is allowed to transmit N segments without waiting for an ACK N is the window size, a range of permissible sequence numbers Two generic forms Go-Back-N (GBN) Selective Repeat (SR) 25
GBN: Sender Sender places a k-bit seq# in header window of up to N, consecutive unacked segments allowed Sets a timer for each in-flight segment timeout(n): retransmit segment n and all higher seq# segments in window ACK(n): ACKs all segments up to, including seq# n Cumulative ACK 26
GBN: Receiver ACK-only: always send ACK for correctly-received segment with highest in-order seq# May generate duplicate ACKs But, only remembers expected seq# Receipt of out-of-order segment: Discard! No receiver side buffering Re-ACK seg with highest in-order seq# 27
GBN: Window Sender variables: send_base, nextseqnum send_base nextseqnum window size (N) already ACK'ed sent, not yet ACK'ed usable, not yet sent not usable As segs are ACK ed, window slides to right GBN is a sliding-window protocol
GBN in Action Sender send seg0 Receiver N =? sendbase? next_seqnum? send seg1 send seg2 send seg3 wait rcv ACK0 send seg4 rcv ACK1 send seg5 seg2 timeout resend seg2 resend seg3 resend seg4 resend seg5 X rcv seg0 send ACK0 rcv seg1 send ACK1 rcv seg3 (discard) send ACK1 rcv seg4 (discard) send ACK1 rcv seg5 (discard) send ACK1 rcv seg2 (deliver) send ACK2 rcv seg3 (deliver) send ACK3 29
The Good, Bad, Ugly GBN has minimal state at ends especially receiver Why discard segs received out-of-order? Don t want to buffer them, going to be re-sent anyway Ugly: A single segment error can cause many segments to be retransmitted 30
traceroute RDT Theory and Tools Stop-and-wait Protocol Motivates Pipelining Sliding-window Protocols Go-back-N (GBN) Selective Repeat (SR) 31
Selective Repeat Receiver individually ACKs all correctly received segments Buffers segs for eventual in-order delivery Sender only resends segments for which ACK not received Sets timer for each segment Sender window of N consecutive seq#s Limits seq#s of sent, but unacked segs 32
SR: Windows send_base nextseqnum already ACK'ed sent, not yet ACK'ed Sender window size (N) usable, not yet sent not usable already received acceptable (within window) Receiver rcv_base window size (N) buffered and ACK'ed (out of order) not usable A different view of the situation!
Sender Data from app-layer if next_seqnum in window, send segment else buffer timeout (n) resend seg n, restart timer ACK(n) in window mark seg n as received if n is smallest unacked seg, send_base = next unacked seq# SR Details Receiver Seg(n) in receive window send ACK(n) if out-of-order: buffer if in-order: deliver all buffered, in-order segs and advance window to not-yet-received segment Seg(n) in [rcvbase-n, rcvbase-1] send ACK(n) other pkt ignore
SR at work Sender Receiver seg0 sent 0 1 2 3 4 5 6 7 seg1 sent 0 1 2 3 4 5 6 7 seg2 sent 0 1 2 3 4 5 6 7 seg3 sent 0 1 2 3 4 5 6 7 (window full, wait) X seg0 rcvd, delivered, ACK0 sent 0 1 2 3 4 5 6 7 8 9 seg1 rcvd, delivered, ACK1 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 seg3 rcvd, buffered, ACK3 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 ACK0 rcvd, seg4 sent 0 1 2 3 4 5 6 7 1 2 3 4 ACK1 rcvd, seg5 sent 0 1 2 3 4 5 6 7 2 3 4 5 seg2 timeout, seg2 resent 0 1 2 3 4 5 6 7 2 3 4 5 ACK 3 rcvd, nothing sent 0 1 2 3 4 5 6 7 2 3 4 5 seg4 rcvd, buffered, ACK4 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 seg5 rcvd, buffered, ACK5 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 seg2 rcvd, ACK2 sent seg2, seg3, seg4, seg5 delivered 0 1 2 3 4 5 6 7 8 9
SR Issues 0 1 2 3 0 1 2 0 1 2 3 0 1 2 0 1 2 3 0 1 2 seg0 seg1 seg2 ACK0 ACK1 0 1 2 3 0 1 2 0 1 2 3 0 1 2 Both sides often have varying view timeout retransmit seg0 0 1 2 3 0 1 2 seg0 X X X ACK2 0 1 2 3 0 1 2 receive segment with seq# 0 Ex: N=3 seq# 0,1,2,3 Two scenarios Receiver side is same Will deliver duplicate data in 1st case 0 1 2 3 0 1 2 0 1 2 3 0 1 2 0 1 2 3 0 1 2 0 1 2 3 0 1 2 seg0 seg1 seg2 seg3 ACK0 ACK1 ACK2 0 1 2 3 0 1 2 0 1 2 3 0 1 2 0 1 2 3 0 1 2 Seq# space is too small 0 1 2 3 0 1 2 seg0 X receive segment with seq# 0
Seq# space Seq# space (2 k ) must be at least twice as large as the window size Sender window and receiver window must both fit in seq# space m-w m-1 Sender already ACK'ed sent, not yet ACK'ed window (w) not usable already received acceptable (within window) Receiver window (w) received and ACK'ed m-w m-1 m m+w-1
Applets Play and experiment GBN and SR protocols plus others from rest of the course Available at textbook website: http://wps.pearsoned.com/ ecs_kurose_compnetw_6/216/55463/14198702.cw/content/ index.html
Tools Summary ACK / NAK Provides feedback from receiver Can also get lost 39
Tools Summary (2) Retransmission Timer Detects loss (sent data or ACK / NAK) Allows for duplicate segments 40
Tools Summary (3) Sequence Numbers Allows detection of duplicate segments Have to be a bounded # bits 41
Tools Summary (4) Sliding windows Allow for reuse of sequence numbers Also allow for pipelining segments Some variety in how this tool is deployed 42
Lesson Objectives Now, you should be able to: describe the purpose, limitations and variations in usage of each RDT tool checksums, receiver feedback, retransmission, sequence numbers, timer expiration, window as well as the network faults each is designed to overcome describe and analyze RDT protocols (including Stop-n- Wait, Go Back N & Selective Repeat) in order to show how each RDT tool is employed describe how changes to the employment scenario for a protocol affects the protocol design choices. An example is receiver-side buffering 43