Flow control is a technique that allows two stations working at different speeds to communicate with each other. It is a set of measures taken to regulate the amount of data that a sender sends so that a fast sender does not overwhelm a slow receiver. In data link layer, flow control restricts the number of frames the sender can send before it waits for an acknowledgment from the receiver.
Flow control can be broadly classified into two categories −
Feedback based Flow Control - In these protocols, the sender sends frames after it has received acknowledgments from the user. This is used in the data link layer.
Rate based Flow Control - These protocols have built in mechanisms to restrict the rate of transmission of data without requiring acknowledgment from the receiver. This is used in the network layer and the transport layer.
Data link layer uses feedback based flow control mechanisms. There are two main techniques −
This protocol involves the following transitions −
The sender sends a frame and waits for acknowledgment.
Once the receiver receives the frame, it sends an acknowledgment frame back to the sender.
On receiving the acknowledgment frame, the sender understands that the receiver is ready to accept the next frame. So it sender the next frame in queue.
This protocol improves the efficiency of stop and wait protocol by allowing multiple frames to be transmitted before receiving an acknowledgment.
The working principle of this protocol can be described as follows −
Both the sender and the receiver has finite sized buffers called windows. The sender and the receiver agrees upon the number of frames to be sent based upon the buffer size.
The sender sends multiple frames in a sequence, without waiting for acknowledgment. When its sending window is filled, it waits for acknowledgment. On receiving acknowledgment, it advances the window and transmits the next frames, according to the number of acknowledgments received.