Sliding Window Protocol – Working and Types

FREE Online Courses: Elevate Skills, Zero Cost. Enroll Now!

In this article, we will learn about sliding window protocol with its working, advantages, limitations and types. Let’s start!!

What is Sliding Window Protocol?

Sliding windows are a method of sending multiple frames at once. It manages data packets between the two devices, ensuring delivery of data frames reliably and gradually. It’s also found in TCP (Transmission Control Protocol).

Each frame is sent from the sequence number in this technique. The sequence numbers find use in the receiving end to locate missing data. The sequence number finds use in the sliding window technique in order to avoid duplicate data.

Working Principle of Sliding Window:

The sender’s buffer is the sending window, and the receiver’s buffer is the receiving window in these protocols.

Assignment of sequence numbers to frames is between the range 0 to 2n-1 if the frames’ sequence number is an n-bit field. As a result, the sending window has a size of 2n-1. As a result, we choose an n-bit sequence number to accommodate a sending window size of 2n-1.

Modulo-n is used to number the sequence numbers. If the sending window size is set as 3, the sequence numbers will be 0, 1, 2, 0, 1, 2, 0, 1, 2 and so on.

The receiving window’s size refers to the maximum number of frames the receiver can accept at one time. It establishes the maximum number of frames a sender can send before receiving an acknowledgement.

Sliding Window (Sender and Receiver side):

a. Sender Side:

The sequence number of the frame occupies a field in the frame. So, the sequence number should be kept to a minimum.

The sequence number ranges from 0 to 2k-1 if the frame header allows k bits.

The sender maintains a list of sequence numbers that are only allowed to be sent by the sender.

The sender window can only be 2k-1 in size.

For example, if the frame allows 4 bits, the window’s size is 2 raised to the power 4 -1 16-1=15.

The sender has a buffer with the same size as the window.

b. Receiver Side:

On the receiver side, the size of the window is always 1.

The receiver acknowledges a frame by sending an ACK frame to the sender, along with the sequence number of the next expected frame.

The receiver declares explicitly that it is ready to receive N subsequent frames, starting with the specified number.

We use this scheme in order to acknowledge multiple frames.

The receiver’s window can hold 2,3,4 frames, but the ACK frame will be held until frame 4 arrives. It will send the

ACK along with sequence number 5 after the arrival, with which the acknowledgment of 2,3,4 will be done one at a time.

The receiver requires a buffer size of one.

Types of Sliding Window Protocols:

1. Go-Back-N ARQ:

The Go-Back-N Automatic Repeat Request protocol is also known as the Go-Back-N ARQ protocol. A sliding window method finds use in this data link layer protocol. In the event of corruption or loss of frames, all subsequent frames must be sent again.

In this protocol, the sender window size is N. The size of the receiver window is always one.

In the event of transmission of a corrupted frame, the receiver cancels it. The receiver does not accept a corrupted frame. The sender sends the correct frame again when the timer expires.

Example of Go-Back-N ARQ:

go back n arq

a. First, the sender sends the first four frames in the window (here the window size is 4).

working of go back n arq

 

b. Then, the receiver sends the acknowledgment for the 0th frame.

working of go back n arq steps

c. The receiver then slides the window over and sends the next frame in the queue.

working of go back n arq type

d. Accordingly, the receiver sends the acknowledgement for the 1st frame, and upon receiving that, the sender slides the window again and sends the next frame. This process keeps on happening until all the frames are sent successfully.

2. Selective Repeat ARQ:

Selective Repeat ARQ (Selective Repeat Automatic Repeat Request) is another name for Selective Repeat ARQ. A sliding window method is used in this data link layer protocol. If the frame has fewer errors, Go-Back-N ARQ works well. However, if the frame contains a lot of errors, sending the frames again will result in a lot of bandwidth loss. As a result, we employ the Selective Repeat ARQ method. The size of the sender window is always equal to the size of the receiver window in this protocol. The sliding window’s size is always greater than 1.

Example of Selective Repeat ARQ:

selective repeat arq

a. First, the sender sends the contents of the first window, which are frames 0 and 1 (because the window size is 2).

b. When the receiver receives the frames sent above, it sends an acknowledgment for frame 2 (because frame 2 is the frame it expects to receive next).

c. The sender then sends frames 2 and 3, however, frame 2 is lost on the way. The receiver thus sends back a “NAK” signal or a non-acknowledgment to let the sender know that frame 2 has been lost, and thus the sender retransmits frame 2.

Difference between Go-Back-N ARQ vs Selective Repeat ARQ:

Go-Back-N ARQ

Selective Repeat ARQ

All subsequent frames must be sent again if a frame is corrupted or lost.Only the frame that has been corrupted or lost is sent again.
It wastes a lot of bandwidth if it has a high error rate.There is less bandwidth loss.
It’s less complicated.It’s more difficult because it requires sorting and searching. It also necessitates more storage.
It does not necessitate any sorting.Sorting is done in this step to ensure that the frames are in the correct order.
It does not necessitate any searching.It is where the search is carried out.
This is being used more frequently.Because it is more complicated, it is used less frequently.

Advantages of Sliding Window Protocols:

1. It is possible to send multiple packets without receiving an acknowledgment.
2. Piggybacking with full-duplex lines is possible.

Disadvantages of Sliding Window Protocol:

1. This protocol does not impose any restrictions on sequence numbers.
2. In some cases, there may be a waste of bandwidth.

Summary

In this article, we looked at the concept of Sliding Window protocols, and also explored the two types of sliding window protocols: Go-Back-N ARQ and Selective Repeat ARQ. We covered the detailed working of each of the two types and also looked at the difference between the 2 protocols.

Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *