Header Ads Widget

Data Link Protocols(Stop-and-Wait and Go-Back-N)

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 efficiency, the efficiency of the stop &wait protocol is less, while the efficiency of the sliding window protocol is more than the stop & wait protocol. And, in stop & wait protocol sorting is not necessary, but in sliding window protocol, sorting may or may not be necessary. The stop & wait protocol is half-duplex whereas the sliding window protocol is full-duplex.

Stop & Wait Protocol

The Stop and Wait protocol is a simple flow control mechanism used in computer networks. In this protocol, the sender transmits a single data frame and waits for an acknowledgment from the receiver before sending the next frame. The receiver acknowledges the receipt of each frame, allowing for reliable and sequential data transmission. This protocol ensures that data is delivered successfully, but it can be inefficient for high-latency networks as it introduces delays during the waiting period.

How Stop & Wait Works

  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 the 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 for 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 feedback

Note: If any sliding window protocol must work properly then, the available sequence numbers must be greater than or equal to the sum of the 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 the 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 a 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 the 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

When it comes to data transmission in computer networks, one of the common challenges is the possibility of encountering damaged or corrupted data packets. This issue becomes particularly relevant when discussing flow control protocols like STOP & WAIT and STOP & WAIT ARQ (Automatic Repeat Request).

Imagine a scenario where a sender is transmitting a series of data packets to a receiver using the STOP & WAIT protocol. Each packet contains valuable information that needs to be accurately delivered. However, during transmission, a data packet becomes damaged due to noise, interference, or other factors present in the network.

In the basic STOP & WAIT protocol, without any error detection or retransmission mechanism, the receiver would be unaware of the damaged packet. The receiver would provide an acknowledgment to the sender, assuming the data was received correctly. As a result, the damaged packet remains undetected, leading to potential errors or inaccuracies in the received data.

This is where the enhanced STOP & WAIT ARQ protocol comes into play. Incorporating an acknowledgment mechanism and error detection capabilities, it allows the receiver to identify the damaged packet and request the sender to retransmit it. The sender, upon receiving this request, resends the packet, ensuring that the receiver obtains the correct data.

The inclusion of error detection and retransmission mechanisms in the STOP & WAIT ARQ protocol addresses the problem of damaged data packets. It provides a more robust and reliable approach to data transmission, as it actively detects and corrects errors, ensuring the accuracy and integrity of the received data.

Difference Between Stop & Wait and Stop & Wait ARQ

Here's a table comparing the Stop & Wait protocol and the Stop & Wait ARQ (Automatic Repeat Request) protocol:

Stop & Wait ProtocolStop & Wait ARQ Protocol
Error DetectionNo error detection mechanismIncorporates error detection mechanism
RetransmissionNo retransmission of lost or corrupted framesRetransmits lost or corrupted frames
EfficiencyLess efficient due to waiting periodsMore efficient due to error recovery capabilities
Data IntegrityNo assurance of data integrityEnsures data integrity through error detection
LatencyCan introduce significant delaysCan minimize delays through error recovery
Suitable forSimple networks with low error ratesNetworks with potential packet loss or errors
ReliabilityBasic reliability for data transmissionImproved reliability through error recovery

Post a Comment

0 Comments