You are on page 1of 3

Flow Control

Flow Control is one important design issue for the Data Link Layer that controls the flow of data between sender and
receiver.
In Communication, there is communication medium between sender and receiver. When Sender sends data to receiver
than there can be problem in below case :
1) Sender sends data at higher rate and receive is too sluggish to support that data rate.
To solve the above problem, FLOW CONTROL is introduced in Data Link Layer. It also works on several higher layers.
The main concept of Flow Control is to introduce EFFICIENCY in Computer Networks.
Approaches of Flow Control

1. Feed back based Flow Control


2. Rate based Flow Control

Feed back based Flow Control is used in Data Link Layer and Rate based Flow Control is used in Network Layer.

Feed back based Flow Control


In Feed back based Flow Control, Until sender receives feedback from the receiver, it will not send next data.
Types of Feedback based Flow Control
A. Stop-and-Wait Protocol
B. Sliding Window Protocol

1. A One-Bit Sliding Window Protocol


2. A Protocol Using Go Back N
3. A Protocol Using Selective Repeat
A. A Simplex Stop-and-Wait Protocol
In this Protocol we have taken the following assumptions:

1. It provides unidirectional flow of data from sender to receiver.


2. The Communication channel is assumed to be error free.
In this Protocol the Sender simply sends data and waits for the acknowledgment from Receiver. That's why it is called
Stop-and-Wait Protocol.
This type is not so much efficient, but it is simplest way of Flow Control.
In this scheme we take Communication Channel error free, but if the Channel has some errors than receiver is not able to
get the correct data from sender so it will not possible for sender to send the next data (because it will not get
acknowledge from receiver). So it will end the communication, to solve this problem there are two new concepts were
introduced.

1. TIMER, if sender was not able to get acknowledgment in the particular time than, it sends the buffered data once
again to receiver. When sender starts to send the data, it starts timer.
2. SEQUENCE NUMBER, from this the sender sends the data with the specific sequence number so after receiving
the data, receiver sends the data with that sequence number, and here at sender side it also expect the
acknowledgment of the same sequence number.
This type of scheme is called Positive Acknowledgment with Retransmission (PAR).

B. Sliding Window Protocol


Problems Stop –wait protocol In the last protocols sender must wait for either positive acknowledgment from receiver or
for time out to send the next frame to receiver. So if the sender is ready to send the new data, it can not send. Sender is
dependent on the receiver. Previous protocols have only the flow of one sided, means only sender sends the data and
receiver just acknowledge it, so the twice bandwidth is used.
To solve the above problems the Sliding Window Protocol was introduce.
In this, the sender and receiver both use buffer, it’s of same size, so there is no necessary to wait for the sender to send the
second data, it can send one after one without wait of the receiver’s acknowledgment.
And it also solve the problem of uses of more bandwidth, because in this scheme both sender and receiver uses the
channel to send the data and receiver just send the acknowledge with the data which it want to send to sender, so there is
no special bandwidth is used for acknowledgment, so the bandwidth is saved, and this whole process is
called PIGGYBACKING.
Types of Sliding Window Protocol
i. A One-Bit Sliding Window Protocol
ii. A Protocol Using Go Back N
iii. A Protocol Using Selective Repeat

i. A One-Bit Sliding Window Protocol


This protocol has buffer size of one bit, so only possibility for sender and receiver to send and receive packet is only 0 and
1. This protocol includes Sequence, Acknowledge, and Packet number.It uses full duplex channel so there is two
possibilities:

1. Sender first start sending the data and receiver start sending data after it receive the data.
2. Receiver and sender both start sending packets simultaneously,
First case is simple and works perfectly, but there will be an error in the second one. That error can be like duplication of
the packet, without any transmission error.

ii. A Protocol Using Go Back N

The problem with pipelining is if sender sending 10 packets, but the problem occurs in 8th one than it is needed to resend
whole data. So the protocol called Go back N and Selective Repeat were introduced to solve this problem.In this protocol,
there are two possibility at the receiver’s end, it may be with large window size or it may be with window size one.
The window size at the receiver end may be large or only of one. In the case of window size is one at the receiver, as we
can see in the figure (a), if sender wants to send the packet from one to ten but suppose it has error in 2nd packet, so
sender will start from zero, one, two, etc. here we assume that sender has the time out interval with 8. So the time out will
occur after the 8 packets, up to that it will not wait for the acknowledgment. In this case at the receiver side the 2nd packet
come with error, and other up to 8 were discarded by receiver. So in this case the loss of data is more.
Whether in the other case with the large window size at receiver end as we can see in the figure (b) if the 2nd packet
comes with error than the receiver will accept the 3rd packet but it sends NAK of 2 to the sender and buffer the 3rd
packet. Receiver do the same thing in 4th and 5th packet. When the sender receiver the NAK of 2nd packet it immediately
send the 2nd packet to the receiver. After receiving the 2nd packet, receiver send the ACK of 5th one as saying that it
received up to 5 packet. So there is no need to resend 3rd , 4th and 5th packet again, they are buffered in the receiver side.
iii. A Protocol Using Selective Repeat
Protocol using Go back N is good when the errors are rare, but if the line is poor, it wastes a lot of bandwidth on
retransmitted frames. So to provide reliability, Selective repeat protocol was introduced. In this protocol sender starts it's
window size with 0 and grows to some predefined maximum number. Receiver's window size is fixed and equal to the
maximum number of sender's window size. The receiver has a buffer reserved for each sequence number within its fixed
window.
Whenever a frame arrives, its sequence number is checked by the function to see if it falls within the window, if so and if
it has not already been received, it is accepted and stored. This action is taken whether it is not expected by the network
layer.

Here the buffer size of sender and receiver is 7 and as we can see in the figure (a), the sender sends 7 frames to the
receiver and starts timer. When a receiver gets the frames, it sends the ACK back to the sender and it passes the frames to
the Network Layer. After doing this, receiver empties its buffer and increased sequence number and expects sequence
number 7,0,1,2,3,4,5. But if the ACK is lost, the sender will not receive the ACK. So when the timer expires, the sender
retransmits the original frames, 0 to 6 to the receiver. In this case the receiver accepts the frames 0 to 5 (which are
duplicated) and send it to the network layer. In this case protocol fails.
To solve the problem of duplication, the buffer size of sender and receiver should be (MAX SEQ + 1)/2 that is half of the
frames to be send. As we can see in fig(c ), the sender sends the frames from 0 to 3 as it's window size is 4. Receiver
accepts the frames and sends acknowledgment to the sender and passes the frames to the network layer and increases the
expected sequence number from 4 to 7. If the ACK is lost than sender will send 0 to 3 to receiver again but receiver is
expecting to 4 to 7, so it will not accept it. So this way the problem of duplication is solved.

You might also like