Recall warm-up
- What is the difference between flow control and congestion control?
Stuck? Peek at 4.3.4 TCP timeout estimation: EWMA, Jacobson’s algorithm & Karn’s rule
- EWMA:
Est_new = (1 − α)·Est_old + α·Sample = Est_old + (Sample − Est_old)·α(defaultα = 1/8). - Deviation & RTO:
Dev_new = (1 − β)·Dev_old + β·|Sample − Est|(defaultβ = 1/4);RTO = Est + 4·Dev. - Karn's rule: ignore RTT samples from retransmitted segments; double
RTOon each timeout.
- EWMA:
- If a sender knows both the receiver’s advertised window rwnd and its own congestion window cwnd, how much unacknowledged data can it have in flight?
Stuck? Peek at 4.3.3 TCP flow control (rwnd), sequence wrap-around time & window scaling
- Flow control:
rwnd = RcvBuffer − (LastByteRcvd − LastByteRead); sender keepsBytesInFlight ≤ rwnd. - Zero window (`rwnd = 0`): sender runs Persist Timer and sends 1-byte Zero-Window Probes.
- Wrap-around time:
T_wrap = (2³² × 8) / Bseconds (34.36 s at 1 Gbps). - Window scaling:
True rwnd = HeaderWindow × 2ˢ(S ≤ 14, negotiated inSYN).
- Flow control:
- Which is a milder sign of network congestion: a Retransmission Timeout (RTO) or receiving 3 Duplicate ACKs?
Stuck? Peek at 1.2.2 Packet switching: store-and-forward, datagrams, statistical multiplexing
- Packet switching: packets with headers; no reservation; full link rate while sending.
- Store-and-forward: receive whole packet → buffer/queue → forward; full buffer → loss.
- Datagram: each packet routed independently; may reorder; robust to failures.
- Statistical multiplexing: share capacity on demand; P(exactly k of n) = C(n,k)pᵏ(1−p)ⁿ⁻ᵏ.
The Hook
Suppose the receiver has a huge 10 MB buffer (rwnd = 10 MB), so flow control says "send at full blast!" If 1,000 senders immediately dump 10 MB into a bottleneck router with a 64 KB queue, almost every packet is dropped, everyone times out and retransmits, and throughput collapses to near zero (congestion collapse).
How does a TCP sender probe the network's unknown capacity without any router telling it the link rate? By maintaining a Congestion Window (cwnd) and running a brilliant state machine: Slow Start, Congestion Avoidance (AIMD), and Fast Retransmit / Fast Recovery (Tahoe vs Reno)!
Predict First
Why is TCP's initial phase called "Slow Start" when it actually doubles cwnd every RTT (exponential growth: 1 → 2 → 4 → 8 → 16 MSS)?
Because before Slow Start was invented by Van Jacobson in 1988, a new TCP connection immediately dumped an entire rwnd worth of segments (e.g., 64 KB = 44 segments) into the network in RTT 1! Starting at 1 MSS was "slow" compared to dumping 44 segments at once — even though it probes upward exponentially!
Core Concept
Effective Window: W = min(cwnd, rwnd)
A TCP sender maintains two window limits simultaneously: the receiver's advertised window rwnd (flow control) and its own Congestion Window cwnd (congestion control), plus a threshold variable called the Slow Start Threshold (ssthresh):
•
Effective Window W = min(cwnd, rwnd) (in bytes or MSS).• Maximum rate at which the sender can inject data =
min(Link Rate B, W / RTT).Phase 1 & 2: Slow Start (Exponential) vs Congestion Avoidance (AIMD Linear)
A new connection starts with cwnd = 1 MSS and a high initial ssthresh:
- Slow Start (when
cwnd < ssthresh):
• Every individual ACK that acknowledges new data increasescwndby+1 MSS.
• Therefore, after one full RTT in which all k segments are ACKed,cwnddoubles:cwnd ← min(2 · cwnd, ssthresh)! - Congestion Avoidance (when
cwnd ≥ ssthresh):
• Oncecwndreachesssthresh, doubling is too aggressive! TCP switches to Additive Increase: each individual ACK increasescwndbyMSS × (MSS / cwnd), so after one full RTT of ACKs,cwndincreases linearly by+1 MSS:cwnd ← cwnd + 1 MSS!
ssthresh:When Slow Start doubling would jump past
ssthresh (for example, cwnd = 4 MSS and ssthresh = 6 MSS), GATE clamps the next RTT to cwnd = min(2 · cwnd, ssthresh) = 6 MSS, and then switches to linear +1 MSS per RTT from there!Reaction to Loss: Timeout vs 3 Duplicate ACKs (TCP Tahoe vs TCP Reno)
When a segment is lost, TCP detects it in one of two ways: either the Retransmission Timeout (RTO) expires (severe congestion), or 3 Duplicate ACKs arrive before timeout (mild congestion — later segments are still reaching the receiver, triggering Fast Retransmit!). In both cases, TCP first cuts the threshold in half (Multiplicative Decrease):
ssthresh ← max(1, ⌊cwnd / 2⌋) (half of the cwnd at the moment of loss).Step 2 (How
cwnd is reset — Tahoe vs Reno):• On a Timeout (BOTH Tahoe and Reno): reset
cwnd ← 1 MSS and re-enter Slow Start!• On 3 Duplicate ACKs in TCP Tahoe: treats 3 dup ACKs just like a timeout → resets
cwnd ← 1 MSS (Slow Start).• On 3 Duplicate ACKs in TCP Reno (Fast Recovery): halves the window instead of resetting to 1! Under GATE's textbook convention, sets
cwnd ← ssthresh and continues directly in Congestion Avoidance (+1 MSS per RTT)!On GATE (and Forouzan / Kurose problem sets), when TCP Reno receives 3 duplicate ACKs at window
cwnd, it sets ssthresh = ⌊cwnd / 2⌋ and cwnd = ssthresh (and then adds +1 MSS per subsequent RTT in Congestion Avoidance). Note: RFC 5681 temporarily inflates cwnd = ssthresh + 3 MSS during Fast Recovery and deflates it to ssthresh when the new ACK arrives — producing the exact same post-recovery window cwnd = ssthresh! Always use cwnd = ssthresh = ⌊cwnd / 2⌋ unless a question explicitly mentions temporary window inflation.| RTT # | Phase / Event (ssthresh₀ = 8) | Reno cwnd (MSS) | Reno ssthresh | Tahoe cwnd (MSS) | Tahoe ssthresh |
|---|---|---|---|---|---|
| 1 | Slow Start | 1 | 8 | 1 | 8 |
| 2 | Slow Start (×2) | 2 | 8 | 2 | 8 |
| 3 | Slow Start (×2) | 4 | 8 | 4 | 8 |
| 4 | Reaches ssthresh → CA | 8 | 8 | 8 | 8 |
| 5 | Congestion Avoidance (+1) | 9 | 8 | 9 | 8 |
| 6 | CA (+1) → 3 Dup ACKs! | 10 (3dup!) | 8 → 5 | 10 (3dup!) | 8 → 5 |
| 7 | After 3 Dup ACKs | 5 (Fast Rec / CA) | 5 | 1 (Slow Start!) | 5 |
| 8 | Next RTT | 6 (CA +1) | 5 | 2 (SS ×2) | 5 |
| 9 | Next RTT → Timeout! | 7 (Timeout!) | 5 → 3 | 4 (Timeout!) | 5 → 2 |
| 10 | After Timeout (both → 1) | 1 (Slow Start) | 3 | 1 (Slow Start) | 2 |
| 11 | Next RTT | 2 (SS ×2) | 3 | 2 (reaches sst=2) | 2 |
Putting it together
- A TCP sender caps unacknowledged data in flight at W = min(cwnd, rwnd).
- Slow Start grows cwnd exponentially (+1 MSS per ACK, doubling per RTT) up to ssthresh; Congestion Avoidance grows cwnd linearly (+1 MSS per RTT).
- Any loss sets ssthresh = ⌊cwnd/2⌋; a timeout resets cwnd = 1 MSS in both Tahoe and Reno, whereas 3 duplicate ACKs reset cwnd = 1 MSS in Tahoe but cwnd = ssthresh in Reno.
Visual
Worked Examples
A TCP connection has MSS = 1 KB, initial cwnd = 1 KB, and ssthresh = 16 KB. Assuming no losses and large rwnd, list the value of cwnd (in KB) for RTT rounds 1 through 7.
Show the full solution
• Rounds 1–5 (Slow Start, doubling until ssthresh = 16 KB): 1, 2, 4, 8, 16 KB.
• Rounds 6–7 (Congestion Avoidance, +1 MSS = +1 KB per RTT): 17, 18 KB.
A TCP Reno connection with MSS = 1 KB has cwnd = 1 KB and ssthresh = 6 KB at RTT 1. Trace cwnd for RTTs 1 to 6 assuming no packet loss.
Show the full solution
• RTT 1: 1 KB (< 6, Slow Start)
• RTT 2: 2 KB (< 6, Slow Start)
• RTT 3: 4 KB (< 6, Slow Start)
• RTT 4: doubling 4 KB would give 8 KB > ssthresh, so clamp at min(8, 6) = 6 KB (reaches ssthresh!)
• RTT 5: Congestion Avoidance (+1 KB) → 7 KB
• RTT 6: Congestion Avoidance (+1 KB) → 8 KB.
A TCP Reno connection with MSS = 2 KB starts at RTT 1 with cwnd = 2 KB (1 MSS) and ssthresh = 16 KB (8 MSS). At the end of RTT 6, the sender receives 3 duplicate ACKs. What are the values of ssthresh and cwnd (in KB) in RTT 7 and RTT 8? What would they be if the sender used TCP Tahoe instead?
Show the full solution
Work in units of MSS first (where 1 MSS = 2 KB, ssthresh₀ = 8 MSS), then multiply by 2 KB at the end!
• RTT 1 to 6: 1 → 2 → 4 → 8 (reaches ssthresh) → 9 → 10 MSS (20 KB) in RTT 6.
• At end of RTT 6 (3 dup ACKs at cwnd = 10 MSS): new ssthresh = ⌊10 / 2⌋ = 5 MSS = 10 KB.
• Under TCP Reno: RTT 7 has cwnd = ssthresh = 5 MSS = 10 KB (CA); RTT 8 has cwnd = 5 + 1 = 6 MSS = 12 KB.
• Under TCP Tahoe: RTT 7 resets cwnd = 1 MSS = 2 KB (SS); RTT 8 doubles to cwnd = 2 MSS = 4 KB.
GATE Traps
- Adding +1 KB instead of +1 MSS when MSS = 2 KB! Always divide all byte/KB values by
MSSat step 0, trace in MSS, and multiply back byMSSat the end! - Forgetting to clamp at
ssthreshwhenssthreshis not a power of 2! Ifcwnd = 4 MSSandssthresh = 6 MSS, the next RTT ismin(8, 6) = 6 MSS, NOT 8 MSS! - Confusing Timeout vs 3 Duplicate ACKs in TCP Reno! On a Timeout, even TCP Reno resets
cwnd = 1 MSS! Only on 3 Duplicate ACKs does Reno setcwnd = ssthresh.
Memory Hook
Work in MSS! Slow Start ×2 (clamped at ssthresh), CA +1 MSS; Loss sets ssthresh = cwnd/2; Timeout → 1 MSS, 3-Dup → 1 (Tahoe) or ssthresh (Reno)!
Connect the Dots
Let's lock in everything from Section 4.3 — TCP header, 3-way handshake, sequence/ACK numbering, wrap-around time, EWMA/Jacobson RTO, and Tahoe/Reno congestion control — in Lock-in L4.3!
Self-Test
- NAT
A TCP Reno connection with MSS = 1 KB starts at RTT 1 with cwnd = 1 KB and ssthresh = 8 KB. Assuming no losses, what is cwnd (in KB) during RTT 6?
Write your answer before opening the key.
- NAT
In the previous question (cwnd = 10 KB during RTT 6, MSS = 1 KB), suppose 3 duplicate ACKs arrive at the end of RTT 6. Under TCP Reno, what is cwnd (in KB) during RTT 8 (assuming no further losses)?
Write your answer before opening the key.
- NAT
If the connection in the previous question used TCP Tahoe instead of TCP Reno (3 duplicate ACKs at the end of RTT 6 when cwnd = 10 KB, MSS = 1 KB), what would cwnd (in KB) be during RTT 8?
Write your answer before opening the key.
- MCQ
During Slow Start (cwnd < ssthresh), how much does a TCP sender increase cwnd upon receiving each individual ACK that acknowledges new data?
- By 1 MSS per individual ACK (which results in doubling cwnd every RTT).
- By 1 MSS per RTT.
- By MSS × (MSS / cwnd) per ACK.
- It keeps cwnd constant until ssthresh is reached.
Rule Card
- Effective window:
W = min(cwnd, rwnd). Always trace in units of MSS! - Slow Start (
cwnd < ssthresh):+1 MSSper ACK →cwnd ← min(2·cwnd, ssthresh)per RTT. - Congestion Avoidance (
cwnd ≥ ssthresh):+1 MSSper RTT (AIMD linear growth). - On Loss:
ssthresh ← ⌊cwnd / 2⌋; Timeout →cwnd = 1 MSS; 3 Dup ACKs →cwnd = 1 MSS(Tahoe) orcwnd = ssthresh(Reno).
Concept Ledger
- cwnd (Congestion Window)
- effective window = min(cwnd, rwnd)
- ssthresh (Slow Start Threshold)
- Slow Start (exponential, +1 MSS per ACK)
- Congestion Avoidance (AIMD, +1 MSS per RTT)
- Fast Retransmit (3 duplicate ACKs)
- Fast Recovery (TCP Reno vs TCP Tahoe)
Answer Vault
Try the questions first. Open when you are ready to check.
Warm-up answers
- Flow control (rwnd) protects a single receiver’s buffer from overflowing; congestion control (cwnd) protects the intermediate network routers from overflowing.
- Effective window W = min(cwnd, rwnd).
- 3 Duplicate ACKs! Because later segments are still arriving at the receiver to trigger those duplicate ACKs, whereas a timeout means nothing is getting through.
Self-test answers
- 10 — RTT 1..4 (SS): 1, 2, 4, 8 KB. RTT 5 (CA): 9 KB. RTT 6 (CA): 10 KB.
- 6 — After 3 dup ACKs at cwnd = 10 KB: ssthresh = 5 KB. In RTT 7, Reno sets cwnd = 5 KB (CA). In RTT 8, cwnd = 5 + 1 = 6 KB.
- 2 — Tahoe resets cwnd = 1 KB in RTT 7 (Slow Start, with ssthresh = 5 KB), then doubles to cwnd = 2 KB in RTT 8.
- A — In Slow Start, each new ACK increases cwnd by +1 MSS, so if k segments are sent and ACKed in one RTT, cwnd grows from k to 2k MSS.
- B: Adding +1 MSS per RTT is Congestion Avoidance.
- C: Adding MSS²/cwnd per ACK is Congestion Avoidance (+1 MSS per RTT).
- D: cwnd grows exponentially in Slow Start.
Flashcards
- How does cwnd grow in Slow Start vs Congestion Avoidance?
Reveal answer
Slow Start (cwnd < ssthresh): +1 MSS per ACK → doubles every RTT (clamped at ssthresh). Congestion Avoidance (cwnd ≥ ssthresh): +1 MSS per RTT (linear). - How do TCP Tahoe and TCP Reno differ when 3 duplicate ACKs arrive at window cwnd?
Reveal answer
Both set ssthresh = ⌊cwnd / 2⌋. Tahoe resets cwnd = 1 MSS (Slow Start); Reno sets cwnd = ssthresh (Fast Recovery / Congestion Avoidance). - What do TCP Tahoe and TCP Reno do when a Retransmission Timeout (RTO) occurs?
Reveal answer
Both set ssthresh = ⌊cwnd / 2⌋ and reset cwnd = 1 MSS (entering Slow Start).
Exam shortcuts
- Always convert KB to MSS first! Never apply
+1directly to KB whenMSS ≠ 1 KB! In Congestion Avoidance,cwndgrows by+1 MSSper RTT (which is+2 KBifMSS = 2 KB!). Solve the entire trace in MSS, then multiply by MSS at the very last step! — avoiding the #1 GATE numerical trap in TCP congestion control. - Slow Start RTT Count Formula: To grow from
1 MSStossthresh = S MSStakes⌈log₂(S)⌉RTT intervals (soSis reached in round1 + ⌈log₂(S)⌉). — quickly jumping across Slow Start without listing every round.