Sliding window protocol in network flow control | Computer Network

The computer network uses a sliding window protocol for better usage of the underlying network capacity. If there is no need for reliable delivery, sliding window protocol is an optional implementation in the computer network.  The sliding window protocol belongs to the category of flow control mechanism in a computer network.

How does reliable communication works?  For reliable communication, the first basic thing is that the sender should make sure that the sent packet has been received by the receiver.  For that, there is an acknowledgment for each data unit sent.

The simple approach for reliable communication is that the sender sends a single packet at a time and waits for the acknowledgment.  Upon receiving acknowledgment, the sender sends the next packet else, assumes the packet has been lost or corrupted.

For error recovery same packet is retransmitted and again waits for an acknowledgment.  The problem with this basic approach is that at a time there will be a single packet over the network. That reduces the usage of underlying bandwidth and slower communication between the sender and receiver.

What is the window? And sliding means?

To overcome the issue discussed above, the computer network has the concept of a window.  A window is a space that holds or can hold multiple bytes. For example, if there is a window of 1024 bytes and the size of the individual message or frame is 128 bytes long. There could be a maximum of 8 messages at any time in the window.

Sliding window and sliding

How does the window slide?  Sliding means moving to a new set of messages. Suppose a window of size 1024 initially contains frames for sequence numbers from 1 to 1024.  After communication, the receiver receives the acknowledgment till frame sequence number 100.  After that window will have frames for sequence numbers from 101 to 1124.  if we visualize, it looks that the window has shifted to the new set of frames.

OSI model and sliding window :

The OSI model provides guidelines for communication. It has seven layers each layer communicates peer to peer. So at which layer implements the sliding window protocol? The answer is simple, layers/protocols that are responsible for reliable communication. As per the OSI model, the data link layer is responsible for reliable communication with the next hope.  The transport layer depends if an implementation is using a reliable transport layer protocol such as TCP  or if using UDP (unreliable).  The TCP uses flow control for reliable communication with its peer.

Why we have flow control at two layers? Yes, it looks redundant, but having flow control at two layers is an optimization. The transport layer works on the message level while the data link works at the frame level.   A message is broken into several frames. So if a frame is corrupted, then there will be full message retransmission at the transport layer, if there is no flow control at the data link layer.

In this tutorial, we will mainly mention layer two for sliding window discussion.

How many sliding window types in computer communication?

For flow control, there are two types of sliding windows.  One is the receiver window and another is the sender window.  At the start of the communication setup, each side sends its receiver window size to the far end.  After that, each successive acknowledgment has the available size of the receiver sliding window.  If the receiver is slower, the receiver window keeps reducing and the sender reduces the sender window too.

It looks the sender will always send bytes equal to the sender’s sliding window. But not so, as the application may be delivering a lesser number of bytes. These bytes should be delivered immediately to the network.

Types of Sliding window protocols:

Above the just the name of protocols. The Stop and Wait we have described at the beginning.  We will publish another tutorial for each sliding window protocol.