How do TCP slow start and congestion avoidance work? Trace cwnd over time.
Slow start doubles the congestion window every round trip from a small start until it reaches a threshold (ssthresh). After that, congestion avoidance grows it by about one segment per round trip. On a timeout, ssthresh becomes half the window and cwnd restarts small.
Explain it simply
Joining a busy highway in a new car: you start slowly, then speed up fast while the road looks empty. Once you are near the speed where cars ahead have braked before, you creep up gently. If you hit a jam, you drop speed sharply and begin again.
Example
Assume initial cwnd = 1 segment, ssthresh = 16 segments (units of MSS).
RTT 1 2 3 4 5 6 7
cwnd 1 2 4 8 16 17 18
|--slow start--| |-- congestion avoidance --|
Timeout when cwnd = 20:
ssthresh = 20 / 2 = 10
cwnd = 1 -> slow start again until 10, then +1 per RTTReal stacks usually start with 10 segments, not 1, but the shape is the same: exponential growth, then linear growth, then a cut when loss appears. This produces the saw-tooth graph you see in textbooks. The aim is to find the network's capacity without having to be told what it is.
What to say in the interview
"Slow start grows cwnd exponentially, doubling each round trip, until ssthresh. Then congestion avoidance adds roughly one MSS per round trip. On a timeout, ssthresh is set to half of cwnd and cwnd drops to the initial value. The result is the saw-tooth pattern."
Common mistakes
- Calling slow start slow. It is exponential; it is slow only relative to starting at full speed.