Sliding window protocol is the data link protocol and an efficient technique to send multiple frames at a time. This protocol ensures the reliable and sequential delivery of data frames. It is also used in TCP (Transmission Control Packet).
In this protocol, there is one sender and receiver, where the sender has the flexibility to send many data frames before getting acknowledgment from the receiver. The sender has a buffer which is referred to as a sending window and on the other side, the receiver has a buffer which is called receiving window. Hence the sliding window method is also called windowing.
This technique uses the contrivance of the sequence number. The sequence numbers are numbered as modulo-n. Each frame has sent from the sequence number so that it can avoid the duplicity of data and maintain the consistency of data.
The size of sending window regulates the sequence number of outbound frames and the size of a receiving window is obtained as the maximum number of frames received by the receiver at a time.
It measures the maximum number of frames that the sender sends to the receiver before receiving acceptance. The sliding window protocol is a flow control protocol. In this, the sender just slides its window on receiving the acknowledgments from the receiver.
In a sliding window protocol, optimal sender window size = 1 + 2a.
Sliding Window Protocol comprises of two types which are:
Go – Back – N ARQ
Selective Repeat ARQ
Go – Back – N ARQ:
This Go-Back-N Automatic Repeat Request is one of the data link protocol which uses a sliding window method. In this method, if one of the sent frames is encountered as corrupted, then all frames have to be sent again.
Here, in the protocol the size of the window is N and the size of the receiver window is always 1.
Go Back-N uses cumulative acknowledgments under which the receiver maintains an acknowledgment timer.
Further, each time receiver receives a new frame which in response generates a new acknowledgment timer.
After that, the timer expires receiver sends the cumulative acknowledgment for all those frames which are not acknowledged at that moment.
However, if required Go-back uses independent acknowledgments too.
Go- back -N protocol silently discards the corrupted frames which means it simply rejects the faulty frame without taking any action.
The efficiency of the Go-Back-N protocol is calculates as:
Selective repeat protocol is the implementation of sliding window protocol. In this protocol, the sender window size is always the same size as the receiver window size.
In terms of size,
Sender window = Receiver window
Selective repeat protocol (SR) uses only independent acknowledgments only which means the receiver acknowledges each frame separately. Additionally, this protocol also not accepts the corrupted frames and hence not silently discard them.
Instead of directly discarding, it sends the negative acknowledgment to the sender. Then, the sender again sends that frame to the receiver.
It also accepts the out-of-order frames which means sometimes it receives the unexpected sequence number frame; then rather than discarding the frame, it keeps it in the sliding window.
SR protocol implemented as a linked list which requires sorting at a receiver’s end.
Whenever the receiver receives a new frame, it generally places it at the end of a linked list.
In order to find a missing frame, the sender requires searching and then the sender repeats that frame only not an entire window which also overcomes the problem of Go-Back-N protocol.
For this reason, it is considers as Selective Repeat Protocol.
Also, it leads to the retransmission of lost frames after time expires.
The efficiency of selective repeat protocol is calculates as:
(In selective repeat protocol, if sender window size = N, then-)