The Sliding Window Concept and Flow Control
1. Fundamentals of the Sliding Window Technique
The Sliding Window is a foundational abstract mechanism in computer networks used for simultaneous flow control and reliable in-order data transmission.
Rather than sending a single frame and halting (as in Stop-and-Wait), the sliding window allows the sender to transmit multiple consecutive packets before receiving an acknowledgment, treating the communication channel as a continuous pipeline:
Data Pipeline (Bandwidth-Delay Product):
[ Sender ] ===== [ F0 ] [ F1 ] [ F2 ] [ F3 ] [ F4 ] =====> [ Receiver ]
|<------- In-Flight Frames ------->|
2. Mathematical Model of the Sending Window
The sending window is an imaginary box covering the sequence numbers of frames that are either in transit (unacknowledged) or eligible to be transmitted immediately.
0 1 [ 2 3 4 5 6 7 ] 8 9 10 ...
<-- Acked --> |<------- Window Size Ws ------>| <-- Cannot send yet -->
^ ^
| |
Sf (First unacked) Sn (Next to send)
Three Window Pointers & State Variables:
- (Send Window, First): Sequence number of the oldest transmitted frame that has not yet received an ACK.
- (Send Window, Next): Sequence number assigned to the next new frame to be transmitted.
- (Window Size): Maximum number of frames the sender can transmit without receiving an ACK.
Dynamic Movement of the Window Walls:
- Expansion / Transmission: When a new frame is sent, pointer advances to the right ().
- Transmission Condition: The sender can transmit a new frame only while:
- Sliding / Shrinking: When a valid acknowledgment arrives confirming frames up to , pointer advances to the right (), sliding the window forward across the sequence circle and opening up room to transmit fresh frames!
3. Sequence Number Space Modulo
Sequence numbers are bounded by an -bit field in the frame header, wrapping around in a modular circle from to :
0
7 1
6 O 2 Modulo 8 Circle (m = 3 bits)
5 3
4
- When the count reaches , the next frame receives sequence number .
- Sequence arithmetic is performed modulo :
4. Bandwidth-Delay Product (BDP) and Optimal Window Sizing
The capacity of a network pipe is measured by the Bandwidth-Delay Product (BDP):
Pipe Capacity = Volume of Bits in Flight
+-----------------------------------------------------------+
| Sender ====> [ Bit Pipe Volume = Bandwidth * RTT ] ====> Receiver |
+-----------------------------------------------------------+
Window Sizing Implications:
- Under-buffered ():
- The sender window empties before the first ACK returns. The sender stalls into idle wait states, causing channel underutilization ().
- Optimal ():
- The sender continuously transmits at full line rate. The exact moment the sender finishes transmitting the -th frame, the ACK for the 1st frame arrives, keeping the channel saturated.
- Over-buffered ():
- Excess packets queue in router intermediate buffers, creating buffer bloat and unnecessary queueing latency.
5. Sliding Window: Data Link Layer vs. Transport Layer
| Dimension | Data Link Layer (DLL) | Transport Layer (TCP) |
|---|---|---|
| Basic Unit | Discrete Frames (Packets) | Stream of Bytes |
| Window Metric | Count of frames ( frames) | Count of bytes (e.g., ) |
| Scope | Single physical hop (node-to-node) | Global end-to-end across internetwork |
| Window Dynamism | Fixed static window configuration | Dynamic: adjusts via Receiver Window (rwnd) and Congestion Window (cwnd) |
| Implementation | Hardware NICs and firmware | Operating system network stack kernel |
6. Key Exam Questions & Numericals
- A channel has a bandwidth of and propagation delay . If frame size is , calculate the minimum window size required for link efficiency.
- .
- .
- Optimal Window:
- What occurs when the sender's sliding window is full?
- The sender must cease transmission and wait for acknowledgments to arrive from the receiver. As ACKs arrive, the left edge of the window slides forward ( advances), allowing new frames to be transmitted.
- Explain how the sliding window mechanism prevents buffer overflow at the receiver.
- The receiver only advertises a window size equal to its available buffer space. The sender is never permitted to transmit more unacknowledged data than the advertised receive window, guaranteeing that arriving packets always find free buffer slots.