Sub topic 6
Reliable Delivery: Timeouts, Retransmission, and Fast Retransmit
Assume you know TCP segment headers, sequence numbers, acknowledgement numbers, and the three-way handshake. This chapter explains how TCP detects lost data and sends it again.
TCP provides a reliable byte stream even though the network may lose, duplicate, delay, or reorder packets. The sender numbers each byte. The receiver sends acknowledgements (ACKs) that usually report the next byte it expects.
For example, if a receiver has correctly received bytes through 1499, it sends ACK 1500. This is a cumulative acknowledgement: one ACK confirms all earlier bytes too.
Detecting loss with a timeout
When TCP sends data, it starts or updates a retransmission timer for the oldest unacknowledged segment. If the timer expires before the expected ACK arrives, TCP assumes that the segment or its ACK was lost and retransmits the segment.
The timeout interval is called the retransmission timeout, or RTO. TCP estimates it from measured round-trip times (RTTs). A practical estimate allows extra time for variation in network delay:
- A stable RTT leads to a smaller RTO.
- A highly variable RTT leads to a larger RTO.
- After a timeout, TCP usually increases the RTO using exponential backoff.
A sender must not choose an RTO equal to the average RTT alone. Normal delay variation could then cause unnecessary retransmissions.
TCP also avoids using an RTT measurement from a segment that was retransmitted. If the ACK arrives, the sender cannot know whether it acknowledges the first transmission or the retransmission. This rule is commonly associated with Karn's algorithm.
Duplicate ACKs and fast retransmit
TCP acknowledgements are cumulative. If a receiver gets a segment that comes after a missing segment, it cannot advance its cumulative ACK. It usually sends the same ACK again. These are duplicate ACKs.
Suppose segments begin at the following sequence numbers:
| Segment | Sequence number | Result |
|---|---|---|
| 1 | 1000 | Received |
| 2 | 1500 | Lost |
| 3 | 2000 | Received out of order |
After receiving segment 3, the receiver still expects byte 1500, so it sends ACK 1500 again. If later segments also arrive, they produce more duplicate ACKs. After three duplicate ACKs, TCP assumes that the missing segment is probably lost and retransmits it immediately. This mechanism is called fast retransmit because it does not wait for the timer to expire.
Timeout versus fast retransmit
A timeout usually indicates more serious congestion or a larger delay. TCP responds by reducing its sending rate sharply. Fast retransmit detects loss earlier, often while other segments are still reaching the receiver. TCP congestion-control algorithms such as Reno therefore use a less severe response during fast recovery than after a timeout.
For numerical questions, track these facts:
- The ACK number is the next expected byte.
- A missing segment causes duplicate cumulative ACKs.
- Three duplicate ACKs trigger fast retransmit in the standard Reno model.
- A timer expiration triggers timeout retransmission.
- Retransmission improves reliability, but congestion control must reduce traffic after suspected loss.
Exercise
A receiver has acknowledged through byte 4999 and receives bytes beginning at 5500. What ACK number will it normally send, and what does the sender infer after receiving three such duplicate ACKs?
Show answer
It sends ACK 5000 because byte 5000 is the next expected byte. After three duplicate ACKs, the sender infers that the segment beginning at byte 5000 was probably lost and performs a fast retransmission.