4. Sliding Window Protocol
• Sliding window algorithms are a method of flow
control for network data transfers.
• Data Link Layer uses a sliding window algorithm,
which allows a sender to have more than one
unacknowledged packet "in flight" at a time,
which improves network throughput.
5. Key concepts of the Sliding
Window
• Both the sender and receiver maintain a finite size buffer to hold
outgoing and incoming packets from the other side.
• Every packet sent by the sender, must be acknowledged by the
receiver. The sender maintains a timer for every packet sent, and
any packet unacknowledged in a certain time, is resent.
• The sender may send a whole window of packets before
receiving an acknowledgement for the first packet in the window.
This results in higher transfer rates, as the sender may send
multiple packets without waiting for each packet's
acknowledgement.
• The Receiver advertises a window size that tells the sender how
much data it can receive, in order for the sender not to fill up the
receivers buffers.
• Efficiency can also be improved by making use of the full-duplex
line
A B
7. Piggybacking
• when a data frame arrives, instead of immediately
sending a separate control frame, the receiver restrains
itself and waits until the network layer passes it to the next
packet.
• The acknowledgement is attached to the outgoing data
frame (using the ack field in the frame header).
• The acknowledgement gets a free ride on the next
outgoing data frame.
• The technique of temporarily delaying outgoing
acknowledgements so they can be hooked onto the next
out going data frame is piggybacking
8. Sender Side
• To keep track of the frames, sender station sends sequentially
numbered frames.
• Since the sequence number to be used occupies a field in the
frame, it should be limited size.
• If the header of the frame allows k bits, the sequence numbers
range from 0 to 2k
– 1.
• Sender maintains a list of sequence numbers that it is allowed to
send(sender window).
• The size of the senders window is at most 2k
– 1.
– Eg:- if frame allows 3 bits, then the size of the window is
23
-1=7
• The sender is provided with a buffer equal to the window size.
0 1 2 3 4 5 6
9. Receiver Side
• Receiver always maintains window size as 1.
• The receiver acknowledges a frame by sending an ACK frame
that includes the sequence number of the next frame expected.
• This also explicitly announces that it is prepared to receive the
next N frames, beginning with the number specified.
• This scheme can be used to acknowledge multiple frames.
• It could receive frames 2,3,4 but withhold ACK until frame 4 has
arrived. By returning an ACK with sequence number 5, it
acknowledges frames 2, 3, 4 at one time.
• The receiver needs a buffer of size 1.
10. One bit Sliding Window
• Here K=1 at the senders side.
• Then the size of the senders window is,
2k
– 1
K=1
21
-1=2-1=1
• This is same as the stop and wait protocol.
11. -A sliding window of size 1, with a 3-bit sequence number-
(a) Initially.
(b) After the first frame has been sent.
(c) After the first frame has been received.
(d) After the first acknowledgement has been received.
12. One bit Sliding Window protocol
• The notation is (seq, ack, packet number).
Part (a): If B waits for A’s first frame before sending one of its own. Each frame
arrival brings a new packet for the network layer; there are no duplicates.
Part (b): If A and B simultaneously initiate communication, their first frames
cross, and the data link layers gets into a situation. Half of the frames contain
duplicates, even though there are no transmission errors
13. Merits
• Multiple packets can be transmit without waiting for
acknowledgements.(not like stop & wait)
• Piggibacking (using full-duplex lines)
Demerits
• No limit of the size or sequence numbers that can be
required in this protocol.
• The bandwidth may be wasted in some special situations.