Selective Repeat ARQ (Automatic Repeat reQuest) is an error control protocol used in the data link layer and transport layer to ensure reliable data transmission. It is a more efficient version of Go-Back-N ARQ because only the specific frames that are lost or corrupted are retransmitted, instead of retransmitting all subsequent frames. This reduces unnecessary retransmissions and improves overall throughput.
Key Concepts of Selective Repeat ARQ:
- Sender and Receiver Windows:
- Both the sender and receiver have a “window” size that defines how many frames can be sent or received before waiting for an acknowledgment. The window size is typically smaller than the total number of frames to be transmitted, which allows multiple frames to be sent before waiting for acknowledgments.
- Frame Numbering:
- Each frame is assigned a unique sequence number. The sequence numbers help the receiver keep track of which frames are expected and which are out of order.
- Acknowledgments (ACK):
- The receiver sends an acknowledgment (ACK) for each correctly received frame. Unlike Go-Back-N ARQ, the receiver can acknowledge frames individually even if they are out of order.
- Retransmissions:
- Only the specific frames that are lost or corrupted are retransmitted. If a frame is correctly received, it is acknowledged, and no further action is taken for that frame.
- Receiver Buffering:
- The receiver can store out-of-order frames in its buffer until all previous frames have been received and the frames can be processed in order.
Steps in Selective Repeat ARQ:
- Sender Sends Frames:
- The sender sends multiple frames within its window (which has a specified size) without waiting for acknowledgments.
- Receiver Receives Frames:
- The receiver receives frames and sends an acknowledgment for each frame it receives, even if the frames are out of order. The receiver can buffer frames if they arrive out of order.
- Timeout and Retransmission:
- If the sender doesn’t receive an acknowledgment for a particular frame within a certain period (timeout), it retransmits only that specific frame, not all subsequent frames.
- Sliding the Window:
- After receiving an acknowledgment for a frame, the sender slides its window forward and sends the next frame in the sequence.
Example of Selective Repeat ARQ:
Let’s consider the following scenario:
- Window size: 3 (meaning the sender can send up to 3 frames before needing to wait for an acknowledgment)
- Sender: Can send frames 1, 2, and 3 without waiting for an acknowledgment.
- Receiver: Can receive out-of-order frames and buffer them until missing frames are received.
- Total frames to send: 6 frames.
Assumptions:
- Frame sequence: 1, 2, 3, 4, 5, 6
- Transmission: Frames 1, 2, and 3 are sent initially.
- Receiver behavior: The receiver might receive frames out of order, and will send an acknowledgment for each frame.
- Sender timeout: After a specific timeout (say, 2 seconds), if no acknowledgment is received for a frame, it will be retransmitted.
Scenario:
- Step 1: The sender sends Frame 1, Frame 2, and Frame 3.Sender’s window is now: [1, 2, 3].
- Step 2: The receiver receives Frame 1 and sends an acknowledgment (ACK1).The receiver also receives Frame 3 (out of order), and stores it in the buffer because Frame 2 hasn’t been received yet.The receiver does not acknowledge Frame 3 yet, but keeps it in the buffer.
- Step 3: The sender receives ACK1 for Frame 1 and slides the window forward to [2, 3, 4]. The sender then sends Frame 4.
- Step 4: The receiver receives Frame 2 (which is now in order), sends ACK2, and processes Frame 2.
- Step 5: The sender receives ACK2 and slides the window forward to [3, 4, 5]. The sender sends Frame 5.
- Step 6: The receiver has Frame 3 in its buffer from earlier, and now it can process Frame 3. It sends ACK3 for Frame 3.
- Step 7: The sender receives ACK3 and slides the window forward to [4, 5, 6]. The sender sends Frame 6.
- Step 8: The receiver receives Frame 4, processes it, and sends ACK4.
- Step 9: The sender receives ACK4 and sends Frame 7.
At this point, all frames have been successfully transmitted.
What if a frame was lost?
If Frame 2 was lost during transmission, the sender would not receive an acknowledgment for Frame 2 within the timeout period. The sender would retransmit only Frame 2 rather than all subsequent frames, avoiding unnecessary retransmissions.
Key Features of Selective Repeat ARQ:
- Receiver Buffering:
- The receiver can store out-of-order frames, which allows for better utilization of bandwidth. This is in contrast to Go-Back-N ARQ, where the receiver must discard out-of-order frames.
- Efficient Retransmissions:
- Only the lost or corrupted frames are retransmitted, reducing the amount of redundant transmission.
- Sliding Window:
- The sliding window allows multiple frames to be in flight at once, improving overall throughput and efficiency.
- Window Size:
- The window size is critical to the performance of Selective Repeat ARQ. A larger window size allows more frames to be sent in parallel, but it also increases the complexity of buffer management for both sender and receiver.
Advantages of Selective Repeat ARQ:
- Efficiency: Only the lost frames are retransmitted, reducing the number of redundant retransmissions.
- Better Utilization of Link: The receiver can buffer out-of-order frames, allowing for more efficient use of the available bandwidth.
- Reduced Overhead: Since only the missing frames are retransmitted, there is less retransmission overhead compared to Go-Back-N.
Disadvantages of Selective Repeat ARQ:
- Buffering Requirement: The receiver needs sufficient buffer space to store out-of-order frames until the missing frames arrive.
- Complexity: Selective Repeat ARQ is more complex to implement than Stop-and-Wait ARQ and Go-Back-N ARQ because it requires managing out-of-order frames and acknowledgments.
- Acknowledgment Overhead: The receiver has to send an acknowledgment for each individual frame, even if they are received out of order.
Summary of Differences Between Selective Repeat ARQ and Go-Back-N ARQ:
Feature | Selective Repeat ARQ | Go-Back-N ARQ |
---|---|---|
Frame Retransmission | Only lost or corrupted frames are retransmitted. | All frames after the lost frame are retransmitted. |
Receiver Behavior | Can accept and buffer out-of-order frames. | Discards out-of-order frames. |
Window Size | Sender and receiver both have their own window sizes. | Sender has a window size, but the receiver has no window size. |
Efficiency | More efficient in terms of bandwidth utilization. | Less efficient in case of lost frames. |
Complexity | More complex to implement due to out-of-order buffering. | Simpler to implement but less efficient. |
Conclusion:
Selective Repeat ARQ is a highly efficient protocol for reliable data transmission, particularly suited for high-speed networks or scenarios with high packet loss rates. It allows for better throughput by only retransmitting lost frames, but it requires more complex buffer management at both the sender and receiver. If the application demands low latency and reliable delivery with minimal overhead, Selective Repeat ARQ is an excellent choice.