Selective Repeat (SR) ARQ Protocol
1. Motivation: Overcoming GBN Inefficiency
In Go-Back-N (GBN), if a single frame is lost, the receiver discards all subsequent correctly delivered frames, forcing the sender to retransmit the entire window. On high-error or high-bandwidth links, this retransmission of good frames causes severe throughput degradation.
Selective Repeat (SR) ARQ solves this by:
- Buffering out-of-order frames at the receiver.
- Retransmitting only the specific damaged or lost frames.
2. Sliding Window Sizes in Selective Repeat
In Selective Repeat, sequence numbers use bits (modulo , ranging from to ).
Unlike GBN where , both sender and receiver maintain active sliding windows:
3. Why Must in Selective Repeat?
This is one of the most frequently asked theoretical proofs in networking examinations.
Proof by Contradiction:
Suppose bits (sequence numbers: , modulo 4).
Assume we violate the rule and set (which is ).
- Initial State:
- Sender window:
[0, 1, 2]. - Receiver window:
[0, 1, 2].
- Sender window:
- Sender transmits frames
0, 1, 2. - Receiver receives all 3 frames correctly, buffers them, delivers them to the application layer, and slides its window forward by 3:
- Receiver sends acknowledgments
ACK 0, ACK 1, ACK 2. - Catastrophic Failure: All 3 ACKs are lost in transit due to line noise!
- Sender's timer for Frame 0 expires. Sender retransmits Frame 0.
- Receiver receives Frame 0. Looking at its active window
[3, 0, 1], Slot 0 is open! - The receiver erroneously assumes this is the brand-new Frame 0 of the next cycle, accepts it, and places it into the buffer!
- Result: Duplicate data delivered to the application layer, silently corrupting the file!
Conclusion:
To avoid ambiguity between duplicate old frames and fresh new frames, the sum of sender and receiver windows must never exceed the sequence space:
Since optimal performance requires :
4. Operational Mechanics of Selective Repeat
- Individual Retransmission Timers:
- The sender runs an independent countdown timer for every transmitted frame.
- Only the frame whose individual timer expires is retransmitted.
- Negative Acknowledgment (NAK):
- When the receiver detects a gap in arriving sequence numbers (e.g., receives Frame 3 when expecting Frame 2), it immediately generates a
NAK 2, prompting an instant fast retransmit before the sender's timeout.
- When the receiver detects a gap in arriving sequence numbers (e.g., receives Frame 3 when expecting Frame 2), it immediately generates a
- Buffering & In-Order Delivery:
- Arriving frames within the receive window are stored in temporary buffers.
- Once the missing frames arrive, the buffer is sorted sequentially and delivered in contiguous order to the network layer.
5. Comprehensive Comparison: ARQ Protocols
| Feature | Stop-and-Wait ARQ | Go-Back-N ARQ | Selective Repeat ARQ |
|---|---|---|---|
| Sender Window Size () | |||
| Receiver Window Size () | |||
| Out-of-Order Frames | Not possible | Discarded immediately | Buffered in receiver memory |
| Retransmissions | Single frame | Entire window ( frames) | Only the lost frame |
| Number of Timers | 1 timer | 1 timer (for oldest frame) | independent timers |
| Acknowledgment Type | Individual ACK | Cumulative ACK | Individual ACK / NAK / Cumulative |
| Complexity & Cost | Minimal | Low | High (buffer & timer management) |
| Bandwidth Efficiency | Lowest () | Moderate () | Highest (approaches ) |
Frequently Asked Questions
QIf sequence numbers are 4 bits wide ($m = 4$), what are the maximum sender window sizes for Go-Back-N and Selective Repeat?
- Total sequence space: (values to ).
- For Go-Back-N: .
- For Selective Repeat: .
QWhy does Selective Repeat require more buffer memory at the receiver than Go-Back-N?
In GBN, the receiver discards any frame that does not match the exact next expected sequence number (, zero buffer). In Selective Repeat, the receiver must store up to out-of-order frames until missing predecessors arrive.
QWhat is the condition on sequence number space for Selective Repeat?
. With symmetric windows (), .
QWhat is a NAK and why does Selective Repeat use it?
A NAK (negative acknowledgment) tells the sender that a specific frame is missing. When the receiver sees a gap in sequence numbers it sends a NAK immediately, so the sender retransmits just that frame without waiting for its timer.