Sie sind auf Seite 1von 4

Sliding Window Protocol

Describe briefly with the help of diagrams why the max window size in
sliding window Protocol is one less than the sequence number. For example,
if the sequence is: 0,1,2,3,4,5,6,7 the max window size is: 7

Introduction
Sliding window protocol also known as windowing is a data link layer protocol
used to control flow of frames between two nodes. It is used when reliability
in order to delivery of frames is required. It is used by most the connection
oriented network protocol like TCP. It is a full duplex protocol which uses Data
and Acknowledgement (The sequence number of last received frame that is
correct). Data is transmitted as frames where multiple frames can be sent
by a transmitter at a time before getting an acknowledgment. Multiple
frames sent by a transmitter are acknowledged by the receiver using a single
ACK frame.
The basic concept of sliding window protocol is that both Transmitter and
receiver maintain a window. The transmitter maintains the value of expected
acknowledgment and the receiver maintains the value of expected frame
that is received. When the transmitter gets an acknowledgment from the
receiver, the window is advances. On the other hand when the receiver
receives the expected frame, it advances the window.

Figure 1: Sliding window with window size 7

Why the window size is one less than the sequence


number?
In the sliding window protocol if we reserve m bit for sequencing, then the
window size is measured as 2m-1. As an example if we take 4 bit for
sequencing, the window size would be
2 4-1 = 15. Each outgoing frame

contain
a
sequence
number
that
ranges
from
0
to
15
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15). So there would be total 16 sequence
numbers but the window size is 15 which is one less than the sequence
number. We will now try to figure out why the window size is one less than
the sequence number.
Let us assume that we have reserve 3 bit for sequencing. So there would be
8 sequence number and the window size would be 7 which is one less than
the sequence number. Now we will first consider the window size is same as
the
sequence
number
and
observe
what
happened.

Figure 2: Window size is same as the sequence number.


In the above Figure 2, The first 4 frames 0,1,2 and 3 were already
transmitted and acknowledged. So the Transmitter will send the window of
frames 4,5,6,7,0,1,2 and 3. The window size is 8. Now if the receiver receives
all the frames correctly, it will send an acknowledgement Ack 4 for the next
window of frames starting with the frame number 4. But when the
transmitter will receive the Ack 4 it would become confused whether the
receiver is asking to resend the same window of frames starting with Frame
4 or it is looking for the next window of frames starting from frame number
4. Thus an error would be occurred in this situation.
To overcome this problem we will now reduce the window size one less than
the sequence number and observe what happened.

Figure 3: Window size is one Less than the sequence number


Now in Figure 3, the transmitter will send window of frames 4,5,6,7,0,1 and
2. The window size is 7. If all 7 frames successfully receives to the receiver it
will send and Acknowledgement Ack 3 requesting for the next window of
Frames starting with 3. The Transmitter will then send next 7 frames
sequentially starting from 3 to 1, i.e. 3,4,5,6,7,0,1. If the receiver again
receives all of those frames successfully, it will send an acknowledgement
Ack 2 to send next window of frames starting with 2. So we can clearly see
that the Acknowledgement numbers never matches with the first frame
number of the previous window of frames that has been transmitted and
thus there is no chance of duplication like the first case.

Conclusion

So from the above discussion we can conclude that the maximum window
size in sliding window Protocol should be one less than the sequence number
to avoid duplication of frames.

Das könnte Ihnen auch gefallen