CS 457 – Lecture 5 Reliable Delivery Part 2 Fall 2011
Stop and Wait in Action
Stop and Wait In Action (2)
How Long Should Sender Wait? • Sender sets a timeout to wait for an ACK – Too short: wasted retransmissions – Too long: excessive delays when packet lost • TCP sets timeout as a function of the RTT – Expect ACK to arrive after an RTT – … plus a fudge factor to account for queuing • But, how does the sender know the RTT? – Can estimate the RTT by watching the ACKs – Smooth estimate: keep a running average of the RTT • EstimatedRTT = a * EstimatedRTT + (1 –a ) * SampleRTT – Compute timeout: TimeOut = 2 * EstimatedRTT
Example RTT Estimation
Performance of Stop and Wait Example: (good test question) 1 Gbps link (1 *10^9 bits/sec), 15 ms propagation delay 8000 bit packet How does stop and wait perform?
Performance of Stop and Wait • ignore • + T + T Delay = T Transmit queue + prop L (packet length in bits) 8kb/pkt T Transmit = R (transmission rate, bps) = = 8 us 10**9 b/s Delay = 8 us + 15 ms = 15.008 ms – Utilization = fraction of time sender is busy sending . 008 L / R U = = 0.00027 = sender 30.008 RTT + L / R microsec – 1KB packet every 30 ms -> only 33KB/s throughput over 1 Gbps link
Stop-and-Wait Operation • sender • receiver • first bit transmitted, t = 0 • last bit transmitted, t = L / R • first bit arrives • RTT • last bit arrives, send ACK • ACK arrives, send next • packet, t = RTT + L / R . 008 L / R U = = 0.00027 = sender 30.008 RTT + L / R microsec
Motivation for Sliding Window • Stop-and-wait is inefficient – Only one frame is “in flight” at a time – Especially bad when delay-bandwidth product is high • Another Numerical example – 1.5 Mbps link with a 45 msec round-trip time (RTT) • Delay-bandwidth product is 67.5 Kbits (or 8 KBytes) – But, sender can send at most one packet per RTT • Assuming a segment size of 1 KB (8 Kbits) • … leads to 8 Kbits/segment / 45 msec/segment 182 Kbps • That’s just one-eighth of the 1.5 Mbps link capacity
Sliding Window • Allow a larger amount of data “in flight” – Allow sender to get ahead of the receiver – … though not too far ahead • Sending process � • Receiving process � • TCP � • TCP � • Last byte read � • Last byte written � • Next byte expected � • Last byte ACKed � • Last byte received � • Last byte sent �
Pipelined Protocols Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged packets – range of sequence numbers must be increased – buffering at sender and/or receiver • Two generic forms of pipelined protocols: go-Back-N (GBN) or selective repeat (SR)
Pipelining: Increased Utilization • sender • receiver • first bit transmitted, t = 0 • last bit transmitted, t = L / R • first bit arrives • RTT • last bit arrives, send ACK • last bit of 2 nd packet arrives, send ACK • last bit of 3 rd packet arrives, send ACK • ACK arrives, send next • packet, t = RTT + L / R • Increase utilization • by a factor of 3! . 024 3 * L / R U = = 0.0008 = sender 30.008 RTT + L / R microsecon
Go-Back-N Sender: • k-bit seq # in packet header • “window” of up to N, consecutive unACK’ed pkts allowed • ACK(n): cumulative ACK – ACKs all pkts up to and including seq # n – may receive duplicate ACKs (see receiver) • timer for each in-flight packet • timeout(n): retransmit packet n and all higher seq # packets in window
GBN in action
Selective Repeat • Receiver individually acknowledges all correctly received packets – buffers packets, as needed, for eventual in-order delivery to upper layer • Sender only resends packets for which ACK not received – sender timer for each unACKed packet • Sender window – N consecutive seq #’s – again limits seq #s of sent, unACKed packets
Selective Repeat: Sender, Receiver Windows
Selective Repeat • receiver • sender • packet n in [rcvbase, rcvbase data from above : +N-1] • if next available seq # in • send ACK(n) window, send packet • out-of-order: buffer timeout(n): • in-order: deliver (also deliver • resend packet n, restart buffered, in-order packets), timer advance window to next not- ACK(n) in [sendbase,sendbase+N]: yet-received packet • mark packet n as received • packet n in [rcvbase- • if n smallest unACKed pkt, N,rcvbase-1] advance window base to next unACKed seq # • ACK(n) • otherwise: ignore •
Selective Repeat in Action
Selective Repeat and Seq Numbers Example: • seq #’s: 0, 1, 2, 3 • window size=3 • receiver sees no difference in two scenarios! • incorrectly passes duplicate data as new in (a) Q: what relationship between seq # size and window size?
What’s Next • Read Chapter 1 and 2.1-2.7 • Next Lecture Topics from Chapter 2.6 and 2.7 – Ethernet • A critical topic in networking • Homework – Homework Due Thurs • Project 1 – Due 9/16 at 11:45pm.
Recommend
More recommend