Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Sliding window protocol
3.
Working principle of sliding window
3.1.
Sender side
3.2.
Receiver side
4.
Types of Sliding Window Protocol
4.1.
1. Go Back-N ARQ
4.2.
2. Selective Repeat ARQ
5.
Differences between Go-Back-N ARQ and Selective Repeat ARQ
6.
Frequently Asked Questions
6.1.
What is the buffer size in Go-back-N ARQ and Selective Repeat ARQ?
6.2.
What is the significance of time-out in transmitting frames?
6.3.
What is a frame?
6.4.
Elaborate on the advantages of sliding window protocol?
6.5.
What are some disadvantages of the sliding window protocol?
7.
Conclusion
Last Updated: Jun 13, 2024

Sliding Window Protocol

Author Aditya kumar
0 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @
Computer Networks

Introduction

Network models and related protocols illustrate a standard to be followed during the transmission between two peers. A network can go down if two peers are not on the same page. We will first discuss this sliding window protocol. Then we will see its types and discuss the difference among them.

(See Network Types)

Sliding window protocol

Two peers in the network maintain a buffer of frames sent across the network. Sending multiple frames simultaneously is the task, and the sliding window is the technique to be followed while sending each of the frames. Once the receiver has received a frame, an acknowledgement is sent to the sender of the frame to process for the other frame in the buffer array of frames. Multiple frames can be transmitted from sender to receiver without needing to have an acknowledgement. The sliding window is just a drawn up name to refer to the frame holding capacity at both ends. It does make use of transmission control protocol.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Working principle of sliding window

The sliding window mentions the criteria for several frames that can be sent until being acknowledged by the receiver.

  • Frames will get acknowledged even when the window is not filled up on the receiver side.
  • Frames can be transferred from the senders’ side without the need to be filled up.
  • The frames are numbered modulo-n which signifies the size of the window. If n is the window size, the frames are numbered from 0 to n-1
  • The receiver also sends the number of expected frames to receive along with every acknowledgement. When an acknowledgement is being sent with the number 8, all 7 frames have been received, and the 8th one is to be acknowledged. This concept of acknowledgement being sent is termed piggybacking.

 

Let us look at both sender’s side and receiver’s size functionalities.

Sender side

The sender window maintains a well-sized array to sequentially attack identity to each frame. Fork bits being allowed by the frame's header, the sequence number lies between 0 to 2k-1. 

Receiver side

The receiver window size is always kept at one. The receiver can receive all n frames one by one and send an acknowledgement to all of them. When received 1,2 frames, the window will hold on to acknowledgement frame 3 until it arrives, then the receiver will send this acknowledgement to the sender to confirm that all three frames have been received. This way, the sender gets to know which frame to send next. Buffer size is kept at once on the receiver’s side.

 

You can also read about mime protocol, Basic Networking Commands,Lock based protocol in DBMS

Types of Sliding Window Protocol

Types of Sliding Window Protocol

Source: Types of sliding window protocol

 

 

Now, let us discuss each type of sliding window protocol in detail.

1. Go Back-N ARQ

In this protocol, the frames are sent again if they are lost while being transmitted. The size of the receiver buffer will be one, while the size of the sender buffer is predefined. The receiver cancels the frame if it gets corrupted; when the sender's timer for an acknowledgement to be received expires, the sender sends the same frame again without moving on with different frames.

Go Back-N ARQ

Source: Go Back-N ARQ

2. Selective Repeat ARQ

Selective repeat automatic repeat request works with the data link layer and uses the sliding window method to send frames. Only the corrupted frame during transmission is sent again in its execution, while the further requests get acknowledged. The window size in both the sender and receiver is the same. This protocol helps in saving on bandwidth as compared to Go Back-N ARQ, which processed the whole frames again without selectively choosing to send the faulty frames.

Selective Repeat ARQ

Source: Selective Repeat ARQ

Differences between Go-Back-N ARQ and Selective Repeat ARQ

Go-Back-N ARQ

Selective Repeat ARQ

Faulty frame detection lets the sender send all frames starting from the faulty frame again.All the faulty frames are sent again while the subsequent frames are acknowledged.
Bandwidth lossLow bandwidth cost
Lesser complexMore complex as searching and sorting is required to place packets at appropriate places
No extra memory space requiredMemory space is required to perform sortings
Used more oftenNot much used because of complexity

You can also read about the network models in computer network.

Frequently Asked Questions

What is the buffer size in Go-back-N ARQ and Selective Repeat ARQ?

In the case of Go Back-N ARQ, the sender buffer is sized to N frames, while the receiver is sized at receiver one frame at a time. In the case of selective repeat ARQ, the sender and receiver frames are sized the same, the sequence is maintained, and faulty frames are placed at their places once acknowledged is sent from the receiver.

What is the significance of time-out in transmitting frames?

Time-out is the timer until which the sender will have to wait to acknowledge the frame being received by the receiver. If the receiver does not send back the acknowledgement, the sender will process it according to protocol.

What is a frame?

A frame is a message wrapped with metadata like senders’ and receivers’ addresses, which pass information through the network. It is just like a packet but contains more bytes of information.

Elaborate on the advantages of sliding window protocol?

Sliding window protocol lets the sender send frames while the receiver is slow at processing frames at their end. In some situations, we can send multiple packets at once.

What are some disadvantages of the sliding window protocol?

Usage of extra bandwidth is sometimes an issue, leading to increased costs, and the sequence numbers are not bound to be in a range.

Conclusion

Congratulations on getting through this article. We discussed the sliding window method and the types used to process and send frames of information across the network. To understand which one is more suitable in a particular use case, we also discussed the different types of sliding window protocols.

Recommended Readings:


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Code360.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Code360.

Previous article
High Level Data Link Control (HDLC) Protocol
Next article
Point to Point Protocol (PPP)
Live masterclass