The Data Link Layer

flow control

Imagine pouring water into someone's glass while they drink. If you pour faster than they can swallow, the glass overflows and water is wasted. Flow control is the agreement that lets the drinker say slow down or stop, so the pourer never overruns them. In networking it is the mechanism that keeps a fast sender from overwhelming a slow receiver, by matching the sending rate to what the receiver can actually take in.

The receiver has a limited buffer, a holding area for data that has arrived but not yet been processed. If frames pour in faster than the receiver empties that buffer, it fills up and new arrivals are dropped. Flow control prevents this by giving the receiver a way to throttle the sender. The simplest form is stop-and-wait: send one frame, wait for the receiver to say go before sending the next. A more efficient form uses a window: the receiver advertises how much buffer space it currently has, and the sender may have only that many bytes or frames outstanding before it must pause for permission to continue.

It is important not to confuse flow control with congestion control, though they look similar. Flow control protects the RECEIVER's buffer — it is about the two endpoints not outpacing each other. Congestion control protects the NETWORK in between — the shared links and router queues — from being overloaded by everyone at once. A sender can be told to slow down by either one, for entirely different reasons; TCP, for instance, runs both at the same time and obeys whichever is more restrictive.

A 1 Gbps server streams to a small sensor that can only process 1 Mbps. Without flow control the sensor's buffer overflows in milliseconds and almost everything is dropped. With flow control the sensor advertises a tiny window, and the server slows to match — no overflow, no waste.

The receiver sets the pace; the sender obeys to avoid overflowing the receiver's buffer.

Flow control protects the receiver from a fast sender; congestion control protects the network from everyone at once. They are different problems that happen to use similar windowing machinery.

Also called
流速控制