Difference between Stop and Wait, GoBackN, and Selective Repeat

Flow Control In the Network

The handling of data flow between different nodes, such as computers, printers, and wireless devices, is referred to as flow control in the network. It is an essential mechanism for effectively transmitting data in the network. Data flow is a serious concern when transmitting data from one node to another. It is caused when the receiving node is unable to handle the data. The data transmitted is more than the receiving node can manage. This leads to data loss and re-transmission of the =data frames.

In order to prevent data loss and effectively transmit data in the network, flow control instructs the sending node about how much data should be retransmitted to the receiving node. The node transmitting the data should wait for an acknowledgment from the receiving node before sending additional data frames into the network.

The flow control protocols that determine the mechanism used to send acknowledgment and retransmit data are Stop and Wait, GoBackN, and Selective Repeat.

Stop And Wait Protocol

  • This is the most simple protocol that ensures guaranteed transmission of the data in the network.
  • Here the stop and wait refer to the two steps performed by the protocols. The sender node transmits the data into the network. The data frame is sent sequentially in one by one manner. Once a data frame is transmitted in the network. The sending node waits for the receiving node to send an acknowledgment in the network.
  • The stop and wait protocol is implemented as a flow control mechanism when the data link layer in the network provides the flow control services. This data link protocol enables the sender to transmit the data over noiseless channels.
  • This protocol supports unidirectional data transmission in the network. This means that there is only one sender or receiver in the network. Both nodes cannot simultaneously send or receive the data in the network. The nodes cannot utilize the resources of the network. The protocol ensures that the data flow is maintained in the network, but it lacks any error control mechanism to the network.
  • The primary concept behind implementing this protocol is that whenever the sender node transmits a data frame in the network, it waits for an acknowledgment from the receiver. Only when the acknowledgment is received it transmit to the other node in the network. The transmission is halted if the acknowledgment is received.
  • The idea behind using this frame is that when the sender sends the frame, he waits for the acknowledgment before sending the next frame.
  • Before discussing GoBackN and Selective Repeat protocols, the user must have prior knowledge of another important protocol: the sliding window protocol.

Sliding Window Protocol

The Sliding Window Protocol is a mechanism that allows the data-transmitting node to transmit multiple data frames simultaneously in the network. This protocol manages the data packets shared between two nodes where reliable and guaranteed data frame delivery is required. This protocol is implemented in the TCP (Transmission Control Protocol).

In this protocol, each data frame is assigned a sequence number. This protocol is implemented to ensure that the successfully transmitted data is not transmitted again by the sender node. This is useful as it increases the efficiency of the network and avoids duplicate data. The sequence number is unique for each data frame and used to confirm whether the receiving node successfully receives the data frame.

Two types of Sliding Window Protocols can be implemented in the network:

  • Go-Back-N ARQ
  • Selective Repeat ARQ

Go-Back-N ARQ

  • In Go-Back-N ARQ, N stands for the Window size of the sender node, and ARQ stands for Automatic Repeat Request. Let us consider an example to explain this protocol where the sender window size is 3. this means that the sender node can transmit three data frames before waiting for an acknowledgment from the receiving node.
  • The nodes use protocol pipelining that allows the nodes to transmit multiple data frames in the network simultaneously without waiting for the acknowledgment of the first frame. Suppose the sender needs to send 5 data frames in the network. If the protocol Go-Back-3 is implemented, the user can send frame 1, frame 2, and frame 3 simultaneously without waiting for the acknowledgment of frame 1.
  • Since multiple data frames are transmitted in this protocol, each data frame sent is numbered sequentially. This step is performed to ensure that each data frame can be differentiated. These numbers are referred to as sequential numbers.
  • The number of frames that can be sent simultaneously may differ with the sending node. The sender window size determines it. We can say that N data frames can be sent simultaneously in the network before the sender node receives the acknowledgment for the first frame sent to the receiver.
  • If the sender does not receive an acknowledgment from the receiver node within an agreed-upon time, then all the data frames transmitted and stored in the current window are retransmitted by the sender. Suppose the sender has transmitted frame 1, frame 2, and frame 3 and does not receive the acknowledgment for frame 1; then all three frames will be retransmitted.

Selective Repeat ARQ

  • Selective Repeat ARQ is also called the Selective Repeat Automatic Repeat Request. This protocol is implemented in the data link layer of the OSI model. This protocol implements a sliding window method to transmit the data frames in the network.
  • If there are limited mistakes during the data frame transmission, then the user can implement Go-Back-N ARQ, but if there are a lot of errors, then implementing Selective Repeat ARQ is the best option. It works well in a limited bandwidth.
  • The window size for both the sender and receiver nodes is kept equal. This is done by making the window size for the sender node equal to the receiver node window. The sliding window is always more than 1.
  • Suppose a corrupt frame is transmitted in the network. When this corrupt data frame reaches the receiver node, it is not directly rejected by the receiver; instead, the receiving node transmits a negative acknowledgment to the sender. Upon receiving the negative acknowledgment, the sender resends the data frame instantly. There is no waiting for any time out to transmit that data frame.

Difference Between Stop and Wait Protocol and Sliding Window Protocol

These two protocols act as a flow control mechanism and can be implemented in the network that ensures that the data is successfully transmitted from the sender node to receiving node since Go-Back-N and Selective Repeat protocols are sliding window protocols.

Let us discuss the difference between Stop and Wait Protocol and Sliding Window Protocol.

