• Skip to main content
  • Skip to primary sidebar
  • Computer Architecture
  • Computer Networks
  • DBMS
  • OS
  • Software Engineering
  • Security
  • OOT
binary-terms-logo

Binary Terms

The Computer Science & IT Guide

Sliding Window Protocol

The sliding window protocol is a flow control protocol for noisy channels. Being a flow control protocol, it prevents the receiver from overwhelming receiver from the data.

What is the purpose of Flow Control?

The rate at which the sender sends the data and at which the receiver receives the data may vary. However, the receiver maintains a data buffer as it has to process data before forwarding it to the upper layer.

Now, if the sender sends the data faster than the receiver can receive, then within some time, the data buffer at the receiver’s end will fill up and overflow while the receiver is still processing the old data.

This is why we require a flow control mechanism that prevents the sender from overwhelming the receiver with the data.

However, the sliding window protocol offers error control by adding the sequence number to the transmitted frames. Sequencing helps the receiver identify whether all the packets have arrived successfully and helps to sort them in the proper order.

Let’s learn more about this protocol in the section ahead.

Content: Sliding Window Protocol

  1. What is Sliding Window Protocol?
  2. Working Principle
  3. Types of Sliding Window Protocol
    • Go-Back N ARQ
    • Selective Repeat ARQ
  4. Go-Back N Vs Selective Repeat
  5. Advantages and Disadvantages

What is Sliding Window Protocol?

The sliding window protocol allows the sender to send multiple frames without waiting for an acknowledgement. Thus, it applies the pipelining concept, where the transmission of the next frame starts even before the previous one is acknowledged.

Now to maintain the flow control, the sender and receiver both maintain a window, i.e. sending window and the receiving window. The sending window size corresponds to the number of frames the sender is permitted to send. And for error control, it maintains a sequence number of frames.

With sliding window protocol full duplex line is possible, which means several data packets and acknowledgement can be in the channel simultaneously. It even applies the concept of piggybacking, where the acknowledgement is delayed temporarily so that it can be hooked to the next outgoing packet.

Note: The acknowledgement is sent separately if there is no next outgoing packet.

Working Principle of Sliding Window Protocol

As we know, both sender and receiver maintain a buffer window. We refer senders’ buffer as sending window and the receiver’s buffer as receiving window.

Frames are assigned the sequence number from 0 to the maximum number. The maximum number of the frame is 2n – 1. Here, n is the number of bits that the packet’s header allows for the sequence number.

How many frames can be sent without waiting for the acknowledgement depends on the size of the sliding window. The maximum size of the window can be 2n – 1. However, some protocols have variable window sizes.

Types of Sliding Window Protocol

The types of sliding window protocols differ in terms of efficiency, complexity and buffer requirement.

Go back N ARQ

In the Go-Back N Automatic Repeat Request protocol, the sender can transmit several packets before receiving the acknowledgements. The packets are sequentially numbered, and at a time, only N number of packets are transmitted. Here, N is the size of the sliding window.

However, the receiver can receive only one packet at a time. This means the size of receiving window is one in Go-back N.

Now, the packets are sequentially numbered, and only N number of frames are sent at once. The sender keeps a copy of the sent frames until their acknowledgement is received. If any frame is not acknowledged within a particular time, all the frames starting from the unacknowledged one are retransmitted.

Let’s understand with the help of an example.

Example of Go-Back N ARQ Protocol

Consider that the packet’s header allows 3 bits for the sequence number. So, the packets will be numbered from 0 to 23 -1, i.e., from 0 to 7.

Note: We will go with the maximum size of the window 23 -1, i.e., 7

Now consider that the sender has 12 packets to send. These packets are sequentially numbered from 0 to 7, and the sequence is repeated again for the rest of the packets.

Now, as our window size is 7 the sender will send packets from 0 to 6 without waiting for the acknowledgement.

Go-Back N Sliding Window Protocol

Now, as the receiver sends the acknowledgement for the 0th packet, the sliding window shifts forward and sends the 7th packet.

Go-Back N 1

After receiving acknowledgement for the 1st packet, the sliding window moves forward and now sends the next packet in the sequence, i.e. 0th.

Go-Back N 2

Meanwhile, the second packet is lost or gets damaged. It may even happen that its acknowledgement is lost.

Go-Back N 3

So, after completing the waiting time for acknowledgement, the sender resends all the frames that the sliding window has, i.e. from 2 to 0. And even though after 2nd packet, the receiver has received the rest of the frames successfully, it discards them.

Go-Back N 5

