</>
ShikshaCSLearn. Code. Grow.
๐Ÿ”
โ˜• Support Us
ShikshaCSโ€บNotesโ€บComputer Networks
Computer Networks
๐Ÿ•’ 9 min read

Flow Control and Congestion Control

How TCP prevents a fast sender from overwhelming a slow receiver, or a busy network.

Flow Control โ€” Protecting the Receiver

Flow control prevents a fast sender from overwhelming a SLOW RECEIVER's ability to process incoming data. If a powerful server sends data faster than a receiving phone can handle it, the phone's buffer could overflow and data would be lost. TCP solves this using a 'sliding window' mechanism โ€” the receiver tells the sender exactly how much data it can currently accept, and the sender respects this limit.

The Sliding Window Mechanism

The receiver advertises a 'window size' (how many bytes it can currently buffer) in every acknowledgment it sends back. The sender can transmit up to that many bytes without waiting for further permission. As the receiver processes data and frees up buffer space, it advertises a larger window, allowing the sender to send more โ€” this window 'slides' forward as data is successfully processed.

Congestion Control โ€” Protecting the Network

Congestion control is a DIFFERENT problem โ€” it protects the NETWORK ITSELF from being overwhelmed by too much traffic from many senders at once (not just one slow receiver). If too many devices send data simultaneously, routers' queues overflow and packets get dropped everywhere, causing widespread slowdowns for everyone using that network segment.

How TCP Detects and Responds to Congestion

TCP infers network congestion primarily through packet loss (a dropped/unacknowledged packet is treated as a signal the network is overloaded) or increasing delay. When congestion is detected, TCP aggressively REDUCES its sending rate (this is called 'congestion avoidance'), then gradually increases it again slowly to probe for available bandwidth โ€” this cycle is often visualized as a 'sawtooth' pattern in network graphs.

Slow Start

When a TCP connection begins (or restarts after congestion), it doesn't immediately blast data at full speed โ€” instead it uses 'slow start', beginning with a small amount of data and roughly DOUBLING the sending rate with each successful round trip, until it either reaches the receiver's advertised window limit or detects congestion, at which point it switches to a more cautious, gradual increase.

๐ŸŒ Real-World Use

When your internet feels slow during peak hours (like evenings when everyone in your area is streaming video simultaneously), TCP's congestion control is actively adjusting sending rates across millions of connections in real-time trying to fairly share the limited available bandwidth without collapsing the network entirely.

๐Ÿ’ก Pro Tip

Don't confuse flow control and congestion control in exams โ€” flow control is about the RECEIVER's capacity (a one-to-one problem), while congestion control is about the NETWORK's overall capacity (a many-senders problem) โ€” they solve genuinely different issues, even though both result in the sender adjusting its speed.

๐Ÿงช Quick Self-Test

Check what you just learned โ€” no pressure, just practice.

1. What problem does flow control specifically address?

2. How does TCP typically detect network congestion?

3. What does TCP's 'slow start' mechanism do?

โ† Back to all Notes