Open In App

Stop and Wait protocol, its problems and solutions

Last Updated : 08 Jun, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

It is the simplest flow control method in which the sender will send the packet and then wait for the acknowledgement by the receiver that it has received the packet then it will send the next packet. 

Stop and wait protocol is very easy to implement. 

 

Total time taken to send is, 
 

Ttotal = Tt(data) + Tp + Tq + Tprocess + Tt(ack) + Tp     

( since, Tq and Tprocess = 0)

Ttotal = Tt(data) + 2Tp + Tt(ack)
Ttotal = Tt(data) + 2Tp   

(when Tt(ack) is negligible) 

 

Efficiency 
= useful time / total cycle time 
= Tt / (Tt+2Tp)
= 1 / (1+2a)    [a = Tp/Tt] 

Note: Stop and wait is better for less distance. Hence it is a good protocol for LAN. Stop and wait is favorable for bigger packets. 

What if the data packet is lost in between ? 

 

 

  1. According to sender, receiver is busy but actually data is lost.
  2. Receiver will assume, no packet has been sent by sender.
  3. Both will be waiting for each other and there will be a deadlock.

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

What if the data packet has been lost ? 
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 packet again but according to receiver it is a new data packet, hence it will give rise to duplicate packet problem. 

To eliminate duplicate packet problem sequence number is added to the data packet. So using packet numbers it can easily determine the duplicate packets. 

What if there is a delay in receiving acknowledgement ? 

 

According to sender, the acknowledgement of packet 1 is delayed and packet 2 has been lost. But the receiver assumes that the acknowledgement that has been received was of packet 2. This problem is called missing packet problem. 
Missing packet problem can be solved if acknowledgements also have numbers.
 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads