The sliding window is TCP's mechanism for sending multiple packets before requiring acknowledgment. The window size determines how much data can be in-flight simultaneously. Without windowing, the sender waits for each ACK before sending the next segment – wasting bandwidth on high-latency links.
TCP's sliding window allows the sender to transmit multiple segments without waiting for individual ACKs. The window 'slides' forward as ACKs arrive, opening space for new data. Window size is the minimum of the receiver's advertised window (rwnd – flow control) and the congestion window (cwnd – congestion control). On a 100ms RTT link, a 64 KB window allows only 5.12 Mbps throughput regardless of link bandwidth. Window scaling (RFC 7323) uses a shift count negotiated in the SYN to expand the window up to 1 GB, enabling full utilization of high-bandwidth, high-latency paths. The sender tracks three pointers: the oldest unacknowledged byte (left edge), the next byte to send, and the right edge of the window. Data between left edge and send pointer is sent-but-unacked. Data between send pointer and right edge is sendable. Data beyond the right edge must wait.
Congestion
Network congestion occurs when traffic exceeds link or buffer capacity, causing packet loss and increased latency. TCP congestion control algorithms (Cubic, BBR, Reno) dynamically adjust sending rate to avoid overwhelming the network. Persistent congestion degrades all traffic on the shared path.
Flow Control
Flow control prevents a fast sender from overwhelming a slow receiver. TCP uses a receive window (rwnd) advertised by the receiver to limit in-flight data. If the receiver's buffer fills, it shrinks rwnd to zero, pausing the sender until the application drains the buffer.
ACK (Acknowledgment)
ACK (acknowledgment) is a TCP flag confirming receipt of data. The ACK number indicates the next byte the receiver expects. Delayed ACKs batch confirmations for efficiency (typically every 2 segments or 200ms). Missing ACKs trigger retransmission – the sender assumes data was lost.