Sub topic 8
Congestion control: slow start, congestion avoidance, Tahoe and Reno
This chapter assumes you know how TCP sequence numbers and acknowledgements work, what a round-trip time (RTT) is, and how the receiver window limits the sender. It builds on flow control and leads into the throughput calculations in the next chapter.
Why TCP needs congestion control
Flow control protects the receiver. Congestion control protects the network between the two hosts. A sender whose receiver window is large can still overload a router, because the router's queue fills and it drops packets. The sender cannot see the routers, so TCP infers congestion from its own evidence: a retransmission timeout, or three duplicate ACKs.
The sender keeps a second window, the congestion window (cwnd). At any moment it may have at most this much unacknowledged data in flight:
effective window = min(rwnd, cwnd)Here rwnd is the receiver's advertised window. Whichever limit is smaller controls the sending rate. GATE questions often add a twist where rwnd is the smaller one, so cwnd stops mattering.
The two growth phases
TCP also keeps a slow start threshold (ssthresh) that divides the two phases. Both variables are measured in MSS (maximum segment size) in most exam problems.
- Slow start:
cwndstarts at 1 MSS. Each ACK adds 1 MSS, socwnddoubles every RTT. Growth is exponential, and the name refers only to the small starting value. - Congestion avoidance (CA): once
cwndreachesssthresh,cwndgrows by about 1 MSS per RTT. Per ACK, the increase is MSS × MSS / cwnd. Growth is linear.
Together with the multiplicative cut on loss, this linear growth is called AIMD (additive increase, multiplicative decrease). Because TCP probes upward slowly and backs off sharply, flows sharing a link tend to converge toward fair shares.
Reacting to loss: Tahoe versus Reno
TCP detects loss in two ways, and the two signals mean different things.
- Timeout: no ACK arrived at all. This suggests serious congestion.
- Three duplicate ACKs: a later segment got through, so the network is still delivering some packets. This suggests milder congestion, and the sender can fast retransmit the missing segment without waiting for the timer.
On either signal, both variants set ssthresh = max(cwnd / 2, 2), using the cwnd at the moment of loss. They differ in what happens to cwnd.
| Event | Tahoe | Reno |
|---|---|---|
| Timeout | ssthresh = cwnd/2, cwnd = 1, slow start | ssthresh = cwnd/2, cwnd = 1, slow start |
| 3 duplicate ACKs | ssthresh = cwnd/2, cwnd = 1, slow start | ssthresh = cwnd/2, cwnd = ssthresh, fast recovery, then congestion avoidance |
Tahoe treats every loss as severe. Reno treats a timeout as severe and three duplicate ACKs as mild, so it avoids the slow-start climb and keeps throughput higher.
Simulating the window per RTT
The program below models one round per loop iteration. It prints cwnd at the start of each round. A loss occurs in round 10, and you can choose the variant and the loss type.
def run(variant, loss_kind, loss_round=10, rounds=16, ssthresh=16):
"""Return cwnd (in MSS) at the start of each RTT round."""
cwnd = 1
series = []
for rtt in range(1, rounds + 1):
series.append(cwnd)
if rtt == loss_round:
ssthresh = max(cwnd // 2, 2)
if variant == "reno" and loss_kind == "dup3":
cwnd = ssthresh # fast recovery, simplified
else:
cwnd = 1 # Tahoe, or any timeout
elif cwnd < ssthresh:
cwnd = min(cwnd * 2, ssthresh) # slow start, capped at ssthresh
else:
cwnd += 1 # congestion avoidance
return series
for variant in ("tahoe", "reno"):
print(variant, run(variant, "dup3"))The output is:
tahoe [1, 2, 4, 8, 16, 17, 18, 19, 20, 21, 1, 2, 4, 8, 10, 11]
reno [1, 2, 4, 8, 16, 17, 18, 19, 20, 21, 10, 11, 12, 13, 14, 15]Both runs reach cwnd = 21 in round 10, so ssthresh becomes 10. Tahoe restarts at 1 and needs five more rounds to get back to 10. Reno resumes at 10 and is already at 15 by round 16.
A worked GATE-style example
A sender has ssthresh = 16 MSS and begins at cwnd = 1. Assume no rwnd limit. A timeout occurs when cwnd = 18. What are cwnd and ssthresh after the 4th RTT following the timeout?
- Before the loss, the windows are 1, 2, 4, 8, 16 (slow start), then 17, 18 (congestion avoidance).
- At the timeout,
ssthresh = 18 / 2 = 9andcwnd = 1. - Slow start restarts: 1 at the loss, 2 after 1 RTT, 4 after 2 RTTs, 8 after 3 RTTs.
- After the 4th RTT,
cwndwould be 16, but the cap atssthresh = 9gives 9.
So cwnd = 9 and ssthresh = 9. In the 5th RTT, cwnd becomes 10.
Common errors
- Halving the wrong value.
ssthreshis half ofcwndat the time of loss. It is not half of the oldssthresh. - Applying Reno's rule to a timeout. A timeout drops
cwndto 1 in both variants. Only three duplicate ACKs differ. - Forgetting the minimum.
ssthreshnever goes below 2 MSS. Ifcwndis 3, thenssthresh = 2, not 1. - Counting rounds from the wrong point. State whether the value is "at the start of" or "after" a round, and keep that convention through the whole problem.
- Ignoring rwnd. If
rwndis 10 MSS, the sender cannot send more than 10 MSS even whencwndis 40. - Using bytes for MSS-based answers. If the question gives an MSS of 1 KB, convert at the end.
Exercises
Exercise
TCP Tahoe starts with cwnd = 1 MSS and ssthresh = 32 MSS. A timeout occurs when cwnd = 40 MSS. How many RTTs after the timeout does cwnd first equal the new ssthresh, assuming cwnd is capped at ssthresh in slow start?
Show answer
The new ssthresh is 40 / 2 = 20 and cwnd restarts at 1. The sequence is 1, 2, 4, 8, 16, then min(32, 20) = 20. That is 5 RTTs after the timeout.
Exercise
A Reno sender is in congestion avoidance with cwnd = 24 MSS when three duplicate ACKs arrive. Using the simplified model, what are cwnd and ssthresh after the loss, and what is cwnd one RTT later? How would Tahoe differ?
Show answer
ssthresh = 24 / 2 = 12 and cwnd = 12. One RTT later, in congestion avoidance, cwnd = 13. Tahoe sets cwnd = 1 with ssthresh = 12, so it would restart slow start and need four RTTs (1, 2, 4, 8, then 12) to return to 12.
Exercise
A sender has rwnd = 12 MSS. Tahoe reaches cwnd = 16 MSS with no loss. How many MSS can it have outstanding?
Show answer
The effective window is min(rwnd, cwnd) = min(12, 16) = 12 MSS.