Flow & congestion control

Computer Networks ยท 10 interview questions

Flow control stops a fast sender from overwhelming a slow receiver. The receiver advertises a window โ€” how much buffer space it has โ€” and the sender never has more unacknowledged data in flight than that. It's strictly a conversation between two endpoints.

Congestion control stops senders from overwhelming the network between them. Nothing advertises capacity, so TCP infers it: it increases its rate until loss occurs, treats that as a congestion signal, and backs off. The congestion window is the sender's own estimate, and the amount actually in flight is the minimum of it and the receiver's window.

TCP's algorithm is additive increase, multiplicative decrease. Slow start ramps up exponentially from a small window until a threshold, then congestion avoidance grows linearly. Three duplicate acknowledgements trigger fast retransmit and a halving; a timeout is treated as far more serious and drops the window right back.

Flow & congestion control interview questions

What's the difference between flow control and congestion control?
Flow control protects the receiver from a fast sender, using the window the receiver advertises. Congestion control protects the network, using the sender's own inferred estimate of available capacity. Different problem, different window.
Why they ask: The single most conflated pair in networking interviews.
How does the sliding window work?
The sender may have up to a window's worth of unacknowledged bytes in flight. As acknowledgements arrive the window slides forward, allowing more to be sent, so transmission continues without waiting for each segment to be acknowledged individually.
What is slow start, and why is the name misleading?
The congestion window starts small and doubles every round trip โ€” exponential growth, not slow. It's 'slow' only relative to immediately blasting at full rate. It continues until the slow-start threshold or loss.
What happens after slow start ends?
Congestion avoidance: the window grows by roughly one segment per round trip instead of doubling. Probing capacity cautiously once you're near it avoids overshooting.
What is AIMD and why that shape?
Additive increase, multiplicative decrease: grow slowly, cut sharply on loss. The asymmetry is what makes competing flows converge on a fair share โ€” gentle growth probes, aggressive backoff resolves congestion quickly.
What triggers fast retransmit?
Three duplicate acknowledgements. They indicate later segments are arriving while one is missing, so the network is still delivering โ€” the segment can be resent immediately rather than waiting for a timeout.
Why does TCP react more severely to a timeout than to duplicate ACKs?
Duplicate ACKs prove packets are still getting through, so congestion is mild and the window is halved. A timeout suggests nothing is arriving, implying severe congestion, so the window drops back to its minimum and slow start restarts.
What does Nagle's algorithm do, and when does it hurt?
It buffers small writes until the previous data is acknowledged, reducing tiny-packet overhead. It hurts latency-sensitive interactive traffic, which is why such applications disable it with TCP_NODELAY.
What is the bandwidth-delay product?
Bandwidth multiplied by round-trip time โ€” the amount of data that can be in flight at once. If the window is smaller than this, the link can't be saturated regardless of available bandwidth.
Which window actually limits the sender?
The minimum of the receiver's advertised window and the sender's congestion window. Either can be the bottleneck, which is why both must be considered when diagnosing throughput.

You'll forget most of this by next week

That's not a discipline problem, it's how memory works. In the app these come back on an expanding schedule โ€” right before you'd lose them.

Start free for 7 days