The Wayback Machine - https://web.archive.org/web/20241009040802/https://www.geeksforgeeks.org/difference-between-stop-and-wait-protocol-and-sliding-window-protocol/
Open In App

Difference between Stop and Wait protocol and Sliding Window protocol

Last Updated : 25 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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.



Similar Reads

Stop and Wait protocol, its problems and solutions
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
2 min read
Efficiency of Stop and Wait Protocol
Stop and Wait is a flow control protocol. In which the sender sends one packet and waits for the receiver to acknowledge and then it will send the next packet. In case if the acknowledgement is not received, the sender will retransmit the packet. This is the simplest one and easy to implement. but the main disadvantage is the efficiency is very low
3 min read
Sliding Window Protocol | Set 3 (Selective Repeat)
Prerequisite : Sliding Window Protocol - Set 1 (Sender Side), Set 2 (Receiver Side) Why Selective Repeat Protocol? The go-back-n protocol works well if errors are less, but if the line is poor it wastes a lot of bandwidth on retransmitted frames. An alternative strategy, the selective repeat protocol, is to allow the receiver to accept and buffer t
3 min read
Sliding Window Protocol | Set 1 (Sender Side)
Reliable data transmission is critical in computer networking, particularly across long distances or in networks that have high latency. The Sliding Window Protocol is a critical component in obtaining this reliability. It is part of the OSI model's Data Link Layer and is used in several protocols, including TCP. Sliding Window protocol handles eff
8 min read
Sliding Window Protocol - Go Back N (GBN)
The Sliding Window Protocol is a method used in computer networks to manage the flow of data between two devices, ensuring that data is sent and received in the correct order. There are two types of sliding window protocol Go-Back-N (GBN), and Selective Repeat (SR). In Go-Back-N, the sender can send multiple data packets without waiting for an ackn
7 min read
Difference between window.location.href, window.location.replace and window.location.assign in JavaScript
Window.location is a property that returns a Location object with information about the document's current location. This Location object represents the location (URL) of the object it is linked to i.e. holds all the information about the current document location (host, href, port, protocol, etc.) All three commands are used to redirect the page t
4 min read
Stop and Wait ARQ
Stop and Wait ARQ is a Sliding Window Protocol method used for the reliable delivery of data frames. The stop-and-wait ARQ is used for noisy channels or links to handle flow and error control between sender and receiver. The Stop and Wait ARQ protocol sends a data frame and then waits for an acknowledgment (ACK) from the receiver. What is Stop and
9 min read
Python - Stop & Wait Implementation using CRC
Stop and wait protocol is an error control protocol, in this protocol the sender sends data packets one at a time and waits for positive acknowledgment from the receiver's side, if acknowledgment is received then the sender sends the next data packet else it'll resend the previous packet until a positive acknowledgment is not received. Note: To get
7 min read
Sliding Window protocols Summary With Questions
Prerequisites - Stop & Wait, Go Back N, Selective Repeat Summary of all the protocols - Before starting with the questions a quick recap for all the protocols. Stop and wait - Sender window size (Ws) = 1Receiver window size (Wr) = 1Sequence Number â‰Ĩ 1 + 1Uses independent acknowledgementDiscards out of order packetsPacket Loss ? Retransmit packe
4 min read
Difference between window.onkeypress and window.document.body.onkeypress
The onkeypress event can be triggered in JavaScript using both: window.onkeypresswindow.document.body.onkeypress To understand the difference between the two we need to have a look at the HTML DOM (Document Object Model): DOM is a model that represents the HTML document as a tree structure.The tree structure has the root node as a Document object.O
2 min read
Difference between Border Gateway Protocol (BGP) and Routing Information Protocol (RIP)
When dealing with network routing, it's crucial to understand the various protocols that help direct traffic across complex networks. Two significant protocols in this space are the Border Gateway Protocol (BGP) and the Routing Information Protocol (RIP). Each serves different purposes and operates under different principles. This article explores
5 min read
Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
Data transfer is the most common task in network and system communications, and they involve transfer of files using two means i.e the File Transfer Protocol (FTP) and the Secure File Transfer Protocol (SFTP). FTP is a commonly applied protocol that enables files to be transferred through a network from one computer to another, but FTP is unsecure
5 min read
Difference between Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP)
Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP), are designed to avoid network loops in Ethernet. It provide loop-free logical topology. They were both designed to provide network reliability and particularly avoid broadcast radiation, but the major differences are on the rate, functionality and versatility. In this article we
5 min read
Difference between Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP)
SLIP and PPP, which are the widely used serial connection techniques, help to connect the distant devices of the network. The fullform of SLIP is Session Layer Internetworking Protocol. SLIP being a primitive protocol put into use during the early connections to the Internet, when there was not much overhead. PPP is slightly more complex as the pro
6 min read
Difference between Write invalidate protocol & Write Update Protocol (Bus-Snooping )
Cache coherence becomes an issue in today’s multi processor system where all the processors are using a common memory. Two key maintained protocols to achieve this coherency through bus-snooping are the write invalidate protocol and the write update protocol. To efficiently manage memory and achieve better performance while using the operating syst
7 min read
Difference Between wait() and notify() in Java
The wait() and notify() are methods of the Object class. They were introduced to part ways with polling, which is the process of repeatedly checking for a condition to be fulfilled. Polling wastes CPU resources considerably, hence it is not preferred. wait() Methodwait() method is a part of java.lang.Object class. When wait() method is called, the
7 min read
Difference between wait and sleep in Java
Sleep(): This Method is used to pause the execution of current thread for a specified time in Milliseconds. Here, Thread does not lose its ownership of the monitor and resume's it's execution Wait(): This method is defined in object class. It tells the calling thread (a.k.a Current Thread) to wait until another thread invoke's the notify() or notif
2 min read
Difference Between wait() and notifyall() in Java
Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilization of CPU. Each part of such program is called a thread. So, threads are light-weight processes within a process. Multi-threaded programs may often come to a situation where multiple threads try to access the same resources and f
7 min read
Differences between wait() and join() methods in Java
The wait() and join() methods are used to pause the current thread. The wait() is used in with notify() and notifyAll() methods, but join() is used in Java to wait until one thread finishes its execution. wait() is mainly used for shared resources, a thread notifies other waiting thread when a resource becomes free. On the other hand join() is used
2 min read
Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
Hot Standby Router Protocol (HSRP) is a CISCO proprietary protocol used to provide redundancy in a network. Only one router is the active router while others will be in standby state i.e the standby router will be responsible for forwarding the traffic when the active router fails. Virtual Router Redundancy Protocol (VRRP) is an open standard proto
3 min read
Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) in Data Link Layer
Layer 2 or the Datalink layer provides physical addressing and access to media. It defines how data is to be formatted for transmission and how access to the network is to be controlled. It also provides error detection, ensuring data on higher layers is formatted correctly for transmission. Cisco Discovery Protocol (CDP) and Link Layer Discovery P
2 min read
ECN+, ECN+/Wait, ECN+/TryOnce and Alternative Backoff with ECN (ABE)
ECN algorithm did not allow to set ECT flag on control packets like SYN, SYN/ACK, ACK, URG, FIN, etc. ECN+ algorithm and its extensions basically extend the ECN idea and allow ECT flag on SYN/ACK packet. If ECN is permitted on SYN packet then it might be misused and attackers can launch an SYN flood attack on the server and eventually Denial of Ser
6 min read
How to Stop Phishing?
Phishing is the starting point of most cyberattacks. When sending malicious messages or creating a clone site, attackers use psychological techniques and social engineering tools, so protecting against such campaigns is not an easy task for information security professionals. To protect against phishing attacks, you can use different tools built in
8 min read
Difference Between Desktop Environment VS Window Manager in Linux
If you are a Linux user, you must have heard of the term Desktop Environment. It is one of the deciding factors when choosing a Linux distribution. There is something else that is comparatively less known among beginners, it is a Window manager. In this article, we will understand both of them, and see how do they compare with each other. What is a
5 min read
Main difference between Timestamp protocol and Thomas write rule in DBMS
Time Stamping Protocols: The timestamp protocols ensures that each transaction in the system has in advance a timestamp that has been associated with each transaction that is being helpful to the transaction to be executed in the system that time only. It is most helpful in the case when large number of concurrent processes are running in the syste
2 min read
Difference between Hierarchical and Flat routing protocol
1. Hierarchical Routing Protocol: Hierarchical Routing is the method of routing in networks that is based on hierarchical addressing. Most transmission control protocol, Internet protocol (TCPIP). Routing is based on two level of hierarchical routing in which IP address is divided into a network, person and a host person. Gateways use only the netw
3 min read
Difference Between Stateless and Stateful Protocol
In networking, how interactions between clients and servers are managed greatly affects system performance. There are two main types of protocols for this purpose: stateless and stateful protocols. Stateless protocols do not maintain state information, so a server does not need to retain information from prior requests. This simplifies server desig
5 min read
Difference Between Go-Back-N and Selective Repeat Protocol
Both the Go-Back-N Protocol and Selective Repeat Protocol are the types of sliding window protocols. The main difference between these two protocols is that after finding the suspect or damage in sent frames go-back-n protocol re-transmits all the frames whereas the selective repeat protocol re-transmits only the frame which is damaged. What is the
4 min read
Difference Between High-level Data Link Control (HDLC) and Point-to-Point Protocol (PPP)
The main difference between High-level Data Link Control (HDLC) and Point-to-Point Protocol (PPP) is that High-level Data Link Control is the bit-oriented protocol, on the other hand, Point-to-Point Protocol is the byte-oriented protocol. Another difference between HDLC and PPP is that HDLC is implemented by Point-to-point configuration and also mu
5 min read
Difference Between Virtual Private Network (VPN) and Multi-Protocol Label Switching (MPLS)
Virtual Private Network (VPN) and Multi-Protocol Label Switching (MPLS) are two networking technologies that allow for secure and efficient data transmissions. VPN is a secure connection which is established over a public network connection enabling users to remotely access private networks with encrypted information being sent through it. On the o
6 min read