Let's just look back at the STOP & WAIT, STOP & WAIT ARQ protocols both of which had some drawbacks and then the Go-Back-N ARQ protocol which too had some limitations, as we studied that it requires more bandwidth while retransmitting the data packets, so now, to overcome this problem we came to an alternative technique, which is known as Selective Repeat Protocol.
So, what selective repeat protocol does is that it allows the receiver to accept & buffer the data packets following a damaged or lost one and then retransmits only those data packets which were lost or damaged in the network channel during transmission.
Let's take an example, consider you are sending data packets indexing from packet p1 to p5, now p1 & p2 are received successfully but packet p3 got lost or damaged in the network channel, now unlike Go-Back-N ARQ, as per the selective repeat protocol, the sender will send the packet p4 & p5, which the receiver will receive and after that, the selective repeat protocol will retransmit packet p3.
Implicit Retransmission request: Here, it's the receiver's duty to acknowledge or give positive feedback of received data packet and negative feedback for those which were lost or damaged during transmission, and that too before the expiry of time out timer.
Explicit Retransmission request: In explicit retransmission, the receiver can request retransmission of just one packet.
Either one or both approaches are used in practice.
This protocol is almost like Go-Back-N ARQ protocol, or we can say that it is a modified form of GBN ARQ, the part where it differs is that here buffers are used and both receiver & sender maintain a window of size. This selective repeat works better at times when the network link is mostly unreliable. Because here, in this case, retransmission tends to happen more frequently, the selective retransmission of frames is much more efficient than retransmitting all the frames, selective repeat also requires full-duplex communication channel for consistently transferring the data packet & the feedback/acknowledgment.
Note: The sender's window must be equal to the receiver's window and the window size should be less than or equal to half of the sequence number in the selective repeat protocol. This is to avoid the data packets being recognized incorrectly.
If the window size is greater than the sequence number space and then if a feedback/acknowledgment is lost, then the sender may send new data packets that the receiver believes are retransmissions.
The receiver then stores the correct packets until they can be delivered in the order, to the higher layers.
Now, in the above diagram, the sender first sends frame1(i.e. 0) and immediately the receiver acknowledges the frame and then, the frame2 is transmitted which too got acknowledged. Now, as we can see frame3 is lost during the transmission & was unable to reach the receiver, but the next frame, which is frame4 is transmitted and also accepted by the receiver, who then sends a negative acknowledgment due to which the sender only transmits frame3 again instead of retransmitting all the frames starting from frame3(which happens in Go-Back-N ARQ).
The efficiency of selective repeat protocol is the same as of Go-Back-N ARQ protocol's efficiency.
Efficiency = N/(1+2a)
Where, a = propagation delay/transmission delay
Buffers = N+N
Sequence number = N(sender's side)+N(receiver's side)
With this we have covered the three fow control protocol of computer networks, namely, STOP & WAIT, STOP & WAIT ARQ, Go-Back-N ARQ protocol and the Selective Repeat Protocol. You can learn more about Computer Networks from our Computer Network tutorial.