Signup/Sign In
PUBLISHED ON: APRIL 30, 2021

Sliding Window Protocol

In this tutorial, we will be covering the concept of Sliding window Protocol in Computer Networks.

Sliding Window protocols are those protocols that are used as a method of flow control in networks for the transfer of data.

  • With the help of the sliding window technique, multiple frames can be sent at a time by the sender before receiving any acknowledgment from the receiver.

  • Sliding Window protocols make the use of TCP(transmission control protocol).

  • The receiver can send the acknowledgment of multiple frames transmitted by the sender using a single ACK frame.

  • In the Sliding Window protocols, the term sliding window mainly refers to the imaginary box that can hold the frames of both the sender side as well as receiver side.

Sliding Window

The Sliding Window mainly provides the upper limit on the number of frames that can be transmitted before the requirement of an acknowledgment.

  • The frames get acknowledged by the receiver at any point even when the window is not completely full on the receiver side.

  • Also, the Frames may be transmitted by the source side even when at the time the window is not yet full on the sender side.

  • There is the specific size of the window, where the frames are numbered modulo- n, which simply means frames are numbered from 0 to n-1.
    For e.g. if n = 10, the frames are numbered 0, 1,2,3,4,5,6, 7,8,9, 0, 1,2,3,4,5,6, 7, 8,9,0, 1, ….

  • Whenever the receiver sends an acknowledgment (ACK)it also includes the number of the next frame that it expects to receive. For example, in the order to acknowledge the group of frames that ends in frame 6, the receiver needs to send the ACK that contains the number 7. When the sender sees an ACK with the number 7, then the sender comes to know that all the frames up to number 6 have been successfully received.

Let us now understand the working of the sliding window protocols:

There is a finite size buffer on the sender side as well as on the receiver side. The buffer on the sending side is also known as sending window while the buffer on the receiving side is known as receiving window.

  • Mainly the size of the sending window is used to determines the sequence number of the outbound frames.

  • Suppose the sequence number of the frames is a field of size n bit, then the assigned range of the sequence numbers is 0 to 2?????1.

  • As a result, the size of the sending window is 2?????1. In the order to accommodate a sending window whose size is 2?????1, there must be an n-bit sequence number that is chosen.

Each and every packet sent by the sender must get acknowledged by the receiver. There is a timer maintained by the sender for each sent packet and in case if there is a packet that is left unacknowledged in a certain time then the packet will be resent.

Also, the sender can send a whole window of packets before receiving an acknowledgment of the first packet in the window. And this will lead to higher transfer rates because the sender may send multiple packets without waiting for the acknowledgment of each packet.

Also, the receiver advertises its window size, which mainly indicates to the sender how much data it can receive. so that sender does not fill up the buffers of the receiver.

With the help of the modulo-n technique, the sequence numbers are mainly numbered. Let us take an example here if the size of the sending window size is 5, then the sequence numbers will be 0, 1, 2, 3, 4,0, 1, 2, 3, 4, 0, and so on.

The size of the receiving window indicates the maximum number of frames that the receiver can accept at a time. This size also determines the maximum number of frames that can be sent by the sender before receiving an acknowledgment.

In the sliding window, we make use of a technique known as Piggybacking. With the help of piggybacking technique, the acknowledgment is attached with the data frame.

Given below are two protocols that lie under the category of Sliding window are as follows;

  1. Go-Back-N ARQ Protocol

  2. Selective Repeat ARQ protocol

Sliding Window(Sender side)

In order to keep the track of the frames, the sender station sends the sequentially numbered frames.

  • As the sequence number to be used should occupy a field in the frame. Thus sequence number should be of a limited size.

  • If the k bits are allowed by the header of the frame, then the sequence number ranges from 0 to 2k-1.

  • There is a list of sequence numbers that is mainly maintained by the sender and on;y these are allowed to send by the sender.

  • The size of the sender window is at most 2k-1.

  • For example; if 4 bits are allowed by the frame then the size of the window is 2 raised to the power 4 -1
    16-1=15.

  • The buffer is provided to the sender that has the size equal to the size of the window.

Sliding Window(Receiver side)

The size of the window on the receiver side is always 1.

  • Acknowledgment of a frame is done by sending an ACK frame by the receiver to the sender along with the sequence number of the next expected frame.

  • It is explicitly announced by the receiver that it is prepared to receive N next frames, which begins with the number that is specified.

  • And this scheme is used in order to acknowledge multiple frames.

  • The window at the receiver side can hold 2,3,4 frame but holding the ACK frame until frame 4 has arrived. After the arrival, it will send the ACK along with sequence number 5 with which the acknowledgment of 2,3,4 is done at a time.

  • The buffer size needed by the receiver is 1.

Advantages of Sliding window

  • The transmission of multiple packets can be done without receiving an acknowledgment.

  • Using full duplex lines piggybacking can be done.

Disadvantages of the Sliding window

  • There is no limitation on sequence numbers that are required by this protocol.

  • There may be a wastage of bandwidth in some situations.



About the author:
Aspiring Software developer working as a content writer. I like computer related subjects like Computer Networks, Operating system, CAO, Database, and I am also learning Python.