COMP30023 · Computer Systems
Flow Control, Congestion Control and Addressing
Week 10 covers how TCP paces the sender and how the network is addressed: the sliding window and cumulative acknowledgements, AIMD congestion control (slow start and congestion avoidance), and IP addressing with CIDR prefixes and subnet masks. Reading the next ACK number off a sliding-window scenario, computing addresses in a prefix, and doing a longest-prefix lookup are flagship exam questions.
What this chapter covers
- 01The sliding window: reliable delivery, flow control and in-order delivery; the receiver-advertised window
- 02Cumulative ACKs and loss recovery: duplicate ACKs, fast retransmit on three duplicate ACKs, the zero-window probe
- 03Go-back-N vs selective repeat; the sender invariant LastByteSent − LastByteAcked ≤ advertised window
- 04TCP congestion control: the congestion window (sender-only), slow start (exponential) and congestion avoidance (additive)
- 05On loss: set ssthresh = CWND/2 and restart (TCP Tahoe); fast recovery (TCP Reno); the AIMD sawtooth
- 06IPv4 addressing: 32-bit dotted-decimal addresses on interfaces; unicast/broadcast/multicast; the network/host split
- 07CIDR prefixes (lowest-IP/prefix-length), subnet masks, addresses in a /L = 2^(32−L), and longest-prefix matching
- 08Store-and-forward packet switching; datagram (IP) vs virtual-circuit networks; IPv6 128-bit addressing
Cumulative ACK after a lost segment
- +1TCP acknowledgements are cumulative: the ACK number is the next in-order byte the receiver still needs — one past the last byte received with no gap before it.
- +1The first segment (bytes 0-499) arrived, so bytes 0 through 499 are contiguous. The second segment (bytes 500-999) was lost, which creates a hole starting at byte 500.
- +1When the third segment (bytes 1000-1499) arrives out of order, it is buffered but cannot advance the cumulative ACK past the hole. The receiver therefore returns ACK = 500 (a duplicate ACK), signalling it is still waiting for byte 500. Enough duplicate ACKs (an original plus three duplicates) trigger the sender's fast retransmit of the missing segment.
Key terms
- Sliding window
- TCP's mechanism providing reliable delivery, flow control and in-order delivery. The receiver advertises a window (how much buffer it has free); the sender may have at most that many unacknowledged bytes outstanding: LastByteSent − LastByteAcked ≤ advertised window.
- Cumulative ACK / fast retransmit
- Each ACK names the next in-order byte expected, so it stalls at the first missing byte even if later segments arrive (producing duplicate ACKs). Three duplicate ACKs (four identical ACKs) trigger fast retransmit — resending the missing segment without waiting for a timeout.
- Congestion window (CWND)
- A second window maintained only by the sender, adjusted from loss signals to limit the send rate to the network's capacity. The actual limit is min(receive window, CWND); there is no new header field.
- Slow start vs congestion avoidance
- Slow start grows CWND exponentially (roughly doubling each RTT) until a loss or the threshold ssthresh. Congestion avoidance then grows CWND linearly (additive increase). On loss, ssthresh is set to CWND/2 (multiplicative decrease) — the AIMD sawtooth.
- CIDR prefix / subnet mask
- A network is a block of addresses written lowest-IP/prefix-length (e.g. 192.0.2.0/24). The prefix length L gives L network bits and 32−L host bits; the subnet mask has 1s over the network bits. A /L holds 2^(32−L) addresses; the network number = mask AND address.
- Longest-prefix matching
- When several routing-table prefixes match a destination address, the router forwards using the most specific (longest) matching prefix; if none match, it uses the default route. CIDR aggregation lets routers store routes for prefixes rather than individual hosts.
Flow Control, Congestion Control and Addressing FAQ
What ACK does a TCP receiver send after a lost segment?
It sends a cumulative ACK equal to the first missing byte — one past the last byte received with no gap before it. If an earlier segment is lost but later ones arrive, those later segments are buffered but cannot advance the ACK past the hole, so the receiver keeps returning the same ACK number (duplicate ACKs). Once the sender sees three duplicate ACKs it fast-retransmits the missing segment without waiting for a timeout. The trap is thinking an out-of-order arrival advances the ACK — it does not.
How do slow start and congestion avoidance differ?
Slow start grows the congestion window exponentially — roughly doubling it each round trip (1, 2, 4, 8 segments) — to probe capacity quickly, and applies until a loss occurs or the window reaches the threshold ssthresh. Congestion avoidance then switches to additive increase, growing the window by about one segment per round trip so the sender approaches capacity gently. On a loss the sender sets ssthresh = CWND/2 (multiplicative decrease) and backs off, producing the characteristic AIMD sawtooth.
How many addresses are in a CIDR block, and how do I test membership?
A prefix of length L has 32−L host bits, so it contains 2^(32−L) addresses — a /24 holds 256, a /8 holds 16,777,216. An address belongs to a prefix if its top L bits match the prefix; equivalently, (address AND subnet mask) equals the network number. Remember a smaller prefix number means a bigger network, and that an interface must be told both its address and its mask, since the mask cannot be inferred from the address alone.
What is longest-prefix matching and why is it used?
Because CIDR aggregates contiguous networks and prefixes can overlap, a destination address may match several routing-table entries. The router forwards using the longest (most specific) matching prefix, falling back to the default route if nothing matches. This lets routers keep small tables keyed on network prefixes rather than individual hosts, which is what makes Internet-scale routing feasible; only the destination network reads the host portion of the address.
Can AI help me with congestion control and IP addressing in COMP30023?
Yes. Sia can trace sliding-window ACK numbers, explain the slow-start/congestion-avoidance sawtooth, and work through CIDR membership, address counts and longest-prefix lookups step by step, checking your binary arithmetic. It is a study aid for the networking half; it does not do your graded exam, quizzes or projects, and University of Melbourne academic-integrity rules apply.
Exam move
Week 10 is dense and heavily examined, mixing conceptual and hand-arithmetic questions, so split your practice. For flow/congestion control, rehearse reading the next ACK off a sliding-window scenario (cumulative ACK stalls at the first hole; three duplicate ACKs trigger fast retransmit) and be able to sketch the slow-start/congestion-avoidance sawtooth and state the ssthresh = CWND/2 rule. For addressing, drill CIDR until it is fast without a calculator: addresses in a /L = 2^(32−L), membership via top-L-bit match or mask AND address, and longest-prefix table lookups. Practise the smallest-subnet-containing-two-addresses trick (find the highest differing bit). Keep the datagram-vs-virtual-circuit trade-offs and the IPv6 basics (128-bit, hop limit) in reserve. These are reliable marks; confirm the exam date on Canvas and keep consolidating toward your WAM.
Working through Flow Control, Congestion Control and Addressing in COMP30023? Sia is AskSia’s AI Computer Science tutor — ask any COMP30023 Flow Control, Congestion Control and Addressing question and get a clear, step-by-step explanation grounded in how COMP30023 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.