TCP flow and congestion control interview questions, with answers
Flow control and congestion control both limit how fast a sender transmits, but they protect different things, and confusing them is a common interview mistake. Questions range from definitions to how TCP's congestion window grows and what the receiver's window means.
The answers below cover the difference between flow and congestion control, sliding windows, slow start, additive increase and multiplicative decrease, how TCP detects congestion, the ARQ protocols and the receive window. Then take the free Computer Networks diagnostic — ten questions across every networking topic in the bank — to see which of these you can explain but not yet apply.
The questions, with answers
1.What is the difference between flow control and congestion control?
In short: Flow control stops a sender from overwhelming the receiver; congestion control stops senders from overwhelming the network.
Flow control is between two endpoints: the receiver advertises how much buffer space it has, and the sender never sends more unacknowledged data than that, so a fast sender cannot overflow a slow receiver. Congestion control protects the network in between: the sender keeps a congestion window, its own estimate of what the path can carry, and adjusts it according to signs of congestion such as loss or delay. TCP sends at most the minimum of the two windows at any moment, so whichever limit is tighter governs the sending rate.
2.How does a sliding window work?
In short: The sender may have several unacknowledged segments in flight, up to a window size, and the window slides forward as ACKs arrive.
Waiting for an acknowledgement after every segment wastes most of a long link's capacity. A sliding window lets the sender transmit a window's worth of data before stopping. The window covers a range of sequence numbers: bytes before it are acknowledged, bytes inside it may be sent, and bytes after it must wait. Each acknowledgement moves the window's start forward, opening room for new data. The receiver keeps its own window of acceptable sequence numbers, buffering segments that arrive early. The window size controls how much data can be in flight at once.
3.What is TCP slow start?
In short: At the start of a connection, the congestion window begins small and doubles every round trip until it reaches a threshold.
A new connection does not know the path's capacity, so TCP starts with a small congestion window, typically 10 segments today, and increases it by one segment for every acknowledgement received. Since a whole window of acknowledgements arrives per round trip, the window doubles each round trip: exponential growth, despite the name. Slow start continues until the window reaches the slow-start threshold, ssthresh, or loss occurs. The name contrasts with early TCP, which sent a full receiver window at once and caused congestion collapse on the 1980s internet.
4.What is additive increase, multiplicative decrease (AIMD)?
In short: In congestion avoidance TCP grows its window by about one segment per round trip, and cuts it multiplicatively when congestion appears.
Once the congestion window passes the slow-start threshold, TCP enters congestion avoidance: it increases the window by roughly one maximum segment size per round trip, a linear, additive probe for spare capacity. When it detects congestion, it reduces the window by a multiplicative factor, classically halving it. This asymmetric rule, slow to grow and quick to back off, makes competing flows converge toward a fair share of the bottleneck while keeping the network stable. Plotting the window over time gives TCP's characteristic sawtooth.
5.How does TCP detect congestion?
In short: Classically from packet loss, signalled by a retransmission timeout or by duplicate acknowledgements; newer schemes also use delay.
Routers drop packets when their queues overflow, so loss is TCP's traditional congestion signal. The sender notices it in two ways: a retransmission timer expires without an acknowledgement, or it receives several duplicate acknowledgements for the same byte, which means later segments arrived but one is missing. Explicit Congestion Notification lets routers mark packets instead of dropping them, and the receiver echoes the mark back. Modern algorithms also use delay: CUBIC, the default on Linux and Windows, reacts to loss, while BBR estimates bandwidth and round-trip time directly.
6.What are stop-and-wait, Go-Back-N and Selective Repeat?
In short: Automatic repeat request protocols: send one frame at a time, resend everything from a lost frame, or resend only the lost frames.
Stop-and-wait sends one frame and waits for its acknowledgement before sending the next, which is simple but idles long links. Go-Back-N sends up to a window of N frames; the receiver accepts only in-order frames, so after a loss the sender retransmits the lost frame and every frame sent after it. Selective Repeat also sends a window, but the receiver buffers out-of-order frames and acknowledges each individually, so only the lost frames are resent, at the cost of buffers and more complex bookkeeping. TCP's selective acknowledgement option brings it close to Selective Repeat.
7.What is the TCP receive window, and what is a zero window?
In short: The free buffer space the receiver advertises in each ACK; a zero window tells the sender to pause until space frees up.
Every TCP segment carries a window field in which the receiver advertises how many more bytes it can accept, its free buffer space. The sender keeps its unacknowledged data within that amount, which is TCP's flow control. If the application reads slowly and the buffer fills, the receiver advertises a zero window and the sender stops, periodically sending small window probes until the receiver announces space again. The field is 16 bits, so the window scaling option, negotiated in the handshake, multiplies it for fast networks with long round-trip times.
How the diagnostic asks it
One question from the Computer Networks bank, exactly as a sitting would show it. The bank has 3 on flow & congestion control and 30 across Computer Networks.
A TCP sender starts slow start with a congestion window of 1 MSS and a slow-start threshold of 16 MSS. With no losses, after how many round trips does the window first reach 16 MSS?
- 116
- 25
- 38
- 44correct
In slow start, each ACK increases the congestion window by one MSS, so a full window of ACKs doubles it every round trip: 1, 2, 4, 8, 16. It reaches 16 MSS after 4 round trips and then switches to congestion avoidance, growing by about one MSS per round trip. 16 is the linear growth that congestion avoidance uses. 5 counts the starting window as a round trip, and 8 is the window one round trip earlier.
Measure it
Reading answers tells you what’s true. A diagnostic tells you what you get wrong.
10 Computer Networks questions across its topics, easy to hard, about fifteen minutes. You get a readiness figure with the arithmetic shown, the topics you missed named, and a practice set sized for today. Free: 1 diagnostic a month and 15 problems a day. No card.