Sushant Gaurav

Selective Repeat ARQ Protocol

The selective repeat ARQ is one of the Sliding Window Protocol strategies that is used where reliable in-order delivery of the data packets is required. The selective repeat ARQ is used for noisy channels or links and it manages the flow and error control between the sender and the receiver. In the selective repeat ARQ, we only resend the data frames that are damaged or lost. If any frame is lost or damaged then the receiver sends a negative acknowledgment (NACK) to the sender and if the frame is correctly received, it sends back an acknowledgment (ACK). As we only resend the selected damaged frames we name this technique the Selective Repeat ARQ technique. The ACK and the NACK have the sequence number of the frame that helps the sender identify the lost frame.

What is Selective Repeat ARQ?

The selective repeat ARQ is one of the Sliding Window Protocol strategies that is used where reliable in-order delivery of the data packets is required. The selective repeat ARQ is used for noisy channels or links and it manages the flow and error control between the sender and the receiver.

In the selective repeat ARQ, we only resend the data frames that are damaged or lost. On the other hand, the correct frames are received at the receiver’s end and are buffered for future usage. As we only resend the selected damaged frames we name this technique the Selective Repeat ARQ technique.

In the Selective Repeat ARQ protocol, ARQ stands for Automatic Repeat Request. ARQ is an error-control strategy that ensures that a sequence of information is delivered in order and without any errors or duplications despite transmission errors and losses.

Requirements for Error Control:

  • It helps us to detect if there is any kind of error in the transmission of data.
  • Error detection also introduces the concept of ACK and NACK which helps to detect the proper delivery of data frames.
  • It also helps the sender to detect the damaged or lost data frames so that the sender can re-transmit the frame.

In selective repeat ARQ, the sender sets a timer for each frame so whenever the timer is over and the sender has not received any acknowledgment for the frame, then the sender knows that the particular frame is either lost or damaged. So, the sender sends back the lost or damaged frame once the timer is out.

Now, as we can see the sender needs to wait for the timer to expire before retransmission. So, we use negative acknowledgment or NACK. As the receiver receives frames from the sender, it keeps track of the sequence number of the frame buffers it into the memory, and sends an ACK from the frame. The ack or acknowledgment lets the sender know that the particular frame is correctly received by the receiver.

Now, if any frame is lost or damaged then the receiver sends a NACK to the sender. When the sender gets NACK then it retransmits the lost frame only. The receiver does not discard all the subsequent frames following a lost frame, it just sends back A NACK and stores the rest of the frames in its memory buffer. In this way, the sender does not need to wait for the timer to expire. Hence, the performance of the selective repeat ARQ increases.

The ACK and the NACK have the sequence number of the frame that helps the sender identify the lost frame.

As the receiver may receive the frames in a different order, the receiver has the capability of sorting the frames present in the memory buffer using the sequence numbers. On the other hand, the sender must be capable enough to search for the lost frame for which the NACK has been received. So searching at the sender’s end and sorting at the receiver’s are two minor drawbacks of the selective repeat ARQ.

Note: The sliding window protocol is a data link layer protocol that is useful in the sequential and reliable delivery of the data frames. Using the sliding window protocol, the sender can send multiple frames at a time.

The other two sliding window protocol strategies are:

  • 1-bit or Stop & Wait ARQ, and
  • Go-Back-N ARQ.

Let us learn the workings of the selective repeat ARQ using an example in the next section.

Working of Selective Repeat Protocol

Before learning about the working of the selective repeat ARQ, we should be familiar with the window size of the sender and receiver as the selective repeat ARQ is a type of sliding window protocol only.

In the selective repeat ARQ, both the sender and the receiver have windows of the same size. The window on the sender’s side covers the sequence of data packets that are sent (or to be sent). On the other hand, the window on the receiver’s side covers the sequence of data packets that are received (or to be received).

The size of the sender’s window is 2(m−1)2(m−1), where m is the number of bits used in the header of the packet to express the packet’s sequence number. The window size of the receiver is the same as that of the sender i.e. 2(m−1)2(m−1). The sender’s window size is represented using Ws and the receiver’s window size is represented using Wr.

The overall working of the selective repeat ARQ is simple. Initially, the sender sends several frames according to the window size. The receiver on the other end receives the frames and sends the ACK for the correct frames and NACK for lost or damaged frames. The sender re-transmits the frames for which the NACK was sent by the receiver. After receiving all the frames, the receiver sorts the frame according to the sequence number for further usage.

Now, let us take an example to visualize the working of selective repeat ARQ or how the data packet is transmitted using the selective repeat ARQ protocol. The image below shows the transmission of frames. Let us suppose that the window size of the sender and the receiver is 2.

Working of Selective Repeat Protocol

The steps of data transmission can be:

  1. The sender sends frames 0 and 1.
  2. The receiver receives the frames and sends back ACK 0 and ACK 1.
  3. Again the sender sends the frames 2 and 3.
  4. The receiver only receives the frame 3. So it sends back NACK 2 which means that the 2nd frame is lost and needs to be re-transmitted.
  5. So, the sender sends back frame 2 and this process is continued till all the frames have been received by the receiver.

From protocols to architecture, our Free Computer Networks course covers it all. Join now and learn Computer Networks from industry experts!

Conclusion

  • The selective repeat ARQ is one of the Sliding Window Protocol strategies that is used where reliable in-order delivery of the data packets is required.
  • ARQ (Automatic Repeat Request) is an error-control strategy that ensures that a sequence of information is delivered in order and without any error or duplications despite transmission errors and losses.
  • The selective repeat ARQ is used for noisy channels or links and it manages the flow and error control between the sender and the receiver.
  • In the selective repeat ARQ, we only resend the data frames that are damaged or lost.
  • If any frame is lost or damaged then the receiver sends a negative acknowledgment (NACK) to the sender and if the frame is correctly received, it sends back an acknowledgment (ACK).
  • The sender sets a timer for each frame so whenever the timer is over and the sender has not received any acknowledgment, then the sender knows that the particular frame is either lost or damaged.
  • As the sender needs to wait for the timer to expire before retransmission. So, we use negative acknowledgment or NACK.
  • The ACK and the NACK have the sequence number of the frame that helps the sender to identify the lost frame.
  • The receiver has the capability of sorting the frames present in the memory buffer using the sequence numbers.
  • The sender must be capable enough to search for the lost frame for which the NACK has been received.

Author