BASIS FOR COMPARISONSTOP-AND-WAIT PROTOCOLSLIDING WINDOW PROTOCOL
BehaviourRequest and replySimultaneous transmit
Number of data frames transferred simultaneouslyThe nodes cannot fully utilize the network capabilities as only one data frame is transferred at a time.Multiple frames can be transmitted together.
EfficiencyIt is less efficient when compared to sliding window protocols.Both Go-Back-N and selective repeat protocols are more efficient than the Stop and Wait Protocol. Selective Repeat protocol is the most efficient.
AcknowledgementThe sender node waits for acknowledgment from the receiving node after transmitting each data frame in the network.Both protocols can transmit multiple data frames in the network before waiting for an acknowledgment. They maintain a Window of Acknowledgement to determine the frames they can wait before getting acknowledged.
Type of transmissionIt uses half-duplex communication; that is, there can be only one sender and one receiver at a time. Both nodes cannot simultaneously transmit and receive the data.It uses full duplex transmission of communication. This allows bi-directional transmission in the network. Both nodes can transmit and receive data nodes simultaneously.
Propagation delayThe propagation delay is longer in the stop and wait protocol.It is comparatively less for sliding window protocol.
Link utilisationThe link utilization is less efficient.It is better at link utilization.

Difference Between Go-Back-N and Selective Repeat

The two sliding window protocol also differs in their function and working. The difference between Go-Back-N and Selective Repeat protocols are as follows:

BASIS FOR COMPARISONGO-BACK-NSELECTIVE REPEAT
BasicRetransmits all the frames that sent after the frame which suspects to be damaged or lost.Retransmits only those frames that are suspected to lost or damaged.
Bandwidth UtilizationIf the possibility of error in transmission is high or a lot of corrupt frames are transmitted, then this protocol wastes a lot of bandwidth.Since only the erroneous or corrupted data frames are retransmitted in the network. It saves network bandwidth and is more efficient than the Go-Back-N protocol.
ComplexityThe implementation of this protocol is simpler than selective repeat. It is less complex because of its less logical implementation.It is more complex than the Go-Back-N protocol as additional logic and sorting algorithm is applied at both the sender and receiver node. Moreover, it also requires additional storage to work efficiently.
Window sizeN-1<= (N+1)/2
SortingSorting of the data frames is not performed at either end of the transmission.The sorting of data frames is done at the receiving end. It is necessary to maintain the correct sequential order of the data frame to ensure the correct frame is requested.
StoringReceivers do not store the frames received after the damaged frame until the damaged frame is retransmitted.The receiver stores the frames received after the damaged frame in the buffer until the damaged frame is replaced.
SearchingIt does not perform a search as all the nodes in the current window are represented if the sender does not receive acknowledgment of a frame. Search is not performed at either end of transmission.The sender needs to perform a search operation as only the requested node is retransmitted in the network.
ACK NumbersNAK number represents the expected frame number of the next data frame in the network.NAK number represents the number of the data frame that is lost during transmission.
UseIt is more used because it is less complex and requires less storage.It is less implemented. It is used where the bandwidth is limited, and efficiency is important.

Difference between Stop and Wait, Go-Back-N, and Selective Repeat

The following table differentiates between all three flow control protocols that are Stop and Wait, Go-Back-N, and Selective Repeat protocols:

BASIS FOR COMPARISONSTOP AND WAIT PROTOCOLGO-BACK-N PROTOCOLSELECTIVE REPEAT PROTOCOL
Sender Window SizeThe sender window size is 1. This means that only 1 data frame can be transmitted at a time by the sender.The window size of the sender node is N in the Go-Back-N protocol.The Window size of the sender node is greater than 1. It is also N for selective repeat protocol.
Receiver Window SizeThe size of the receiver window is also 1 in the stop and wait protocol.The size of the receiver window is 1.The size of both the sender and receiver window is equal to implement selective repeat. Thus, it is N in this protocol.
Minimum Sequence NumberSince one data frame is transmitted at a time. The possible minimum sequence number is 2.The possible minimum sequence number for the Go-Back-N protocol is N+1. Here N is the number of data frames transmitted by the sender.The possible minimum sequence number for the Selective Repeat protocol is 2N. Here N is the number of data frames transmitted by the sender.
Efficiency of the ProtocolIt is the least efficient protocol. The formula to compute the efficiency is 1/(1+2*a), where a represents the ratio of propagation delay to transmission delay.The formula to compute the efficiency is N/(1+2*a), where a represents the ratio of propagation delay to transmission delay and N represents the data packets transmitted in the network.The formula to compute the efficiency is N/(1+2*a), where a represents the ratio of propagation delay to transmission delay and N represents the data packet transmitted in the network.
Acknowledgement TypeThe receiver node acknowledges each data frame is successfully transmitted individually.It sends a cumulative acknowledgment for the data frames to the sender node.In selective repeat, the acknowledgment is individual for each frame.
Supported OrderAt the receiving node of the Stop and Wait protocol, no specific order is needed.It only accepts in-order delivery at the receiver node in this protocol.In Selective Repeat ARQ, the receiver node only accepts out-of-order delivery in the network.
RetransmissionsSince the sender waits for each data frame to be acknowledged. Therefore, if a packet is dropped, then it is immediately retransmitted. Therefore, the number of transmissions is 1.All the data frames in the current window are retransmitted by the sender node if it does not receive the acknowledgment for the data frame. Thus, the number of retransmission is N.In selective repeat protocol, only the erroneous data frames are retransmitted. Thus, the number of retransmission is 1.

Conclusion

Go-Back-N and Selective Repeat both use Sliding Window Protocol that enables the sender node to transmit multiple data frames simultaneously in the network. The sender node does not require waiting for the acknowledgment from the receiver node to send several data frames.

The Stop-and-Wait protocol is different from the sliding window protocol as this protocol cannot transmit multiple data frames simultaneously in the network. It only allows the sender to node sends one data frame at a time. The sender waits for an acknowledgment after transmitting each data frame in the network. If it does not receive the data frame in a given time, it then retransmits the frame.