Go-Back-N Automatic Repeat reQuest
Window Size Limit
Read aloud is unavailable in this browser.
The Constraint That Ensures Correctness
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.
The Fundamental Problem: Sequence Number Reuse
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:
- A new frame with that sequence number (first use in a new cycle)
- A retransmitted frame from a previous transmission attempt
- A duplicate frame that should be discarded
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) |
Rigorous Derivation of the Constraint
Let's derive the window size constraint formally, considering the interaction between sender and receiver state.
Setup:
- Sequence number space: S = {0, 1, 2, ..., 2^k - 1}
- Window size: N
- Sender state: send_base, nextseqnum with send_base ≤ nextseqnum < send_base + N (mod 2^k)
- Receiver state: expectedseqnum
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).
- Sender transmits frames 0, 1, 2, ..., 2^k - 1 (filling the entire window)
- All frames arrive correctly at the receiver
- Receiver delivers all frames and sends ACK(2^k - 1)
- ACK is lost in transit
- Receiver now expects sequence number (2^k - 1 + 1) mod 2^k = 0
- Sender times out and retransmits frame 0
The Problem:
- Sender's frame 0 is a retransmission (already delivered)
- Receiver expects frame 0 as a NEW frame (start of next batch)
- Receiver cannot distinguish these cases!
If N = 2^k:
- Retransmitted frame 0 has sequence number 0
- Expected new frame also has sequence number 0
- Duplicate frame is accepted as new, violating correctness
With N = 2^k - 1:
- Sender transmits frames 0, 1, ..., 2^k - 2 (window of N = 2^k - 1)
- All frames arrive, receiver sends ACK(2^k - 2)
- ACK is lost
- Receiver expects sequence number (2^k - 2 + 1) mod 2^k = 2^k - 1
- Sender times out and retransmits frame 0
Now:
- Retransmitted frame has sequence number 0
- Expected frame has sequence number 2^k - 1
- 0 ≠ 2^k - 1, so receiver correctly rejects the retransmission
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.
Detailed Failure Scenario: When N = 2^k
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:
- Sequence numbers: 0, 1, 2, 3
- Window size: N = 4 (violates N ≤ 3)
- Data to send: A, B, C, D, E, F, G, H
| 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.
Geometric and Visual Understanding
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.
Practical Design Implications
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:
- Required window N ← determined by bandwidth-delay product and efficiency goals
- Minimum k = ⌈log₂(N + 1)⌉
Example:
- Desired window: N = 100 frames
- N + 1 = 101
- log₂(101) ≈ 6.66
- Minimum k = 7 bits (sequence space = 128)
- Maximum N = 127
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:
- Larger maximum window → better efficiency on high bandwidth-delay products
- More protection against delayed duplicates → safer protocol operation
But also incurs:
- Higher header overhead → more bits per frame for sequence numbers
- More complex arithmetic → especially for embedded/simple devices
The HDLC Case Study:
HDLC (High-Level Data Link Control) offers two modes:
-
Normal mode: 3-bit sequence numbers, max window = 7
- Suitable for low-latency, low-speed links
- Simple implementation
- Limited throughput on high-delay links
-
Extended mode: 7-bit sequence numbers, max window = 127
- Suitable for satellite links, high-speed connections
- More complex but much higher throughput potential
- Standard for most modern HDLC deployments
- •Size k for expected bandwidth-delay product — Window should be larger than RTT × bandwidth to keep channel full
- •Add margin for flow control — Receiver may advertise smaller window; design for maximum case
- •Consider implementation constraints — Power-of-2 spaces simplify modular arithmetic
- •Account for retransmission scenarios — Window must allow for worst-case outstanding frames
- •Balance header overhead — Don't use 32 bits when 7 bits suffice
Contrast: Window Constraint in Selective Repeat
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:
- The receiver accepts and buffers out-of-order frames
- The sender and receiver windows can be "out of sync" by up to N positions
- In the worst case, the sender's window and receiver's window could be completely disjoint
To prevent ambiguity:
- Sender window: [send_base, send_base + N - 1]
- Receiver window: [rcv_base, rcv_base + N - 1]
- These could differ by up to N
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:
- Receiver's expectedseqnum has advanced past the retransmitted frame's sequence number
- The gap of at least 1 sequence number (ensured by N ≤ 2^k - 1) provides disambiguation
In Selective Repeat, both sender and receiver have actual windows of size N, creating more potential for sequence number confusion—hence the stricter constraint.
Summary: Window Size Limits
The window size constraint is a fundamental correctness requirement for Go-Back-N ARQ. Let's consolidate the essential insights:
- •N ≤ 2^k - 1 is mandatory — Window must be strictly less than sequence number space
- •Violation causes duplicate delivery — Receiver cannot distinguish retransmissions from new frames
- •The gap ensures disambiguation — At least one sequence number always separates old window from new
- •Choose k based on required N — Minimum k = ⌈log₂(N + 1)⌉
- •GBN allows larger windows than SR — Because receiver "window" is effectively size 1
- •Real protocols embody this constraint — HDLC, X.25, Frame Relay all respect it
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.
KEEP LEARNING
There’s more to understand.
You’re reading the introduction. Create a free account to read the complete lesson, save notes and keep track of your progress.