ARQ (Automatic Repeat reQuest) is a type of error/flow control protocol that uses acknowledgments and timeouts to ensure reliable data transmission over a network. ARQ protocols are used to manage flow control and to handle errors in data communication, typically in scenarios where packets may be lost, corrupted, or need to be retransmitted.
In ARQ, flow control is implemented to ensure that the sender does not overwhelm the receiver, and that data is delivered reliably. There are different ARQ protocols that use various mechanisms to achieve this.
Types of ARQ Protocols:
- Stop-and-Wait ARQ:
- Basic Concept: In the Stop-and-Wait ARQ, the sender transmits a single data frame and waits for an acknowledgment (ACK) from the receiver before sending the next frame.
- Flow Control: The sender can only send one frame at a time and must wait for the acknowledgment. If the acknowledgment is not received before a timeout, the sender retransmits the frame.
- Advantages:
- Simple and easy to implement.
- Ensures reliable data transmission by waiting for the acknowledgment of each frame.
- Disadvantages:
- Inefficient for high-latency or high-speed networks, as the sender spends a lot of time waiting for an acknowledgment before sending the next frame.
- Poor utilization of the link when the round-trip time (RTT) is large.
- Go-Back-N ARQ:
- Basic Concept: In Go-Back-N ARQ, the sender can send multiple frames (up to a specified window size) without waiting for an acknowledgment for each individual frame. However, if any frame is lost or corrupted, the receiver sends a negative acknowledgment (NACK) or the sender simply retransmits all frames from the lost frame onward.
- Flow Control: The sender can transmit a series of frames without waiting for an acknowledgment after each one. The window size specifies the maximum number of unacknowledged frames that can be sent before the sender waits for acknowledgment.
- Advantages:
- More efficient than Stop-and-Wait because multiple frames can be transmitted in parallel, reducing idle times.
- Works well in environments where retransmission is needed for lost frames.
- Disadvantages:
- Inefficient in terms of bandwidth utilization if a frame is lost because all subsequent frames must be retransmitted (not just the lost one).
- The receiver has to discard any out-of-order frames, which can cause delays.
- Selective Repeat ARQ:
- Basic Concept: In Selective Repeat ARQ, the sender can send multiple frames (like Go-Back-N) but only retransmits the specific frames that were lost or corrupted. The receiver can accept frames out of order and buffers them until any missing frames are received.
- Flow Control: Similar to Go-Back-N, the sender can transmit several frames within the window, but only frames that are acknowledged (or explicitly negative acknowledgment (NACK)) are retransmitted. The receiver can buffer frames that are out of order until the missing frame(s) are received.
- Advantages:
- More efficient than Go-Back-N because only the lost frames are resent, reducing retransmissions.
- Better bandwidth utilization, especially in networks where frame loss is common.
- Disadvantages:
- Requires more complex buffer management at both the sender and receiver.
- The receiver needs to store out-of-order frames until missing frames arrive.
ARQ Protocols in Action:
Let’s illustrate how Go-Back-N and Selective Repeat work with flow control:
Go-Back-N ARQ Example:
- Window size: 3 (This means the sender can transmit 3 frames before waiting for an acknowledgment.)
- Sender sends frames 1, 2, and 3.
- Receiver receives frames 1 and 2, but frame 3 is lost.
- Receiver sends ACK1 for frame 1 and ACK2 for frame 2, but no ACK for frame 3.
- Sender times out and retransmits frames 3, 4, and 5 (because Go-Back-N retransmits all frames from the lost one onward).
Selective Repeat ARQ Example:
- Window size: 3
- Sender sends frames 1, 2, and 3.
- Receiver receives frames 1 and 3 but misses frame 2 (lost).
- Receiver sends ACK1 for frame 1 and ACK3 for frame 3 (but doesn’t acknowledge frame 2).
- Sender receives the ACKs, realizes that frame 2 is missing, and retransmits only frame 2 (rather than all frames).
Flow Control Mechanisms in ARQ:
- Sender Buffer Management: The sender must ensure that it doesn’t exceed the allowed window size when transmitting data. In Go-Back-N, this means sending only as many frames as the window size allows before waiting for ACKs. In Selective Repeat, the sender must only resend specific frames that were lost or corrupted.
- Receiver Buffering: The receiver has a limited buffer size to hold incoming frames. If the receiver cannot process the incoming frames quickly enough, the sender must be signaled to slow down or stop transmitting. In Selective Repeat, the receiver needs enough buffer space to store out-of-order frames until the missing frames are received.
- Acknowledgments: The use of positive (ACK) and negative acknowledgments (NACK) allows the receiver to indicate which frames have been received correctly and which need to be retransmitted. A NACK (or lack of ACK for a specific frame) triggers retransmission.
- Timeout Mechanism: Both the sender and receiver must have timers to ensure that frames are retransmitted if acknowledgment is not received within a certain period. If the sender doesn’t receive an ACK in time, it retransmits the frame.
Summary:
- Stop-and-Wait ARQ: Simple, but inefficient for high-speed networks. The sender sends one frame at a time and waits for an acknowledgment.
- Go-Back-N ARQ: More efficient than Stop-and-Wait, allowing multiple frames to be sent before waiting for acknowledgment. However, if a frame is lost, all subsequent frames must be retransmitted.
- Selective Repeat ARQ: More efficient than Go-Back-N, allowing only the lost frames to be retransmitted. It requires more complex buffering at both the sender and receiver.
Flow control in ARQ protocols helps to avoid overwhelming the receiver and ensures that data is transmitted reliably and efficiently. The choice of ARQ protocol depends on the application’s requirements, including bandwidth, latency, and error handling needs.