Sliding Window Protocol
Sliding Window Protocol
Sliding Window Protocol
The sliding window protocol is a method designed in the network model that
allows data exchange more efficiently and within the scope of clearly defined steps
in the channel.
In the sliding window protocol, some of the most important features that are
applied in a network model are as mentioned:
This protocol allows sharing multiple data frames from the sender before
receiving any acknowledgment from the receiver side.
The data frames shared in the channel are defined by the window size mentioned
in the network model, which defines the maximum number of frames that can be
transmitted at a time from the sender to the receiver side before expecting any
acknowledgment.
Each of the frames in the network model is assigned a sequence number to
increase the transmission efficiency.
The data frames shared from the sender to the receiver side are enclosed within a
virtual sliding window, which represents that these are awaiting acknowledgment
from the receiver side.
Next, you will understand the working of the sliding window protocol in a network
model.
Working of the Sliding Window Protocol
The working of the sliding window protocol can be divided into two steps sender
steps, and the receiver steps and also some important values are needed in a
network model for smooth transmission of the data frames are:
To begin with, the sender side will share data frames with the receiver side per
the window size assigned to the model.
The sliding window will appear on the frames transmitted over to the receiver
side.
Then the sender will wait for an acknowledgment from the receiver side for the
shared frames, as mentioned in figure1.
When the receiver transmits the acknowledgment of the first transmitted frame,
the sliding window will shift from the acknowledged frame.
Now, let’s move on to the steps involved on the receiver side.
Steps for the Receiver Side
On receiving the data frames from the sender side, the receiver will use the
frames in the network model.
After the receiver uses the frame, it will transmit the acknowledgement to the
sender side for that data frame.
Then, the receiver side will receive the next data frame from the sender side, as
mentioned in figure2.
This process continues until all the frames are transmitted from the sender side to
the receiver side, and the receiver side transmits the acknowledgment of all the
received frames.
Next, in this tutorial, you will look into the advantages and disadvantages caused
by applying the sliding window protocol in the network model.
AdvantagesIn this protocol, a sender can share multiple frames and then wait
for the acknowledgment.
This protocol has much better efficiency in comparison, with low time delay.
This protocol requires sorting for increased efficiency and applies full-duplex
transmission.
Disadvantages
In case the sender does not receive acknowledgement from the receiver side, the
network model becomes inefficient.
Loss and wastage of bandwidth due to sharing multiple frames simultaneously.
.Conclusion
In this ‘Sliding Window Protocol, you understood the working of the steps
involved in the transmission of data frames from the sender to the receiver side in
the network model, along with the effect of applying the method in the network
model.
Sliding Window Protocol
Sliding window protocols are data link layer protocols for reliable and sequential
delivery of data frames. The sliding window is also used in Transmission Control
Protocol.
In this protocol, multiple frames can be sent by a sender at a time before receiving
an acknowledgment from the receiver. The term sliding window refers to the
imaginary boxes to hold frames. Sliding window method is also known as
windowing.
Working Principle
In these protocols, the sender has a buffer called the sending window and the
receiver has buffer called the receiving window.
The size of the sending window determines the sequence number of the outbound
frames. If the sequence number of the frames is an n-bit field, then the range of
sequence numbers that can be assigned is 0 to 2 𝑛−1. Consequently, the size of the
sending window is 2𝑛−1. Thus in order to accommodate a sending window size of
2𝑛−1, a n-bit sequence number is chosen.
The sequence numbers are numbered as modulo-n. For example, if the sending
window size is 4, then the sequence numbers will be 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, and
so on. The number of bits in the sequence number is 2 to generate the binary
sequence 00, 01, 10, 11.
The size of the receiving window is the maximum number of frames that the
receiver can accept at a time. It determines the maximum number of frames that
the sender can send before receiving acknowledgment.
Example
Suppose that we have sender window and receiver window each of size 4. So the
sequence numbering of both the windows will be 0,1,2,3,0,1,2 and so on. The
following diagram shows the positions of the windows after sending the frames
and receiving acknowledgments.
Types of Sliding Window Protocols
The Sliding Window ARQ (Automatic Repeat reQuest) protocols are of two categories −
Go – Back – N ARQ
Go – Back – N ARQ provides for sending multiple frames before receiving
the acknowledgment for the first frame. It uses the concept of sliding
window, and so is also called sliding window protocol. The frames are
sequentially numbered and a finite number of frames are sent. If the
acknowledgment of a frame is not received within the time period, all frames
starting from that frame are retransmitted.
Selective Repeat ARQ
This protocol also provides for sending multiple frames before receiving the
acknowledgment for the first frame. However, here only the erroneous or
lost frames are retransmitted, while the good frames are received and
buffered.
Here, the sender can send multiple frames without having to wait for
acknowledgments.
If no new data frames are ready for transmission in a specified time, a
separate acknowledgment frame is generated to avoid time-out.
Each outbound frame contains a sequence number ranging from 0 to 2 𝑛−1(𝑛
bit field). For stop-and-wait sliding window protocol, 𝑛 = 1.
Sender Window
The sender can transmit a maximum number of frames before receiving any
acknowledgment without blocking (Pipelining).
All the frames in a sending window can be lost or damaged and hence must
be saved in memory or buffer till they are acknowledged.
Receiving Window
In SRP, the sender's window size starts at 0 and it grows to some predefined
maximum.
The receiver's window is always fixed in size and equal to the predetermined
maximum.
The receiver has the buffer reserved for each sequence number within its
fixed window.
The sender and the receiver maintain a buffer of their window size.
If there is an error, the receiver checks the lower edge to the last sequence
number before the lost frame sequence number.
The receiver continues to receive and acknowledge incoming frames.
The sender maintains a timeout clock for the unacknowledged frame number
and retransmits that frame after the timeout.
The acknowledgment will be piggybacked to the sender. But when there is
no traffic in the reverse direction, piggyback is impossible, a special timer
will time out for the ACK so that the ACK is sent back as an independent
packet. If the receiver suspects that the transmission has an error, it
immediately sends back a negative acknowledgment (NAK) to the sender.
Note − SRP works better when the link is very unreliable. Because in this case,
retransmission tends to happen more frequently, selectively retransmitting frames
is more efficient than retransmitting all of them. In selective repeat protocol, the
size of the sender and receiver windows must be at most one-half of 2𝑛.
Difference Between Go-Back-N and Selective
Repeat Protocol
Go-Back-N is a data link layer protocol that uses a sliding window method for
reliable and sequential delivery of data frames. It is a case of sliding window
protocol having to send window size of N and receiving window size of 1.
Selective Repeat Protocol is also a data link layer protocol that uses sliding
window method for reliable delivery of data frames. Here, only the erroneous or
lost frames are retransmitted, while the good frames are received and buffered.
Read through this article to find out how these two data link layer protocols work
and what are the major differences between them.
The sender sends several frames determined by a window size even if the
receiver does not respond with an acknowledgment (ACK) packet.
A transmit window size of N, and a receive window size of 1 is a particular
case of the basic sliding window protocol. It can send N frames to the peer
before requesting an acknowledgment.
It works on the notion of protocol pipelining, which allows numerous frames
to be delivered before the first frame is acknowledged.
The shelves in Go-Back-N ARQ are numbered consecutively because Go-
Back-N ARQ provides multiple brackets at once, necessitating a numbering
strategy to identify one frame from another. These numbers are referred to as
sequential numbers.
The maximum number of frames that can be sent at once is entirely
dependent on the sender's window size. All structures in the current window
will be retransmitted if a frame's acknowledgment is not received within the
agreed-upon time frame.
What is Selective Repeat Protocol?
The following table highlights the major differences between the Go-Back-N and
the Selective Repeat protocols −
In Go-Back- In Selective
N, if a sent Repeat, only
frame is the
found suspected or
suspected or damaged
Definition damaged, frames are
then all the retransmitte
frames are d.
retransmitte
d till the last
packet.
Receiver Receiver
Receiver
Window Size Window Size
Window Size
is 1. is N.
Go-Back-N In Selective
is easier to Repeat,
implement. receiver
Complexity window
needs to
sort the
frames.
Efficiency of Efficiency of
Go-Back-N Selective
= N / (1 + Repeat =
2a), where N / (1 +
"a" is ratio 2a).
of
propagation
Efficiency
delay vs.
transmission
delay and
"N" is the
number of
packets
sent.
cumulative. is individual.
Out-of- Out-of-
Order Order
packets are packets are
rejected, accepted in
Out-of-order
and the the selective
Packets
entire Repeat
window is protocol.
re-
transmitted.
The The
Minimum Minimum
Sequence Sequence
Number in Number in
the Go- the
Minimum Back-N Selective
Sequence protocol is Repeat
Number N+1, where protocol is
"N" is the 2N, where
number of "N" is the
packets number of
sent. packets
transmitted.
Conclusion