Computer Networks

Flow Control

Stopping a fast sender from drowning a slow receiver. TCP's window.

Level: intermediate

What is it?

Transport flow control prevents a sender from delivering data faster than a receiver can buffer or process it. TCP uses a receiver-advertised window to limit unacknowledged data from overrunning the receiving host.

Why does it matter?

A fast sender and a slow receiver otherwise risk buffer exhaustion and dropped data. Flow control is distinct from congestion control, which responds to the capacity and congestion of the network path.

Mental model

The receiver says how much additional data it can accept. The sender respects that window along with its own congestion window; the effective amount of data in flight is bounded by both controls.

How it works

  • TCP's advertised receive window communicates receiver buffer capacity.
  • Window scaling allows larger windows than the original 16-bit window field can directly express.
  • A zero window can pause normal data transmission until the receiver advertises space again; probes help discover a reopened window.
  • Congestion window and receive window solve different problems and can independently limit throughput.
  • Application reads affect how quickly receive buffers drain and thus can influence advertised window size.

Steps

  • The receiver advertises available receive-buffer space in ACKs.
  • The sender keeps outstanding data within the receive and congestion limits.
  • If the receiver's buffer fills, it may advertise a zero window.
  • When the application reads data and space becomes available, a later window update permits sending to resume.

Real-world usage

  • Diagnosing slow consumers and zero-window TCP captures.
  • Explaining why large-bandwidth paths need adequate receive windows.

Common mistakes

  • Confusing receiver flow control with network congestion control.
  • Assuming the sender can transmit unlimited bytes merely because the link is fast.
  • Ignoring application code that fails to read from its socket promptly.

Interview questions

What does TCP's receive window protect?

It protects the receiver from being overwhelmed by more outstanding data than its advertised buffer capacity allows.

How does flow control differ from congestion control?

Flow control reflects receiver capacity; congestion control adapts to the sending path's available capacity and congestion signals.

Prerequisites

Related concepts

Continue learning

Browse the full computer science library