Loading content...
Every protocol has hidden constraints that, if violated, lead to subtle but catastrophic failures. For Go-Back-N ARQ, one such critical constraint governs the relationship between the window size N and the sequence number space size 2^k (for k-bit sequence numbers).
At first glance, a larger window seems purely beneficial—more outstanding frames, better channel utilization, higher throughput. Why not set the window as large as possible? The answer lies in a delicate interaction between the finite sequence number space, cumulative acknowledgments, and the protocol's need to distinguish new frames from retransmissions.
This page rigorously derives the Go-Back-N window size constraint, demonstrates failure scenarios when the constraint is violated, and connects this seemingly abstract limit to the practical design of networking protocols.
By the end of this page, you will understand why Go-Back-N requires N ≤ 2^k - 1 (where k is the number of bits in the sequence number), be able to construct scenarios demonstrating failure when this limit is exceeded, and appreciate how this constraint influences protocol design in real systems like HDLC.
Sequence numbers serve a critical purpose: they allow the receiver to distinguish different frames and detect duplicates, reordering, and gaps. However, with finite bit fields, sequence numbers must eventually wrap around and be reused.
The Question:
How do we ensure that when a sequence number is reused, the receiver can distinguish between:
The Constraint:
For Go-Back-N with k-bit sequence numbers (space = 2^k), the window size must satisfy:
N ≤ 2^k - 1
Equivalently: Window size must be strictly less than the sequence number space.
This leaves at least one sequence number outside any possible window configuration, enabling disambiguation.
If N = 2^k (window equals sequence space), the sender could have frames 0, 1, 2, ..., 2^k-1 all outstanding simultaneously. When the window advances, it would use sequence number 0 again—and the receiver cannot tell if an arriving frame 0 is a new transmission or a delayed old one.
Intuition via Modular Arithmetic:
With k-bit sequence numbers, we work in modular arithmetic modulo 2^k. The sender's window occupies sequence numbers [send_base, send_base + N - 1] mod 2^k.
The receiver, after acknowledging frames up to some point, expects sequence numbers starting from expectedseqnum. For the protocol to work correctly:
The receiver must be able to identify if an arriving frame is within the current expected range (accept) or outside it (reject as duplicate or premature)
When the window wraps around, new sequence numbers used must not overlap with sequence numbers from potentially still-in-flight retransmissions
With N = 2^k, the window would span all sequence numbers, making these distinctions impossible.
| Bits (k) | Sequence Space (2^k) | Max Window (N) | Example Protocol |
|---|---|---|---|
| 1 | 2 | 1 | Stop-and-Wait (trivially) |
| 2 | 4 | 3 | Minimal pipelining |
| 3 | 8 | 7 | Common in examples |
| 4 | 16 | 15 | HDLC (standard) |
| 7 | 128 | 127 | HDLC (extended) |
| 8 | 256 | 255 | Many protocols |
| 16 | 65536 | 65535 | High-performance links |
| 32 | 4.3B | 4.3B - 1 | TCP (simplified view) |
Let's derive the window size constraint formally, considering the interaction between sender and receiver state.
Setup:
Sender Window Set:
At any time, the sender may have outstanding frames with sequence numbers:
W_sender = {send_base, send_base + 1, ..., send_base + N - 1} mod 2^k
This is a contiguous block of N sequence numbers.
Receiver Expectation:
The receiver, having acknowledged frames up to send_base - 1, expects:
W_receiver = {expectedseqnum} = {send_base}
But crucially, if the ACKs are lost or delayed, the receiver might have moved ahead to:
W_receiver' = {send_base + m} for some 0 ≤ m ≤ N
The Conflict Scenario:
Suppose the receiver has advanced (received all N frames successfully) while ACKs are in transit. The receiver now expects sequence number (send_base + N) mod 2^k.
Meanwhile, the sender hasn't received ACKs and times out, retransmitting from send_base.
Question: Can the receiver distinguish retransmitted frame send_base from new frame (send_base + N) mod 2^k?
For correctness, the receiver must never confuse:
• A retransmission of frame x with a new transmission of frame (x + N) mod 2^k
These two must have different sequence numbers, which is guaranteed if and only if N < 2^k.
Proof by Contradiction:
Assume N = 2^k (window equals sequence space).
The Problem:
If N = 2^k:
With N = 2^k - 1:
Now:
The constraint N ≤ 2^k - 1 ensures there's always at least one sequence number separating the sender's window from the receiver's next expected frame, enabling correct disambiguation.
To fully appreciate the constraint, let's trace through a complete failure scenario with 2-bit sequence numbers (space = 4) and window size N = 4.
Setup:
| Step | Sender Action | Network | Receiver Action | Result |
|---|---|---|---|---|
| 1 | Send Frame 0 (data A) | → | — | — |
| 2 | Send Frame 1 (data B) | → | — | — |
| 3 | Send Frame 2 (data C) | → | — | — |
| 4 | Send Frame 3 (data D) | → | Window full | — |
| 5 | — | — | Recv 0,1,2,3 correctly | Deliver A,B,C,D |
| 6 | — | ← ACK 3 | Send ACK(3) | — |
| 7 | — | ACKs LOST ✗ | Now expects seq# 0 | — |
| 8 | TIMEOUT | — | — | — |
| 9 | Retransmit Frame 0 (data A) | → | — | — |
| 10 | — | — | Recv Frame 0 | Expected 0, got 0! |
| 11 | — | — | ACCEPT as new | Deliver A again! ✗ |
The receiver delivered data A twice! The upper layer sees: A, B, C, D, A, ... instead of A, B, C, D, E, ... This violates the fundamental reliability guarantee of exactly-once delivery. The receiver had no way to distinguish the retransmitted frame 0 from the expected new frame 0.
Correct Operation with N = 3:
Now let's trace the same scenario with N = 3 (satisfying N ≤ 2^k - 1 = 3).
| Step | Sender Action | Network | Receiver Action | Result |
|---|---|---|---|---|
| 1 | Send Frame 0 (data A) | → | — | — |
| 2 | Send Frame 1 (data B) | → | — | — |
| 3 | Send Frame 2 (data C) | → Window full | — | — |
| 4 | — | — | Recv 0,1,2 correctly | Deliver A,B,C |
| 5 | — | ← ACK 2 | Send ACK(2) | — |
| 6 | — | ACKs LOST ✗ | Now expects seq# 3 | — |
| 7 | TIMEOUT | — | — | — |
| 8 | Retransmit Frame 0 (data A) | → | — | — |
| 9 | — | — | Recv Frame 0 | Expected 3, got 0! |
| 10 | — | — | REJECT (0 ≠ 3) | Discard, send ACK(2) |
| 11 | — | ← ACK 2 | — | Sender advances |
With N = 3, the receiver expects sequence number 3 after receiving 0, 1, 2. When retransmitted frame 0 arrives, it recognizes 0 ≠ 3 and correctly rejects it as a duplicate/out-of-order frame.
The sequence number space can be visualized as a circular ring (since sequence numbers wrap around). The window size constraint can be understood geometrically:
The Ring Model:
Imagine sequence numbers 0, 1, 2, ..., 2^k - 1 arranged in a circle. The sender's window occupies an arc of N positions on this ring.
Constraint Visualization:
With N = 2^k, the sender's window covers the entire ring
When the window "slides" (after all ACKs received), it wraps around to... the same starting position
No gap exists between where the window was and where it is now
With N = 2^k - 1, the sender's window covers all but one position
There's always a gap of at least 1 sequence number between the old window and the new window
This gap "protects" against confusion between old and new frames
Color-Coded Window States:
Let's visualize with 3-bit sequence numbers (0-7) and window N = 7:
Initial Window (send_base = 0):
Seq#: [0] [1] [2] [3] [4] [5] [6] 7
Status: W W W W W W W -
After all ACKed, Window slides (send_base = 7):
Seq#: 0 1 2 3 4 5 6 [7]
Status: - - - - - - - W
Note: Previous position 0-6 is now outside window
New position 7 (and wrapping to 0-5) is inside window
Key Insight: When N = 7 and space = 8, after the window slides by N = 7 positions, only 1 position from the old window could potentially overlap with the new window when frames are retransmitted. But the receiver has moved expectedseqnum such that it no longer accepts the old sequence numbers.
Contrast with N = 8:
Initial Window (send_base = 0):
Seq#: [0] [1] [2] [3] [4] [5] [6] [7]
Status: W W W W W W W W
After all ACKed, Window slides (send_base = 8 mod 8 = 0):
Seq#: [0] [1] [2] [3] [4] [5] [6] [7]
Status: W W W W W W W W
Window is IDENTICAL! No way to distinguish old from new frames.
The constraint N ≤ 2^k - 1 ensures there's always at least a 1-position gap between the sender's current window and where the receiver has advanced to. This gap is the "safety zone" that prevents sequence number reuse conflicts.
The window size constraint has direct implications for protocol design and performance optimization.
Sequence Number Sizing:
When designing a protocol, engineers choose k (sequence number bits) based on desired window size:
Example:
Real Protocol Examples:
| Protocol | Seq# Bits | Sequence Space | Max GBN Window | Actual Limit |
|---|---|---|---|---|
| HDLC (standard) | 3 | 8 | 7 | 7 |
| HDLC (extended) | 7 | 128 | 127 | 127 |
| Frame Relay | 7 | 128 | 127 | Implementation-dependent |
| X.25 | 3 or 7 | 8 or 128 | 7 or 127 | 7 (modulo 8) or 127 (modulo 128) |
| TCP | 32 | 4.3B | 4.3B - 1 | Limited by receive buffer (64KB-1GB) |
TCP uses 32-bit sequence numbers, providing a space of 4.3 billion. The theoretical GBN constraint (N ≤ 2^32 - 1) is never the limiting factor. Instead, TCP windows are limited by receiver buffer size (advertised in the window field) and congestion control algorithms. The large sequence space exists to prevent issues with long-lived connections and sequence number wraparound.
Trade-off: Larger k vs. Overhead:
Using more bits for sequence numbers provides:
But also incurs:
The HDLC Case Study:
HDLC (High-Level Data Link Control) offers two modes:
Normal mode: 3-bit sequence numbers, max window = 7
Extended mode: 7-bit sequence numbers, max window = 127
It's illuminating to compare Go-Back-N's window constraint with Selective Repeat ARQ, as they differ significantly.
Selective Repeat Constraint:
For Selective Repeat with k-bit sequence numbers:
N ≤ 2^(k-1) or equivalently N ≤ (sequence space) / 2
This is more restrictive than Go-Back-N's N ≤ 2^k - 1.
Why the Difference?
In Selective Repeat:
To prevent ambiguity:
For no overlap when windows are maximally apart: send_base + N - 1 < rcv_base + sequence_space (unwrapped)
This requires N + N ≤ sequence_space, i.e., N ≤ 2^k / 2.
| Sequence Bits k | Space 2^k | Max GBN Window | Max SR Window |
|---|---|---|---|
| 3 | 8 | 7 | 4 |
| 4 | 16 | 15 | 8 |
| 7 | 128 | 127 | 64 |
| 8 | 256 | 255 | 128 |
Go-Back-N can use almost the entire sequence space as window (N = 2^k - 1), while Selective Repeat can only use half (N = 2^(k-1)). This means for the same sequence number field size, GBN can have larger windows—a trade-off for its simpler receiver that doesn't buffer out-of-order frames.
Why GBN Allows Larger Windows:
The key insight is that in Go-Back-N, the receiver's "window" is effectively size 1—it only accepts the single expected sequence number. When the sender retransmits, the receiver is guaranteed to reject any retransmission of a previously accepted frame because:
In Selective Repeat, both sender and receiver have actual windows of size N, creating more potential for sequence number confusion—hence the stricter constraint.
The window size constraint is a fundamental correctness requirement for Go-Back-N ARQ. Let's consolidate the essential insights:
What's Next:
With window size constraints understood, we're ready to examine retransmission behavior in depth—the "go back" mechanism that defines the protocol. The next page explores how timeouts trigger retransmission, the impact of retransmitting already-received frames, and strategies to minimize redundant retransmission while maintaining protocol correctness.
You now understand the critical window size constraint in Go-Back-N: its derivation, failure scenarios when violated, geometric interpretation, and practical design implications. This constraint ensures the protocol can always correctly distinguish new frames from retransmissions, maintaining the reliability guarantee.