Written By:
Shashwat45
6 minute read
Computer NetworkFlow Control Protocols

Flow Control - STOP & WAIT and STOP & WAIT ARQ Protocol

Posted in Internet Security   LAST UPDATED: DECEMBER 26, 2019

Flow control in computer networks is defined as the process of managing the rate of data transmission between two systems(nodes), this mechanism ensures that the rate of data (transmitted by the sender) is within the receiving capacity of the receiver node.

flow control protocols - Stop & wait and Stop & Wait ARQ

In the above diagram, we can see that there are two protocols, Stop & Wait and a sliding window. The basic difference between them is that, in stop & wait the sender node sends one frame and then waits for the feedback from the receiver node. On the other hand, in the sliding window protocol, the sender node keeps on sending frames to the receiver node without waiting for any feedback and it re-sends the frame which is/are damaged or suspected.

Talking about the efficiency, the efficiency of stop &wait protocol is less, while the efficiency of the sliding window protocol is more than stop & wait protocol. And, in stop & wait protocol sorting is not necessary, but in sliding window protocol, sorting may be or may not be necessary. The stop & wait protocol is half-duplex whereas sliding window protocol is full-duplex.




Stop & Wait Protocol

  1. The sender node sends a data packet to the receiver node.

  2. Then, waits for the feedback of the transmitted packet.

  3. As soon as the receiver node receives a data packet it starts processing it.

  4. Then, the receiver node sends the feedback to the sender node (about the received data packet).

  5. After receiving the feedback, if the feedback is positive then the sender node sends the next data packet otherwise resends the damaged packet.

Stop & Wait protocol for flow control in computer network

Stop & Wait Protocol performs better for LANs than WANs because the efficiency of the protocol is inversely proportional to the distance between the sender & receiver node and as we all know that the distance is less in LANs as compared to WANs.

But this protocol has some issues, one such issue is the probability of occurrence of deadlock, which is very high due to loss in a data packet or loss in feedback which can lead to infinite waiting, where the sender will keep on sending the data packet if the feedback is lost.




Stop & Wait ARQ

Stop & Wait ARQ is a sliding window protocol for flow control and it overcomes the limitations of Stop & Wait, we can say that it is the improved or modified version of Stop & Wait protocol.

Stop & Wait ARQ assumes that the communication channel is noisy (previously Stop & Wait assumed that the communication channel is not noisy). Stop & Wait ARQ also assumes that errors may occur in the data while transmission.


Working of Stop & Wait ARQ

Working of Stop & Wait ARQ is almost like Stop & Wait protocol, the only difference is that it includes some additional components, which are:

  1. Time out timer

  2. Sequence numbers for data packets

  3. Sequence numbers for feedbacks

Note: If any sliding window protocol must work properly then, the available sequence numbers must be greater than or equal to the sum of sender window size and receiver window size.

[available sequence numbers >= sender window size + receiver window size]

Stop & Wait ARQ is a 1-bit sliding window protocol where the size of the sender window as well as the receiver window is 1. Thus, in Stop & Wait ARQ technique, the minimum number of sequence numbers required is equal to the sum of sender window size & receiver window size

[minimum number of sequence numbers required = sender window size + receiver window size]

Thus, the minimum number of sequence numbers required in Stop & Wait ARQ is 2, which are 0 and 1.




Stop & Wait ARQ overcoming the problem of a lost data packet

For solving this problem, we use time out timer, after transmitting the data packet to the receiver through the communication channel, the sender starts the time out timer. Now if the data packet's feedback is received by the sender before the timer expires, then the sender stops the timer and transmits the next data packet.

And if the time out timer expires and the feedback is not received by the sender then, the sender retransmits the data packet. This prevents the occurrence of deadlock in the network.

An illustration of the process is shown in the image below.

Stop & Wait ARQ protocol for flow control in computer network




The problem of lost Feedback

The problem of delayed/lost feedback(which used to happen in Stop & Wait protocol) is solved by putting sequence numbers on data packets.

Assume that the feedback given by the receiver is lost, then the sender resends the same data packet after its timer expires. This prevents the occurrence of deadlock. The sequence number on the data packets helps the receiver to identify the duplicate data packet, then the receiver discards the duplicate data packet & resends the same feedback.

We can see the process in the image below

non deadlock in Stop & Wait ARQ flow control protocol

Now in the case of feedback delay, we can see in the image below

Stop & Wait handling the feedback delay from receiver




The problem of a damaged data packet

Whenever a data packet is damaged/corrupted, the receiver then sends negative feedback to the sender and then it resends the same data packet.




Limitations

The Stop & Wait ARQ is very less efficient because the sender window size is 1, which allows the sender to keep only one frame without feedback. So, the sender sends a data packet and waits for the feedback, and it gets the feedback it sends another data packet.




Improving Efficiency

In order to improve efficiency, we can increase the window size on both ends.


IF YOU LIKE IT, THEN SHARE IT

RELATED POSTS