Difference between Stop and Wait protocol and Sliding Window protocol
Last Updated :
25 Aug, 2024
Both the Stop and Wait protocol and the Sliding Window protocol are the techniques to the solution of flow control handling. The main difference between the Stop-and-wait protocol and the Sliding window protocol is that in the Stop-and-Wait Protocol, the sender sends one frame and waits for acknowledgment from the receiver whereas in the sliding window protocol, the sender sends more than one frame to the receiver and re-transmits the frame(s) which is/are damaged or suspected.
Stop-and-Wait Protocol
Stop-and-Wait is a simple protocol used for transmitting data between two devices over a communication channel. In this protocol, the sender sends a packet of data to the receiver and then waits for the receiver to acknowledge the packet before sending the next packet. The receiver sends an acknowledgment to the sender indicating that the packet has been received and is error-free.
Features
- The sender transmits one packet at a time and waits for an acknowledgment before sending the next packet.
- The receiver sends an acknowledgment for each packet received, indicating whether it is a duplicate or a new packet.
- It is a simple and easy-to-implement protocol.
- It has low efficiency compared to sliding window protocols as it requires a lot of time to wait for an acknowledgment for each packet.
- It is ideal for situations where the transmission rate is low or the network is reliable.
Sliding Window Protocol
The Sliding Window protocol is a more efficient protocol for data transmission than the Stop-and-Wait protocol. It uses a window size to control the number of packets that can be transmitted without acknowledgement. The sender can transmit multiple packets within the window size before waiting for an acknowledgement from the receiver.
Features
- The sender can transmit multiple packets without waiting for an acknowledgement for each packet.
- The receiver sends a cumulative acknowledgement for a sequence of packets, indicating the last correctly received packet.
- It uses a sliding window mechanism to allow the sender to transmit a group of packets at once before receiving an acknowledgement for the first packet.
- It has a higher efficiency compared to stop and wait protocol as it allows for simultaneous transmission and acknowledgement of multiple packets.
- It requires more processing power and memory to implement than stop and wait protocol.
- There are two types of sliding window protocols – Go-Back-N and Selective Repeat – each with their own set of features and advantages.
Similarities
- Both protocols are used for reliable data transmission over an unreliable network.
- Both protocols use a timeout mechanism to handle lost or corrupted packets.
- Both protocols use sequence numbers to ensure the correct order of packets.
- Both protocols can handle retransmission of lost or corrupted packets.
- Both protocols can use selective retransmission to retransmit only lost or corrupted packets instead of retransmitting the entire window.
- Both protocols can provide flow control to prevent the sender from overwhelming the receiver with too many packets.
Difference between Stop and Wait Protocol and Sliding Window Protocol
| Stop-and-Wait Protocol |
Sliding Window Protocol |
| In Stop-and-Wait Protocol, sender sends one frame and wait for acknowledgment from receiver side. |
In sliding window protocol, sender sends more than one frame to the receiver side and re-transmits the frame(s) which is/are damaged or suspected. |
| Efficiency of Stop-and-Wait Protocol is worse. |
Efficiency of sliding window protocol is better. |
| Sender window size of Stop-and-Wait Protocol is 1. |
Sender window size of sliding window protocol is N. |
| Receiver window size of Stop-and-Wait Protocol is 1. |
Receiver window size of sliding window protocol may be 1 or N. |
| In Stop-and-Wait Protocol, sorting is not necessary. |
In sliding window protocol, sorting may be or may not be necessary. |
|
Efficiency of Stop-and-Wait Protocol is
1/(1+2*a)
|
Efficiency of sliding window protocol is
N/(1+2*a)
|
| Stop-and-Wait Protocol is half duplex. |
Sliding window protocol is full duplex. |
| Stop-and-Wait Protocol is mostly used in low speed and error free network. |
Sliding window protocol is mostly used in high speed and error-prone network. |
| In Stop-and-Wait Protocol, the sender cannot send any new frames until it receives an acknowledgment for the previous frame. |
In sliding window protocol, the sender can continue to send new frames even if some of the earlier frames have not yet been acknowledged. |
| Stop-and-Wait Protocol has a lower throughput as it has a lot of idle time while waiting for the acknowledgment. |
Sliding window protocol has a higher throughput as it allows for continuous transmission of frames. |
Conclusion
Stop and Wait protocol and Sliding Window protocol are two different protocols used in data communications to ensure reliable transmission of data over a network. Stop and Wait protocol is a simple protocol that transmits data one packet at a time and waits for an ACK before transmitting the next packet. Sliding Window protocol is a more complex protocol that allows multiple packets to be transmitted simultaneously without waiting for an ACK for each packet. Sliding Window protocol is more efficient and faster compared to Stop and Wait protocol and is preferred for high-speed data transmission over a network.
Stop and Wait protocol and Sliding Window protocol – FAQs
What is the main difference between Stop-and-Wait and Sliding Window protocols?
Stop-and-Wait allows one data packet to be sent at a time and then waits for an acknowledgment before a new transmission. Sliding Window allows several packets to be sent before an acknowledgment is required, and thus works more efficiently.
Which protocol is more efficient in terms of data transmission?
The Sliding Window is much more efficient since it allows several packets to be in transit at the same time, thus reducing the time that a sender is idle, which would be wasted while waiting for an acknowledgment.
In what situations is the Stop-and-Wait protocol typically used?
The Stop-and-Wait protocol is typically used in the case of simple, low-rate or just very reliable communication, under which circumstances simplicity sometimes wins out over the use of more efficient but more complicated protocols.
How do the two protocols differ in terms of how they handle errors?
In the case that an error is detected, the Stop-and-Wait does have the sender retransmit the single packet on time-out or in the event of an incoming NAK. The Sliding Window corrects errors without having to stop the entire transmission; it retransmits only those certain packets that haven’t been acknowledged.