No one tells a TCP sender how much bandwidth is available — it has to discover it, and keep re-discovering it as conditions change, all while sharing the link fairly with everyone else. It does this by adjusting a congestion window (cwnd): how much unacknowledged data it will keep in flight. It starts cautious and grows the window exponentially to quickly find the ballpark (slow start), then switches to growing linearly to probe gently for more (congestion avoidance). The instant a packet is lost — the network’s way of saying “too much” — it halves the window and probes again. This additive-increase / multiplicative-decrease (AIMD) loop produces the iconic sawtooth that, remarkably, makes millions of independent senders converge to a fair, stable share. Grow the window, inject a loss, and watch it recover.
AIMD · slow start (exponential) → congestion avoidance (linear) → halve on loss · fair & stable
cwnd
The congestion window — how much unacknowledged data the sender keeps in flight.
slow start
Grow cwnd exponentially (double each RTT) until reaching the threshold.
congestion avoidance
Above the threshold, grow cwnd linearly (+1 per RTT) — gentle probing.
AIMD
Additive increase, multiplicative decrease: +1 per RTT, halve on loss.
tcp.js — additive up, multiplicative down
Ready
The congestion window starts small and grows each round-trip: exponentially in slow start, then linearly in congestion avoidance. Inject loss to halve it. Each RTT advances one round and plots the window. Build the sawtooth.
1
cwnd
16
ssthresh
slow start
phase
How it works
The genius of AIMD is that its two asymmetric rules produce fairness and stability from purely local decisions. Additive increase (nudge cwnd up by one segment per round-trip during congestion avoidance) makes senders probe for spare capacity slowly and gently, so they don’t all rush in and overwhelm the link. Multiplicative decrease (halve cwnd on a loss) backs off aggressively the moment the network signals overload, clearing congestion fast. When several flows share a bottleneck, the flow using more bandwidth loses more on each halving (it has more to lose), so repeated AIMD cycles pull the flows toward an equal share — this is why the internet doesn’t collapse under load even though no one coordinates it. Slow start is the launch phase: because a new connection has no idea of the capacity, doubling cwnd each RTT finds the right order of magnitude in just a handful of round-trips, then hands off to the gentle linear probing of congestion avoidance once it nears the last-known-good threshold (ssthresh).
1
Slow start: grow exponentially
A new connection starts with a tiny window and doubles it every round-trip, rapidly discovering the rough capacity of the path in just a few RTTs.
2
Congestion avoidance: grow linearly
Once the window reaches the threshold (ssthresh), the sender switches to adding just one segment per RTT — probing gently for any extra bandwidth without overshooting.
3
Loss → multiplicative decrease
A lost packet means the network is overloaded. The sender sets ssthresh to half the current window and cuts the window (to half, in modern TCP fast-recovery), then resumes probing.
✓
The sawtooth, and fairness
Repeating additive-increase then multiplicative-decrease traces a sawtooth. Across many flows sharing a link, the heavier user loses more per halving, so the flows converge to a fair, stable share — with no coordination.
Slow start
cwnd ×2 / RTT
Avoidance
cwnd +1 / RTT
On loss
cwnd ÷2
Result
fair sawtooth
The code
# TCP congestion control (Reno-style), per round-tripon ack: # a successful round-tripif cwnd < ssthresh:
cwnd *= 2 # slow start: exponentialelse:
cwnd += 1 # congestion avoidance: linearon packet_loss: # the network says "too much"
ssthresh = cwnd / 2
cwnd = ssthresh # multiplicative decrease (fast recovery)# (classic Tahoe drops cwnd to 1 and re-enters slow start)
The picture: one connection, two losses
The lab’s rules on a path that holds 20 segments. Four doublings take cwnd from 1 to the threshold of 16. Five +1 steps push it to 21, one more than the path holds, and a packet drops. The window halves to 10, ssthresh moves down with it, and the climb starts again. After the first loss the connection never sees slow start again; it lives on the sawtooth.
Worked example: one connection, RTT by RTT
Same rules as the lab, same starting values (cwnd 1, ssthresh 16). Say the path can hold 20 segments in flight. A 21st is dropped.
RTT
What happens
cwnd
ssthresh
1–3
Below ssthresh: double each round
2, 4, 8
16
4
Double, capped at ssthresh
16
16
5–8
At ssthresh: +1 per round
17 → 20
16
9
+1 again: 21 in flight, one too many
21
16
10
Drop detected: ssthresh = ⌊21/2⌋, cwnd = ssthresh
10
10
11–21
+1 per round, 11 rounds
11 → 21
10
22
Same overshoot, same halving
10
10
The steady cycle is RTTs 10 to 21: 12 rounds carrying 10 + 11 + … + 21 = 186 segments, an average of 15.5 per round against a path that holds 20. That is 77.5% of the link. With 1,460-byte segments and a 50 ms RTT it works out to 3.62 Mbit/s on a 4.67 Mbit/s path. Run the same path with classic Tahoe (drop to 1 and slow-start back to ssthresh 10) and one cycle becomes 1, 2, 4, 8, 10, 11 … 21: 16 rounds averaging 12.56, or 62.8%. Halving instead of resetting is worth 15 points of utilisation here. The rest is lost because the window spends half its time well below the path’s capacity, and that is why routers carry a queue: buffered packets keep the link busy while cwnd is low.
Cost and trade-offs: how long each phase takes
Time here is counted in round-trips; the state is a handful of numbers per connection and nothing at all in the routers. A well-known rule of thumb (Mathis et al.) puts a steady loss-based flow at about (MSS / RTT) × 1.22 / √p for loss rate p: with 1,460-byte segments, a 100 ms RTT and one loss in 10,000 packets, about 14.3 Mbit/s, however fast the link.
Case
Time
Space
Why
Slow start up to window W
⌈log₂ W⌉ RTTs
cwnd, ssthresh
Doubling. 16 segments in 4 RTTs.
Reno recovery after a loss at W
W/2 RTTs
same
Climbs back from W/2 by one per round.
Tahoe recovery after a loss at W
≈ log₂(W/2) + W/2 RTTs
same
Slow start to W/2 first, then the linear climb.
Reno on 10 Gbit/s, 100 ms, 1,500 B
41,667 RTTs ≈ 69 min
83,333-segment window
One loss costs over an hour of linear climbing; the gap CUBIC and BBR target.
N flows on one bottleneck
converge in a few cycles
O(1) per flow
Each halving halves the gap between flows; +1 never changes it.
The fairness row is easy to check by hand. Two flows share a link that holds 30. One starts at 24, the other at 4. Each round both add 1; when the total passes 30, both halve (rounded down). The losses hit at 26 + 6, 21 + 11, 18 + 13, 17 + 14 and then 16 + 15 every time after: the gap goes 20, 10, 5, 3, 1. The 69-minute row is the same arithmetic at scale: a window of 83,333 segments halves to 41,667 and needs 41,667 round-trips of +1 to climb back, while slow start from a window of 1 would reach 83,333 in 17 doublings. That asymmetry is why CUBIC grows quickly while it is far below the window where it last lost a packet, and slows down only as it gets close.
Common mistakes
Judging a path by a short download
A short transfer never leaves slow start. With an initial window of 10 segments, a 100 kB file (69 segments of 1,460 bytes) is done in 3 rounds: 10 + 20 + 40. Its speed measures the RTT, not the bandwidth.
Thinking every loss is handled by halving
Halving is the fast-recovery path, taken when duplicate ACKs reveal a single missing segment. If ACKs stop altogether and the retransmission timer fires, Reno-style senders drop cwnd to 1 and slow-start again, as Tahoe does.
Reading ssthresh as the capacity
It is only half the window at the last loss: a guess at where it is safe to stop doubling. In the example it sits at 10 on a path that holds 20.
Adding buffer to cure loss
A deeper router queue postpones the drop, so cwnd grows past the path’s capacity and the extra packets wait in line. Throughput barely moves and every packet’s latency rises: bufferbloat.
Forgetting fairness is per flow
AIMD splits a bottleneck evenly between connections, not users. An application that opens four connections gets four shares, which is why many parallel streams look fast in a test and unfair in a shared network.
Where this shows up
On your own machine
On Linux, sysctl net.ipv4.tcp_congestion_control names the algorithm in use, and ss -ti prints each live connection’s cwnd, ssthresh and RTT: the same three numbers the lab plots.
QUIC runs over UDP, so it carries its own congestion controller in user space. The one its specification describes is NewReno-style: slow start, linear growth, halve on loss.
ECN in data centres
With Explicit Congestion Notification, a router with a growing queue marks packets instead of dropping them, and the sender backs off as if one were lost, without the retransmission. DCTCP goes further and cuts in proportion to the share of packets marked.
Interview angle
Expect: draw the sawtooth, say why it is fair (the two-flow trace above), separate flow control from congestion control, and estimate recovery time (W/2 RTTs). The history helps too: slow start and congestion avoidance came from Van Jacobson’s 1988 work after the internet’s 1986 congestion collapses.
Quick check
1. How does the congestion window grow during slow start?
Slow start doubles cwnd every RTT (despite the name), so a new connection finds the rough capacity of the path in just a few round-trips. It switches to linear growth once cwnd reaches the ssthresh threshold.
2. What does TCP do when it detects packet loss?
Loss signals congestion, so TCP backs off hard: it sets ssthresh to half the current window and reduces cwnd (to half in modern fast-recovery, to 1 in classic Tahoe), then resumes probing. Aggressive backoff clears congestion quickly.
3. Why does AIMD lead to fairness among competing flows?
Multiplicative decrease means the flow with the larger window loses more absolute bandwidth on each loss event, while additive increase treats everyone equally. Over many cycles this drives competing flows toward an equal, fair share — with no coordination.
FAQ
What is TCP congestion control?
How a TCP sender adjusts its rate to avoid overwhelming the network, discovering bandwidth without being told it. It maintains a congestion window (cwnd) limiting in-flight data, grows it when healthy (exponential slow start, then linear avoidance), and shrinks it on congestion (loss/delay). The classic scheme is AIMD.
What is the difference between flow control and congestion control?
Flow control protects the receiver (its advertised receive window caps in-flight data so a slow receiver isn’t overwhelmed). Congestion control protects the network (the sender infers a congestion window from loss/delay). The sender’s real limit is the minimum of the two windows.
What are the different TCP congestion control algorithms?
Tahoe/Reno are classic loss-based (Reno adds fast recovery). CUBIC (Linux default) grows the window as a cubic of time since last loss, scaling better on fast high-latency links. BBR (Google) is model-based — it estimates bottleneck bandwidth and RTT and paces to match. Others: Vegas (delay-based), DCTCP (data centers).
Why does loss mean congestion in TCP?
On wired links, packets are rarely lost to corruption — the usual cause is a router queue overflowing from too much traffic, so TCP treats loss as an implicit "too fast" signal and backs off. This breaks on lossy wireless (corruption loss isn’t congestion), which motivated delay/model-based schemes like BBR.