Flow Control in Data Link Layer


Flow Control

Data Link layer provides a functionality to control the flow of the data  between two nodes is called Flow Control. Flow control in the data link layer is a technique that allows two stations working at different speeds to communicate with each other. 

If the sender is on a fast and powerful computer as compared to the receiver then the receiver may get overwhelmed by the frames transmitted by the sender.In such a scenario even if there is no error in the transmission of the frame the receiver may lose some of the frames as it is unable to process the frame with the speed at which the sender is transmitting the frame.

In the data link layer, flow control restricts the number of frames that sender can send before it waits for an acknowledgement from the receiver.

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.

If there is no flow control mechanism present then after some time the data buffer at the receiver end may get full and overflow as the data link at the receiver may be busy in processing the old received data. In this process, the receiver may lose some frames or data transmitted from the sender. To fix this problem there are two approaches to flow control.

1. Feedback-based Flow Control

2. Rate-based Flow Control



1. Feedback-based Flow Control 

In these protocol, the sender sends frames after it has received acknowledgement for the previous sent frame from the receiver. This is used in Data Link Layer.

2. Rate-based Flow Control 

These protocols have built in mechanisms to restrict the rate of transmission of the data without requiring acknowledgement from the receiver. This is used in the Network Layer and Transport Layer.

Flow Control techniques in Data Link Layer

Data link layer uses feedback based flow control mechanisms. There are basically two types of techniques to control the flow of data:-


Stop and Wait Flow Control

This method is  easiest and simple form of flow control.In this method the following transitions are involved −

  • The sender sends a frame and stop transmitting until the acknowledgement of the sent data-frame is received.

  • Once the receiver receives the frame, it sends an acknowledgement back to the sender.

  • On receiving the acknowledgement, the sender understands that the receiver is ready to accept the next frame. So it send another frame after receiving the  acknowledgement from the receiver.

Advantages –

  • This method is very easy and simple and very accurate.
  • Each of the frames is checked and acknowledged well.
  • It can also be used for noisy channels.

  • Disadvantages –

  • This method is very slow in compare to other techniques.
  • In this method, only one frame can be sent at once.
  • It is very inefficient and makes the transmission process very slow.
Case 1 : Data frame is lost during transmission between sender to receiver.

  • Sender will think that receiver is busy to accept the fame but actually data is lost.
  • Receiver will assume no packet has been sent by the sender.
  • Both will be waiting for each other(sender waits for the acknowledgement and the receiver waits for the data frame) and there will be a deadlock.

Solution : A timer is applied between sender and the receiver and the receiver will wait till timeout timer for the data after that it will confirm that data has been lost.

  • Case 2 :  Acknowledgement lost during transmission between receiver to sender.

After timeout timer expires, sender will assume that the data is lost but actually the acknowledgement is lost. By assuming this it will send the data frame again to the receiver receiver will think that, it is a new frame, hence it will send acknowledgement again so that will be have duplicate data packet.

Solution : To remove duplicate data packet problem a method is introduced that is called "sequence number". which are added to the every data frame. so using frame numbers receiver can easily determine the duplicates frames.

Sliding Window Flow Control

The sliding window protocol is  a technique to send the multiple frames at once. In this protocol sender and the receiver both are agree upon the total number of data frames after which acknowledgement is needed to be transmitted. In this method the sender can send various data frames without getting an acknowledgement.

In this method we use sequence numbers for each data frame to avoid duplicate frame received at the receiver side. Each frame has sent according to there sequence number.

This increases and improves network throughput. Sliding window method also known as Windowing.

Sliding window protocol has two types :

1. Go-Back-N ARQ(Automatic Repeat Request)

2.Selective Repeat ARQ

1. Go-Back-N Protocol

It is the type of sliding window protocol means here sender can sent multiple frames at once. In this protocol N is the size of the sender window and the receiver window size is always 1. For example, Go-Back-8, the size of sender window will be 8

Sender can send multiple frames at once but the receiver can receive only one frame at once because the frame size of receiver is only 1..There is no acceptance of out of order frames.Frames are only accept in order.

In this method a receiver does not receive a corrupted frame if receiver has a frame which is corrupted then it cancels to receive it  and when the timer expires, the sender sends the correct frame again. 

In this method we use cumulative acknowledgement. means receiver send the acknowledgement for the next expected frames means if receiver has received frame 1, frame 2 and frame 3 then it will send acknowledgement 4 for next expected frame.

In this method the retransmission is very high because the receiver can only receive one frame at once while the sender can send multiple frames at once so if any one of the frame is lost during transmission then receiver waits for that frame and do not receive any other frame before that frame. If the acknowledgment of a frame is not received within the time period, then sender has to be send all frames from starting.

2. Selective Repeat Protocol

Selective Repeat Protocol is also a type of sliding window protocol in which we can transmit the multiple number of frames at once.In this protocol, the size of the sender window is always same to the receiver window size.means the receiver also can receive multiple frames at once without sending a acknowledgement. It can accept out of order frames also.

If the receiver has a corrupt frame, it does not directly cancels it. It sends a negative acknowledgment to the sender. The sender sends that frame again as soon as on the receiving negative acknowledgment. There is no waiting for any time-out to send that frame. 

The retransmission is very low in this method.It is more complex to implement because it uses searching and sorting techniques.

Advantages:

  • Retransmission is very low compare to Go-Back-N protocol.

Disadvantages:

  • More complexity of sender and receiver.
  • Each frame must be acknowledge individually because there is no cumulative acknowledgements.
  • Receive may receive frames out of sequence.





No comments:

Post a Comment