Sliding Window Protocol (Go-Back-N) — A Comprehensive Explanation
Sliding window protocols are a family of data link / transport mechanisms that allow a sender to keep multiple frames “in flight” without waiting for an acknowledgment (ACK) for every single frame. Sliding window protocol works by maintaining a sending window (what frames may be sent) and a receiving window (what frames are allowed to be accepted). In Go-Back-N (GBN) ARQ, if an error is detected (e.g., via CRC or timeout), the receiver generally uses cumulative ACKs and the sender retransmits from the last unacknowledged frame, not only the lost one. Go-Back-N ARQ.
Key intuition:
- The sender can transmit up to frames without being “forbidden” by the window limit.
- ACKs are cumulative: receiving frame implies all frames were received correctly.
- When a frame error occurs, the receiver discards later frames, and the sender “goes back” to resend everything from the missing frame.
Sliding Window & Go-Back-N ARQ (visual walkthrough)
Core components you must know
- Sequence number: lets receiver order frames and detect duplicates/loss.
- Cumulative ACK: receiver ACKs the highest in-order frame.
- Retransmission (timeout/error): in GBN, sender retransmits from the missing frame.
- Window size W: bounds pipeline depth and determines efficiency.
GBN requires the sender to keep a buffer of transmitted frames (at least from the oldest unacknowledged one) until they are cumulatively ACKed.
GBN behavior vs. selective repeat (conceptual comparison)
GBN retransmits more aggressively; selective repeat retransmits only missing frames.
The GBN sliding window: what each side does
Sender (GBN):
- Maintains a sending window of size .
- Sends frames with sequence numbers within the window.
- Starts/uses a timer for the oldest unacknowledged frame.
- On timeout, retransmits all frames starting from the oldest unacknowledged frame (“go back N”).
- Advances the window when cumulative ACKs arrive.
Receiver (GBN):
- Expects frames in order.
- If frame is correct and equals the next expected sequence number, deliver it to the upper layer and ACK cumulatively (ACK for ).
- If frame is corrupt or not the expected one, discard it and ACK the last correctly received in-order frame (ACK for ).
This is why the sender must retransmit from the missing frame: receiver will not “buffer ahead” for later frames in basic GBN.
GBN sender/receiver operation (step-by-step)
- 1Step 1
Set nextFrameToSend and oldestUnacked. Set receivingExpected. Window size W constrains nextFrameToSend − oldestUnacked.
- 2Step 2
While nextFrameToSend < oldestUnacked + W, send frame with sequence number nextFrameToSend and buffer it for potential retransmission.
- 3Step 3
On arrival, receiver checks integrity (CRC) and whether sequence number equals receivingExpected.
- 4Step 4
Deliver frame, advance receivingExpected by 1, and send cumulative ACK for the highest contiguous in-order frame.
- 5Step 5
Discard the frame and send cumulative ACK for the last contiguous in-order frame (receivingExpected − 1).
- 6Step 6
When a cumulative ACK advances beyond oldestUnacked, slide the window forward and update oldestUnacked.
- 7Step 7
If the timer expires for oldestUnacked, retransmit all buffered frames from oldestUnacked up to the current send point within the window.
Concrete timeline example (with sequence numbers)
Assume:
- Window size
- Sender has frames with sequence numbers
- Receiver expects in-order frames starting at
Example event
- Sender transmits frames .
- Frame arrives corrupted.
- Receiver discards frame and also discards if they arrive out of order (basic GBN).
- Receiver sends cumulative ACK for the last good in-order frame: ACK for .
- Sender sees that ACK does not advance beyond frame and/or a timeout occurs.
- Sender retransmits starting from frame : frames (and possibly more within window constraints).
This captures the distinctive property of GBN: after a loss/error at frame , the sender retransmits from onward, potentially wasting bandwidth.
[Warning]{type="warning", title="Efficiency cost in GBN", content="GBN can retransmit frames that were received correctly but discarded at the receiver due to an earlier error. This increases overhead under high error rates."}
Common misunderstandings & edge cases
Choosing window size: performance intuition
Let:
- = sender window size (max outstanding frames)
- Larger increases the pipeline, potentially improving throughput when errors are rare.
- But with higher error probability, GBN wastes more transmissions because errors cause retransmission of multiple frames.
A simplified qualitative throughput tradeoff often used in networking courses is:
- More pipelining (larger ) helps in low-loss conditions.
- Higher loss/error rates reduce effective throughput because retransmissions (from the missing frame) consume bandwidth.
[CalloutBlock]{type="tip", title="Exam-ready takeaway", content="To explain GBN: emphasize cumulative ACKs + receiver discards out-of-order frames + sender retransmits from the oldest unacknowledged frame after timeout/error."}
GBN lifecycle (typical operation)
Pipeline frames
1. Send window filledSender sends frames up to window limit ."
ACK progress or discard
2. Receiver checks order/integrityIf in-order and correct -> cumulative ACK advances; else discard and ACK last good."
Go back
3. Error detectedSender timeout or missing cumulative ACK triggers retransmission from the missing frame."
Window slides
4. ACKs arriveCumulative ACKs move the sender window forward; continue sending new frames."
Go-Back-N Sliding Window: Quick Self-Test Deck
Knowledge Check
In Go-Back-N ARQ, when frame i is corrupted, what does the receiver typically send?