The sliding window divides the packets into three sections, as you can see in the image below:Go-Back N 4

Selective Repeat ARQ

Like Go-back N, in the Selective Repeat Automatic Repeat Request protocol, the sender can transmit several packets before receiving the acknowledgements. The maximum size of the sending and receiving window is the same in this protocol, i.e., 2m-1.

So, if we consider the same example we discussed in Go-back N., the packets will be numbered from 0 to 23-1, i.e., from 0 to 7.

The maximum size of the sliding window is 23-1 , i.e., 4.

Now consider that the sender has 12 packets to send. These packets are sequentially numbered from 0 to 7, and the sequence is repeated again for the rest of the packets.

Now the sender sends packet 0 to packet 3 without waiting for any acknowledgement.

Selective Repeat

When it receives the acknowledgement for packet 0, the sliding window moves forwards, and the sender sends packet 4.

Selective Repeat 1Further, when the sender receives the acknowledgement of packet 1, the sliding window slides by one position and sends packet 5.

Selective Repeat 2

Meanwhile, there is a timeout for the acknowledgement of packet 2; however, the sender receives the acknowledgement for packets 3, 4 and 5.

Selective Repeat 3

So, the sender resends packet 2 and waits for its acknowledgement. As soon as it receives the acknowledgement for packet 2 the sliding window will slide, and the sender will send packet 6.

Selective Repeat 4

In this way, selective repeat protocol only resends the selective packet that is either lost, damaged, or negatively acknowledged, or if its acknowledgement is lost. It is quite complex as compared to Go-Back N but is comparatively efficient as it utilises the maximum bandwidth.

Go-Back N Vs Selective Repeat

Basis for ComparisonGo-Back NSelective Repeat
BasicIf a packet is corrupted or lost, all the succeeding frames are resentOnly the corrupted frame is resent
Bandwidth WastageIf the error rate is high, Go-Back N waste a lot of bandwidthWastage of bandwidth is less
SortingDo not require any searching and sorting.Requires searching and sorting as it has to rearrange the resent packet.
StorageComparatively less complicated as it doesn’t require any searching and sortingComplicated as it requires searching and sorting, which in turn raises the need for storage

Advantages and Disadvantages

Advantages
  • It allows the sender to send multiple packets before receiving any acknowledgement.
  • Manages flow control by using a buffer window at both the sender and receiver sides. And it manages the error control by adding sequence numbers to packets.
  • It applies the pipelining concept, where multiple packets are sent, and a copy of them is stored in the buffer. As these packets are acknowledged, the copies are discarded, and the memory is freed. It increases the efficiency of the protocols and utilisation of available bandwidth.
  • Achieve full-duplex and also allows piggybacking the acknowledgement with the next outgoing data packet.
Disadvantages
  • With the protocols such as Go-Back N, there still needs to be more bandwidth.

So, this is all about the sliding window protocol, which allows the sender to send multiple data packets before receiving any acknowledgement to utilise the channel’s maximum bandwidth. We have discussed two types of sliding window protocols Go-Back N and Selective Repeat.

In the Go-Back N protocol, if a packet is lost or corrupted or the acknowledgement is lost, it resends all the subsequent packets it has already sent. In contrast, the Selective Repeat protocol only resents the damaged or lost packet.

Related Terms:

  1. Intermediate Code Generation
  2. Bottom-Up Parsing in Compiler Design
  3. Data Warehouse Architecture
  4. Data Cube
  5. Big Data

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

Most Searched Terms

  • Directory Structure
  • Contiguous Memory Allocation
  • Addressing Mode and its Types
  • Pipelining
  • Vector Processing
  • Register Organization
  • Direct Memory Access (DMA)
  • Process Control Block (PCB)
  • Swapping in Operating System
  • Relational Data Model

Recent Additions

  • Types of Processors
  • Demand Paging in Operating System
  • Agents and Environment in Artificial Intelligence
  • Array Processor in Computer Architecture
  • Deadlock Avoidance in Operating System
  • Fragmentation in Operating System
  • Assembly Language in Computer
  • Control Signals in Computer Architecture
  • Memory Hierarchy in Computer Architecture
  • Ethernet in Computer Networks

Categories

  • Artificial Intelligence
  • Cloud Computing
  • Compiler Design
  • Computer Architecture
  • Computer Networks
  • Data Warehouse and Mining
  • DBMS
  • Object Oriented Technology
  • Operating System
  • Security
  • Software Engineering

Copyright © 2025 · Binary Terms · Contact Us · About Us · Privacy