CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 4 · Transport Layer (TCP)

Chapter review L4.3 · Item 72 of 90

TCP mechanics, flow & congestion control

Read at your own pace. Try the questions before opening the answers.

On this page

Chapter recap

Chapter 4.3 covered the complete internal machinery of TCP: the 20–60 byte segment header, byte-stream sequence and cumulative ACK numbers, the 3-way handshake and 4-way teardown with TIME-WAIT (2·MSL), flow control via rwnd and window scaling, Jacobson’s EWMA/RTO and Karn’s rule, and TCP Tahoe vs Reno congestion control.

Merged rule card

From 4.3.1 TCP segment header, byte-stream numbering & cumulative ACKs

  • TCP Header: 20–60 B (`HLEN × 4`); 16b Src/Dst Ports, 32b Seq #, 32b Ack #, 6 Flags (`URG, ACK, PSH, RST, SYN, FIN`), 16b Window, 16b Checksum.
  • Byte numbering: segment at `Seq = S` with L bytes covers `S .. S + L − 1`; receiver sends cumulative `ACK = S + L` (next expected byte).
  • `MSS` = max TCP data payload per segment (`MTU − IP_hdr − TCP_hdr`).

From 4.3.2 TCP 3-way handshake, connection termination & state machine

  • 3-way handshake: SYN(seq=x) → SYN+ACK(seq=y, ack=x+1) → ACK(seq=x+1, ack=y+1).
  • Seq consumption: SYN = +1, FIN = +1, Pure ACK = 0, Data(L) = +L (full connection advances by D + 2).
  • Teardown states: Active closer goes FIN-WAIT-1 → FIN-WAIT-2 → TIME-WAIT (2·MSL) → CLOSED; Passive closer goes CLOSE-WAIT (half-close) → LAST-ACK → CLOSED.

From 4.3.3 TCP flow control (rwnd), sequence wrap-around time & window scaling

  • Flow control: rwnd = RcvBuffer − (LastByteRcvd − LastByteRead); sender keeps BytesInFlight ≤ rwnd.
  • Zero window (`rwnd = 0`): sender runs Persist Timer and sends 1-byte Zero-Window Probes.
  • Wrap-around time: T_wrap = (2³² × 8) / B seconds (34.36 s at 1 Gbps).
  • Window scaling: True rwnd = HeaderWindow × 2ˢ (S ≤ 14, negotiated in SYN).

From 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 RTO on each timeout.

From 4.3.5 TCP congestion control: cwnd, Slow Start, AIMD, Tahoe vs Reno

  • Effective window: W = min(cwnd, rwnd). Always trace in units of MSS!
  • Slow Start (cwnd < ssthresh): +1 MSS per ACK → cwnd ← min(2·cwnd, ssthresh) per RTT.
  • Congestion Avoidance (cwnd ≥ ssthresh): +1 MSS per RTT (AIMD linear growth).
  • On Loss: ssthresh ← ⌊cwnd / 2⌋; Timeout → cwnd = 1 MSS; 3 Dup ACKs → cwnd = 1 MSS (Tahoe) or cwnd = ssthresh (Reno).

