Monday, May 4, 2020

Selective repeat protocol(SRP)


Selective Repeat Protocol(SRP)-

Introduction:

Selective Repeat protocol or SR protocol is an implementation of a sliding window protocol.
This protocol(SRP) is mostly identical to GBN protocol, except that buffers are used and the receiver, and the sender, each maintain a window of size. SRP works better when the link is very unreliable. Because in this case, retransmission tends to happen more frequently, selectively retransmitting frames is more efficient than retransmitting all of them.

Working Principle:

The features and working of this protocol are explained in the following points-
Point-01:

In SR protocol, sender window size is always same as receiver window size.

In SR protocol,
·         Sender window size = Receiver window size
·    The size is of course greater than 1 otherwise the protocol will become Stop and Wait ARQ.
·         If n bits are available for sequence numbers, then-
Sender window size = Receiver window size = 2n/2 = 2n-1

Point-02:

SR protocol uses independent acknowledgements only.

In SR protocol,
·         Receiver acknowledges each frame independently.
·         As receiver receives a new frame from the sender, it sends its acknowledgement.

Point-03:

SR protocol does not accept the corrupted frames but does not silently discard them.

In SR protocol,
·         If receiver receives a frame that is corrupted, then it does not silently discard that frame.
·         Receiver handles the situation efficiently by sending a negative acknowledgement (NACK).
·         Negative acknowledgement allows early retransmission of the corrupted frame.
·         It also avoids waiting for the time out timer to expire at the sender side to retransmit the frame.

Point-05:

SR protocol accepts the out of order frames.

In SR protocol,
·         Consider receiver receives a frame whose sequence number is not what the receiver expects.
·         Then, it does not discard that frame rather accepts it and keeps it in its window.

Point-06:

SR protocol requires sorting at the receiver’s side.

In SR protocol,
·         Receiver window is implemented as a linked list.
·         When receiver receives a new frame, it places the new frame at the end of the linked list.
·         When the received frames are out of order, receiver performs the sorting.
·         Sorting sorts the frames in the correct order.

Point-07:

SR protocol requires searching at the sender’s side.

In SR protocol,
·         Receiver does not reject the out of order frames.
·         Receiver accepts the out of order frames and sort them later.
·         Thus, only the missing frame has to be sent by the sender.
·         For sending the missing frame, sender performs searching and finds the missing frame.
·         Then, sender selectively repeats that frame.
·         Thus, only the selected frame is repeated and not the entire window.
·         That is why, the protocol has been named as “Selective Repeat Protocol“.

Point-08:

SR protocol leads to retransmission of lost frames after expiry of time out timer.

In SR protocol,
·         Consider a frame being sent to the receiver is lost on the way.
·         Then, it is retransmitted only after time out timer expires for that frame at sender’s side.

Efficiency of SR Protocol-

Efficiency of any flow control protocol is given by-

Efficiency = Sender Window Size in Protocol / (1 + 2a)

In selective repeat protocol, if sender window size = N, then-

Efficiency of SR Protocol = N / (1 + 2a)


Advantages:

Following are some of the advantages of Selective Repeat protocol over Go Back N protocol:
SR protocols avoids unnecessary retransmission of packets.
When receiver gets an out of order packet it is acknowledged, but buffered by the receiver. When the receiver gets all the packets, it orders them and then sends to upper layer.
The receiver re-acknowledges already received packets with certain sequence numbers below the current window case, if the receiver does not do so, then the sender’s window would not move forward.

Disadvantages:

·       More complexity at sender and receiver.
·       Each frame must be acknowledged individually(No commutative acknowledgement).
·       Receiver may receive frames out of sequence.

Application:

It is used where reliable in-order delivery of packets is required, such as in the data link layer as well as in the Transmission Control Protocol (TCP). They are also used to improve efficiency when the channel may include high latency.