![]() ![]() ![]() |
||||||||
|
Sliding Window |
||||||||
|
In stop and wait control mechanism, one frame send and wait for
acknowledgement then only can send the next frames. This is not
efficient for transmit a large amount of data. Sliding window control
mechanism is to enhance effectiveness of data transmission because
several frames can be transmitted at a time before needing an acknowledgement.
As its name suggest, sliding window use a
window to hold frames and
provide a upper limit on the number of frames that can be transmitted
before requiring an acknowledgement. The
window is
actually an extra buffer created by both sender and receiver. To
keep track of which frames have been transmitted and which received,
sliding window introduces an identification scheme based on the
size of the window. The frames are numbered modulo-n, which means
they are number from 0 to n
-1. For example, if n=8, the frames are numbered 0,1,2,3,4,5,6,7,0,1,2,3,4,……The
size of the window is n-1 (in this case, 7). This mean the window
cannot cover the whole module (8 frames); it covers one frame less.
This is to avoid ambiguity in the acknowledgement of the received
frames.
At both sender and receiver side, there will be one window
to keep track of which frames have been transmitted and which received.
At sender side, as one frame is sent out, the left boundary of the
window moves inward and the size of the window reduce by one. After
acknowledgement arrived, then the window expand to allow in a number
of new frames equal to the number of frames acknowledged by that
acknowledgement. For example, given a window size is 7. If frame
0 to 4 is sent without acknowledgement received, then the window
left only 2 frames (numbered 5 and 6). If an acknowledgement numbered
3 is arrived, then 3 frames are known to have transmitted undamaged
and the sender window expand to include next 3 frames in its buffer.
At this time, the sender window contains 5 frames (numbered 5, 6,
7, 0 and 1). Conceptually, the sliding window of the sender shrinks
from the left when frames of data are sent and expand to the right
when acknowledgements are received.
At the receiver side, the window does not represent the number
of frames received but the number of frames that may be received
before an acknowledgement must send. When n frames received without returning an acknowledgement, then the size
of receiver window reduce by n.
And before the size of the window becomes zero, an acknowledgement
must send as to continue receive incoming frames. And the acknowledgement
sent is numbered by the next frames number expected to be received.
For example, given the size of window are 7. If 3 frames are received,
then the window size reduces by 3 frames (numbered 0, 1 and 2).
And an acknowledgement with numbered 3 (the next frame expected
to be received) is sent to sender. After the acknowledgement is
sent, then the window size expands to 3 frames. Conceptually, the
window of receiver shrinks from left when frames of data are received
and expand to the right when acknowledgement is sent. |
||||||||