+91 9404 340 614    gyaanibuddy@gmail.com

Like
0 Likes

Stop and Wait protocol

Last updated on July 20, 2022, 11:32 a.m. by mohit

In this article, we will discuss the stop and wait flow control protocol and the working of this protocol. We will also illustrate the primitives of the stop and wait protocol.

Stop and Wait protocol

Overview

To maintain the rate of data transmission between sender and receiver, it is required to use flow control protocol. The data link layer provides us with the protocol for controlling the data transmission rate. So here we are going to discuss one of the flow control protocols named stop and wait protocol. The stop and wait protocol is a simple protocol that allows the sender to send the next packet when the acknowledgment of the previous packet is received from the receiver.

Scope

  • In this article, we will discuss the stop and wait flow control protocol and the working of this protocol.
  • We will also illustrate the primitives of the stop and wait protocol.
  • And we will see what the advantages and disadvantages provided by this protocol are.

What is the stop and wait protocol?

  • While transmitting data from sender to receiver, the flow of data is required to be controlled.
  • It uses a link between sender and receiver as a half-duplex link.
  • Suppose there is a situation where the sender is sending the data at a rate higher than the rate of the receiver to process and receive the data. Flow Control protocol ensures that the data does not get lost.
  • The flow control protocols ensure that the sender sends the data only at a rate that the receiver can receive and process it.
  • This is a flow control protocol that works in a noiseless channel.
  • Noiseless channel is an idealistic channel in which no data frames are lost, corrupted, or duplicated.
  • After sending the data, the sender will stop and waits until he receives an acknowledgment from the receiver.
  • Flow control service is provided by the data link layer of the OSI suite.
  •  

Note: In the stop and wait protocol, the sender will send the data and wait for an acknowledgment from the receiver.

Primitives of Stop and Wait Protocol

Sender side

Rule 1: Sender will send one packet at a time Rule 2: Sender will send the next packet to the receiver only when it receives the acknowledgment of the previous packet from the receiver. So, in the stop and wait protocol, the sender-side process is very simple.

Note: The sender sends one packet at a time and does not send the next packet until it receives an acknowledgment of the previous packet from the receiver.

Receiver side

Rule 1: The receiver receives the data packet and then consumes the data packet. Rule 2: The receiver sends acknowledgment when the data packet is consumed. So, in this protocol, the receiver side process is also very simple.

Working of Stop and Wait protocol

  • If there is a communication between sender and receiver, then the sender sends the packet to the receiver, and the packet is called a data packet.
  • The sender will not send the second packet to the receiver until acknowledgment of the first packet is received.
  • The receiver will send the acknowledgment for the packet that the receiver has received.
  • When the sender receives the acknowledgment, it sends the next packet to the receiver.
  • This process of sending data and receiving acknowledgment continues until all the packets are not sent.
  • The main benefit of stop and wait protocol is its simplicity
  • But this protocol has some disadvantages, too; for example, if the sender wants to send 10,000 data packets, and the sender can not send all 10,000 packets at a time in this protocol, one packet is allowed to send at a time.

Refer to the below image to see the working of data transmission in the stop and wait protocol

https://media.geeksforgeeks.org/wp-content/uploads/Stop-and-Wait-ARQ.png

Advantages of Stop and Wait protocol

  • This protocol provides flow control.
  • One of the main advantages of the stop and wait protocol is its simplicity.
  • Stop and wait protocol is useful in LAN as its efficiency decrease with the increasing distance between sender and receiver.
  • If we increase the data packet size, the efficiency is going to increase. Hence, it is suitable for transmitting big data packets.
  • Stop & wait protocol is accurate as the sender sends the next frame to the receiver only when the acknowledgment of the previous packet is received. So there is less chance of the frame being lost.

Disadvantages of Stop and Wait protocol

Problems occur due to lost data

Suppose the sender sends the data packet, but the data packet is lost due to some reason. Since the receiver has not received the packet for a long time, so the sender does not receive any acknowledgment from the receiver, so it will not send the next packet.

In this case, two problems occur in data transmission: * For an acknowledgment, the sender has to wait for an infinite amount of time. * The receiver will also have to wait for an infinite amount of time to receive the data.

Refer to the below image to see data loss in the stop and wait protocol

https://static.javatpoint.com/tutorial/computer-network/images/stop-and-wait-protocol2.png

Problems occur due to lost acknowledgment

Suppose the sender sends the packet, and the receiver will send an acknowledgment. But the acknowledgment sent by the receiver will be lost in the network, therefore sender will not send the next packet as the acknowledgment is not received In this case, one problem occurs in data transmission: * The sender has to wait for an infinite amount of time due to acknowledgment loss in the network.

Refer to the below image to see acknowledgment loss in the stop and wait protocol

https://static.javatpoint.com/tutorial/computer-network/images/stop-and-wait-protocol3.png

Problem due to the delay in data or acknowledgment

Suppose the sender sends the data packet, and the receiver will also send the acknowledgment, but the acknowledgment is received by the sender after the timeout period. So sender will not consider this acknowledgement as there may be situation that sender will retransmit packet after time out.

Refer to the below image to see delayed data and acknowledgment in the stop and wait protocol

https://static.javatpoint.com/tutorial/computer-network/images/stop-and-wait-protocol4.png

Conclusion

  • Stop and wait protocol is the simple and reliable protocol for flow control.
  • Stop and wait protocol is a data link layer protocol.
  • In this protocol, the sender will not send the next packet to the receiver until the acknowledgment of the previous packet is received.
  • One of the disadvantage of stop and wait protocol is that its efficiency is low.
...

by mohit
Shri Ramdeobaba College of Engineering and Management Nagpur

I am a final year computer science student at RCOEM, Nagpur. I am MERN stack developer. I enjoy building community and doing something meaningful for the community. Also part of GDG cloud, Nagpur.
blog comments powered by Disqus