Reliable data transmission is critical in computer networking, particularly across long distances or in networks that have high latency. The Sliding Window Protocol is a critical component in obtaining this reliability. It is part of the OSI model’s Data Link Layer and is used in several protocols, including TCP. Sliding Window protocol handles efficiency issues by sending more than one packet at a time with a larger sequence number. The idea is the same as pipelining in architecture. In this article, we will discuss about Sliding Window Protocol.
The Sliding Window Protocol is a key computer networking technique for controlling the flow of data between two devices. It guarantees that data is sent consistently and effectively, allowing many packets to be sent before requiring an acknowledgment for the first, maximizing the use of available bandwidth.
Transmission Delay (Tt) – Time to transmit the packet from the host to the outgoing link. If B is the Bandwidth of the link and D is the Data Size to transmit
Tt = D/B
Propagation Delay (Tp) – It is the time taken by the first bit transferred by the host onto the outgoing link to reach the destination. It depends on the distance d and the wave propagation speed s (depends on the characteristics of the medium).
Tp = d/s
Efficiency – It is defined as the ratio of total useful time to the total cycle time of a packet. For stop and wait protocol,
Total time(TT) = Tt(data) + Tp(data) +
Tt(acknowledgement) + Tp(acknowledgement)
= Tt(data) + Tp(data) + Tp(acknowledgement)
= Tt + 2*Tp
Since acknowledgements are very less in size, their transmission delay can be neglected.
Efficiency = Useful Time / Total Cycle Time
= Tt/(Tt + 2*Tp) (For Stop and Wait)
= 1/(1+2a) [ Using a = Tp/Tt ]
Effective Bandwidth(EB) or Throughput – Number of bits sent per second.
EB = Data Size(D) / Total Cycle time(Tt + 2*Tp)
Multiplying and dividing by Bandwidth (B),
= (1/(1+2a)) * B [ Using a = Tp/Tt ]
= Efficiency * Bandwidth
Capacity of link – If a channel is Full Duplex , then bits can be transferred in both the directions and without any collisions. Number of bits a channel/Link can hold at maximum is its capacity.
Capacity = Bandwidth(B) * Propagation(Tp)
For Full Duplex channels,
Capacity = 2*Bandwidth(B) * Propagation(Tp)
In Stop and Wait protocol , only 1 packet is transmitted onto the link and then sender waits for acknowledgement from the receiver. The problem in this setup is that efficiency is very less as we are not filling the channel with more packets after 1st packet has been put onto the link. Within the total cycle time of Tt + 2*Tp units, we will now calculate the maximum number of packets that sender can transmit on the link before getting an acknowledgement.
In Tt units ----> 1 packet is Transmitted.
In 1 units ----> 1/Tt packet can be Transmitted.
In Tt + 2*Tp units -----> (Tt + 2*Tp)/Tt
packets can be Transmitted
------> 1 + 2a [Using a = Tp/Tt]
Maximum packets That can be Transmitted in total cycle time = 1+2*a Let me explain now with the help of an example. Consider Tt = 1ms, Tp = 1.5ms. In the picture given below, after sender has transmitted packet 0, it will immediately transmit packets 1, 2, 3. Acknowledgement for 0 will arrive after 2*1.5 = 3ms. In Stop and Wait, in time 1 + 2*1.5 = 4ms, we were transferring one packet only. Here we keep a window of packets that we have transmitted but not yet acknowledged . After we have received the Ack for packet 0, window slides and the next packet can be assigned sequence number 0. We reuse the sequence numbers which we have acknowledged so that header size can be kept minimum as shown in the diagram given below.
As we have seen above,
Maximum window size = 1 + 2*a where a = Tp/Tt
Minimum sequence numbers required = 1 + 2*a.
All the packets in the current window will be given a sequence number. Number of bits required to represent the sender window = ceil(log2(1+2*a)). But sometimes number of bits in the protocol headers is pre-defined. Size of sequence number field in header will also determine the maximum number of packets that we can send in total cycle time. If N is the size of sequence number field in the header in bits, then we can have 2 N sequence numbers. Window Size ws = min(1+2*a, 2 N ) If you want to calculate minimum bits required to represent sequence numbers/sender window, it will be ceil(log2(ws)) . In this article, we have discussed sending window only. For receiving window, there are 2 protocols namely Go Back N and Selective Repeat which are used to implement pipelining practically. We will be discussing receiving window in set 2.
There are two types of Sliding Window Protocol which include Go-Back-N ARQ and Selective Repeat ARQ:
Go-Back-N ARQ allows sending more than one frame before getting the first frame’s acknowledgment. It is also known as sliding window protocol since it makes use of the sliding window notion. There is a limit to the amount of frames that can be sent, and they are numbered consecutively. All frames beginning with that frame are retransmitted if the acknowledgment is not received in a timely manner. For more detail visit the page Go-Back-N ARQ .
Additionally, this protocol allows additional frames to be sent before the first frame’s acknowledgment is received. But in this case, the excellent frames are received and buffered, and only the incorrect or lost frames are retransmitted. Check the detailed explanation of Selective Repeat ARQ .
Efficiency of Go-Back-N Protocol is
N/(1+2*a)
Efficiency of selective Repeat protocol is also
N/(1+2*a)
The Sliding Window Protocol is a crucial technique for assuring reliable and efficient data delivery in computer networks. Allowing many packets to be delivered before demanding acknowledgments and maximizes bandwidth use and minimizes delays. This protocol, which is implemented in forms such as Go-Back-N ARQ and Selective Repeat ARQ, maintains a balance between efficiency and reliability, despite the increased complexity and potential transmission latency.
Sliding Window Protocol are Sender Window , Reciever Window , Acknowledgement.
If the packet is lost then the sender retransmit the packet again then receiver sends acknowledgement for the retransmitted packet.
Out of order packet is not allowed in Sliding Window Protocol.
The amount of milliseconds (ms) required for a network request to travel from a starting point to a destination and back again is known as the round-trip time (RTT).