Practice questions

  1. NAT · 1 mark

    A TCP segment has HLEN (Data Offset) = 9. How many bytes of TCP Options are present in this segment?

    Write your answer before opening the key.

  2. NAT · 2 marks

    Host A initiates a TCP connection to Host B with Initial Sequence Number ISN_A = 1000. Host B replies with a SYN-ACK carrying ISN_B = 5000. In the 3rd packet of the handshake (the ACK from A to B), which also carries 200 bytes of application data, what is the Sequence Number (Seq) field?

    Write your answer before opening the key.

  3. MCQ · 1 mark

    Why does the active closer in TCP remain in the TIME-WAIT state for 2 × MSL before completely closing the connection?

    1. To finish Slow Start.
    2. To allow the final ACK to be retransmitted if lost, and to let all old duplicate segments from this incarnation expire from the network.
    3. To negotiate the Window Scale option.
    4. To double the RTO timer.
  4. NAT · 2 marks

    A TCP connection operates at full line rate over a 4 Gbps (4 × 10⁹ bits/sec) link. How many seconds (rounded to 2 decimal places) does it take for the 32-bit sequence number space to wrap around?

    Write your answer before opening the key.

  5. NAT · 2 marks

    During the 3-way handshake, a TCP receiver negotiates a Window Scale shift factor of S = 5. Later, it sends an ACK with the 16-bit Window Size field set to 2,000, over a path with RTT = 16 ms. What is the maximum throughput in Mbps permitted by this receive window?

    Write your answer before opening the key.

  6. NAT · 2 marks

    A TCP sender has EstimatedRTT = 120 ms and DevRTT = 16 ms. A new un-retransmitted segment produces SampleRTT = 200 ms. Using RFC 6298 defaults (α = 0.125, β = 0.25, updating DevRTT using the old EstimatedRTT = 120 ms), what is the new RTO in ms?

    Write your answer before opening the key.

  7. NAT · 2 marks

    A TCP Reno connection has MSS = 2 KB, initial cwnd = 2 KB (1 MSS) at RTT 1, and initial ssthresh = 12 KB (6 MSS). Assuming no losses, what is cwnd in KB during RTT 5?

    Write your answer before opening the key.

  8. NAT · 2 marks

    Continuing the previous question (cwnd = 14 KB = 7 MSS in RTT 5, with MSS = 2 KB), suppose a Retransmission Timeout (RTO) occurs at the end of RTT 5. What is the new value of ssthresh in KB?

    Write your answer before opening the key.

  9. MSQ · 2 marks

    Which of the following statements about TCP flow control and congestion control are TRUE?

    1. When rwnd = 0, the sender starts the Persist Timer and sends 1-byte Zero-Window Probes when it expires.
    2. When a Retransmission Timeout occurs, both TCP Tahoe and TCP Reno reset cwnd to 1 MSS.
    3. When 3 duplicate ACKs arrive, TCP Reno resets cwnd to 1 MSS whereas TCP Tahoe sets cwnd = ssthresh.
    4. By Karn’s rule, SampleRTT is never measured from an ACK of a retransmitted segment.

Answer key

Try the questions first. Open when you are ready to check.
  1. 16 — Total TCP header length = 9 × 4 = 36 bytes. Options = 36 − 20 (base header) = 16 bytes.

    Review lesson 4.3.1

  2. 1001 — A’s SYN consumed sequence number 1000, so the first byte of data in the 3rd handshake packet has Seq = 1001 (and after sending 200 bytes, A’s next sequence number will be 1201).

    Review lesson 4.3.2

  3. B — 2 × MSL ensures (1) the passive closer receives the final ACK (or its retransmission if the FIN is resent), and (2) wandering duplicate segments die out before the socket 4-tuple is reused.
    • A: Slow Start occurs at the beginning of data transfer.
    • C: Window scaling is negotiated in SYN.
    • D: Karn’s timer backoff happens during retransmission timeouts.

    Review lesson 4.3.2

  4. 8.58..8.60 — T_wrap = (2³² × 8) / (4 × 10⁹) = 34.3597 / 4 ≈ 8.59 seconds.

    Review lesson 4.3.3

  5. 32 — True rwnd = 2,000 × 2⁵ = 64,000 bytes = 512,000 bits. Over RTT = 16 ms = 0.016 s, max throughput = 512,000 / 0.016 = 32 × 10⁶ bps = 32 Mbps.

    Review lesson 4.3.3

  6. 258 — Est_new = 120 + (200 − 120)/8 = 130 ms. Dev_new = 0.75(16) + 0.25|200 − 120| = 12 + 20 = 32 ms. RTO = 130 + 4(32) = 130 + 128 = 258 ms.

    Review lesson 4.3.4

  7. 14 — In MSS (1 MSS = 2 KB, ssthresh = 6 MSS): RTT 1 = 1 MSS, RTT 2 = 2 MSS, RTT 3 = 4 MSS, RTT 4 = min(8, 6) = 6 MSS (clamped at ssthresh), RTT 5 = 6 + 1 = 7 MSS = 14 KB.

    Review lesson 4.3.5

  8. 6 — In MSS: cwnd was 7 MSS, so new ssthresh = ⌊7 / 2⌋ = 3 MSS = 3 × 2 KB = 6 KB! (Note: floor is taken in whole MSS segments: ⌊7/2⌋ = 3 MSS = 6 KB).

    Review lesson 4.3.5

  9. ABD — A, B, and D are true. C is backwards: on 3 duplicate ACKs, Tahoe resets cwnd = 1 MSS whereas Reno sets cwnd = ssthresh!
    • C: Tahoe resets to 1 MSS; Reno enters Fast Recovery at cwnd = ssthresh.

    Review lesson 4.3.5

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.