Flow Control
One important aspect of data link layer is flow control. Flow control refers to a set of procedures used to restrict the amount of data the sender can send before waiting for acknowledgement.
Stop and Wait
In this method, the sender waits for an acknowledgement after every frame
it sends. Only when a acknowledgment has been received is the next frame
sent. This process continues until the sender transmits an End of Transmission (EOT) frame.
- We can have two ways to manage data transmission, when a fast sender
wants to transmit data to a low speed receiver.
- The receiver sends information back to sender giving it permission to
send more data i.e., feedback or acknowledgment based flow control.
- Limit the rate at which senders may transmit data without using feedback
from receiver i.e., Rate based-flow control.
Advantages of Stop and Wait
It’s simple and each frame is checked and acknowledged well, Disadvantages of Stop and Wait
- It is inefficient, if the distance between devices is long.
- The time spent for waiting ACKs between each frame can add significant amount to the total transmission time.
Sliding Window
In this method, the sender can transmit several frames before needing an acknowledgement. The sliding window refers imaginary boxes at both the sender and the receiver. This window can hold frames at either end and provides the upper limit on the number of frames that can be transmitted before requiring an acknowledgement.
Key Points…………………………………………………………………………………………………
- The frames in the window are numbered modulo-n, which means they are numbered 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, 5, 6, 7, 0,1.. _ so on. The size of the window is (n -1) in this case size of window = 7.
- In other words, the window can’t cover the whole module (8 frames) it covers one frame less that is 7.
When the receiver sends an ACK, it includes the number of next frame it expect to receive. When the receiver sends an ACK containing the number 5 , it means all frames upto number 4 have been received.
Key Points
- As each ACK is sent out , the receiving window expands to include as many acknowledged frames. The window expands to new placeholders as newly acknowledged frame. The winow expands to include.
- A number of new frame spaces = The number of most recently acknowledged frame – The number of previously acknowledged frame e.g., In a seven frame window.
- if the prior ACK was for frame 2 and the current ACK is for frame The window expands by three (5 — 2). If the prior ACK was for frame 3 and the
current ACK is for frame 1, the window expands by six (1 + 8 — 3).