The idea
Flow control, from the previous topic, keeps a fast sender from overrunning one specific receiver’s buffer. It says nothing about the routers and links in between, which can be shared by many connections at once and can overflow even when every receiver is keeping up fine. That separate failure mode — the network itself getting overloaded — is what congestion control exists to manage.
How it works
Flow control vs. congestion control
Flow control guarantees the receive window is never overflowed — no congestion at the receiving end. It does not guarantee the intermediate buffers inside the network stay clear; those can still be overflowed. Congestion control is the set of mechanisms and techniques used to control congestion and keep the network’s load below its capacity.
How it works
The congestion window
cwnd, the congestion window, has its value determined by the congestion situation in the network — separately from rwnd, which the receiver sets based on its own buffer. Together, cwnd and rwnd define the size of the send window.
- cwnd
- Congestion window, set by the sender based on network conditions
- rwnd
- Receive window, set by the receiver based on its buffer
How it works
Congestion control categories
- Open loop — prevent congestion before it happens.
- Closed loop — alleviate congestion after it has already happened.
How it works
TCP's three phases
TCP’s general policy for handling congestion runs through three phases: slow start, congestion avoidance, and congestion detection.
How it works
Phase 1 — slow start (exponential increase)
cwnd starts at one maximum segment size (MSS), or some other starting number, and increases by one MSS each time an ACK arrives — until cwnd reaches the slow-start threshold (ssthresh). Because every ACK received increases cwnd, and more segments are in flight each round, cwnd effectively doubles every RTT: this is exponential growth in terms of round-trip times.
- n
- Number of round-trip times elapsed since slow start began
Worked example
Slow start's exponential growth
Start: cwnd = 1 (2⁰).
After 1 RTT: cwnd = cwnd + 1 = 2 (2¹).
After 2 RTT: cwnd = cwnd + 2 = 4 (2²).
After 3 RTT: cwnd = cwnd + 4 = 8 (2³).
After n RTT: cwnd = cwnd + 2^(n−1) = 2^n.
AnswerAfter n RTT, cwnd = 2^n.
How it works
Phase 2 — congestion avoidance (additive increase)
Once ssthresh is reached, cwnd’s growth switches from exponential to additive: if an ACK arrives, cwnd = cwnd + n, growing linearly in terms of round-trip times, until congestion is detected.
- i
- Congestion window size when congestion avoidance began
- n
- Number of round-trip times elapsed since congestion avoidance began
Worked example
Congestion avoidance's linear growth
Start: cwnd = i.
After 1 RTT: cwnd = i + 1.
After 2 RTT: cwnd = i + 2.
After 3 RTT: cwnd = i + 3.
After n RTT: cwnd = i + n.
AnswerAfter n RTT, cwnd = i + n, where i is the window size when this phase began.
How it works
Phase 3 — congestion detection
Congestion is detected two ways, and TCP reacts differently to each:
By timeout (no ACKs received at all). A stronger sign of congestion, so TCP acts strongly:
- Sets the threshold (ssthresh) to one-half the current window size.
- Sets cwnd to 1 MSS (or whatever the starting value is).
- Restarts slow start from the beginning.
By three duplicate ACKs (some ACK is missing, but most segments are still arriving). A weaker sign of congestion, so TCP acts weakly:
- Sets the threshold (ssthresh) to one-half the current window size.
- Sets cwnd to the threshold’s new value directly.
- Starts congestion avoidance, skipping slow start entirely.
The fast retransmit covered in the previous topic — triggered by the same three-duplicate-ACK condition — is the retransmission half of this response; the ssthresh and cwnd adjustment above is the congestion-control half.
| Timeout | Three duplicate ACKs | |
|---|---|---|
| Signal strength | Strong — nothing is getting through | Weak — most segments are arriving |
| ssthresh | Half the current window | Half the current window |
| cwnd | Reset to 1 MSS | Set to the new ssthresh |
| Next phase | Slow start, from scratch | Congestion avoidance, directly |
Where marks get lost
Duplicate ACKs do not reset cwnd all the way to 1
It is tempting to treat both congestion-detection triggers the same way, since both halve ssthresh. They do not do the same thing to cwnd: a timeout drops cwnd to 1 MSS and restarts slow start; three duplicate ACKs drop cwnd only to the new ssthresh and go straight into congestion avoidance. Confusing the two loses the distinction the lecture is testing.
Aside
The slides’ complete state-transition diagram for TCP’s congestion policy — covering states A through E and the transitions between them — did not survive extraction. Only the three named phases and the two detection triggers above are given directly in the source.
How it works
A partial worked example
The lecture sets up one numeric scenario: cwnd grows exponentially from slow start; at cwnd = 12, some ACKs go missing, giving ssthresh = 12 / 2 = 6; at cwnd = 20, all ACKs go missing, giving ssthresh = 20 / 2 = 10.
Aside
This example’s own numeric trace does not fully survive extraction, and the transition list the slide gives is not internally consistent with the general rule stated above: the general rule says a timeout (all ACKs missing) resets cwnd to 1 MSS and restarts slow start, but the slide’s own transition list for the “all ACKs missing” step names “congestion avoidance window” as the outcome instead. This page does not attempt to reconcile that inconsistency or invent the missing numeric trace — apply the general rule above (stated directly and unambiguously) rather than this example’s own last step if the two conflict on an exam question.
In the exam
- Flow control protects the receiver’s buffer; congestion control protects the network’s. A question that conflates the two is testing exactly this distinction.
- Actual window size = min(cwnd, rwnd). State the formula and identify which of the two is the binding constraint in a given scenario.
- Slow start doubles cwnd every RTT (2^n); congestion avoidance adds one per RTT (i + n). Know which formula applies in which phase.
- Timeout vs. triple duplicate ACK is the exam-favourite pair. Both halve ssthresh. Only a timeout resets cwnd to 1 MSS and restarts slow start; three duplicate ACKs set cwnd to the new ssthresh and go straight to congestion avoidance.
- Fast retransmit and the congestion-control response to triple duplicate ACKs happen together, triggered by the same event, but they are two different mechanisms — one resends data, the other adjusts cwnd/ssthresh.
Check yourself
- Flow control stops the receiver’s buffer overflowing; congestion control stops the network’s buffers overflowing — not the same guarantee.
- The actual send window is always the smaller of cwnd and rwnd.
- Slow start grows cwnd exponentially (2^n per RTT) up to ssthresh; congestion avoidance then grows it additively (i + n per RTT).
- A timeout is congestion control’s strong response: halve ssthresh, reset cwnd to 1 MSS, restart slow start. Three duplicate ACKs are the weak response: halve ssthresh, set cwnd to that new threshold, go straight to congestion avoidance.