Sliding Window Protocol

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

What Is 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:

 Sender and the receiver side


 Window Size
 The total data frames to be transmitted
 Proper sequencing of the frames
Steps for the Sender Side

 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.

Advantages and Disadvantages of Sliding Window Protocol

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.

Sliding Window Protocol (Selective Repeat)


The sliding window protocol is a flow control protocol that allows both link nodes
A and B to send and receive data and acknowledgments simultaneously.

 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

Sender Window is a set of sequence numbers maintained by the sender


corresponding to the frame sequence numbers of frames sent out but not yet
acknowledged.

 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

A Receiving Window is a set of sequence numbers that is maintained by the


receiver. It allows receiving and acknowledging of multiple frames.

 The size of the receiving window is fixed at a specified initial size.


 Any frame received with a sequence number outside the receiving window is
discarded.
 The sending and receiving window may not have the same size or any upper
or lower limits.
Selective Repeat Protocol

The selective repeat protocol is an implementation of the sliding window protocol.


In the selective repeat protocol, both the sender and the receiver maintain a
window of outstanding and acceptable sequence numbers.

 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.

What is Go-Back-N Protocol?

The Go-Back-N ARQ protocol is a variant of the Automatic Repeat Request


(ARQ) protocol.

 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?

Selective Repeat is a variant of the Automated Repeat Request (ARQ) protocol


used in reliable communications to handle sequence numbers and retransmissions.

 Particular repetition allows the transmitter to deliver a set number of frames


without waiting for individual ACK from the recipient, as in Go-Back-N
ARQ.
 It employs two equal-sized windows: a sending window for storing frames to
be sent and a receiving window for storing frames received by the receiver.
The size is half of the frame's maximum sequence number. For example, if
the sequence number is from 0–15, the window size will be 8.
 Even if it does not receive acknowledgment for any frame in the interim, the
Selective Repeat protocol allows it to send several frames based on the
availability of structures in the sending window.
 The size of the transmitting window determines the maximum number of
frames that can be sent.
Difference between Go-Back-N and Selective Repeat Protocol

The following table highlights the major differences between the Go-Back-N and
the Selective Repeat protocols −

Key Go-Back-N Selective


Repeat

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.

Sender Sender Sender


Key Go-Back-N Selective
Repeat

Window is of Window size


Window Size size N. is same as
N.

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.

Acknowledg Acknowledg Acknowledg


ement ement type ement type
is
Key Go-Back-N Selective
Repeat

cumulative. is individual.

Neither the To sort the


sender nor frames on
Sorting the recipient the receiver
requires side, sorting
sorting. is needed.

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

Go-Back-N consumes more bandwidth because it would retransmit an entire


window even if a single packet is lost. If the rate of error is high, then Go-Back-N
will consume a lot of bandwidth. Selective Repeat is a better option if you have to
be consider bandwidth requirement, as it would resend only the defective or
missing packets and not the entire windows.

Go-Back-N uses cumulative acknowledgements which can reduce the traffic;


however, there's always a risk of losing the cumulative acknowledgement. If it
happens so, then the acknowledgements of all the corresponding packets are lost.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy