Stop-and-wait protocol and Sliding window protocol are the methods evolved for handling the flow control of the network data transfers. These methods mainly differentiated by the techniques they follow such as stop-and-wait uses the concept of the acknowledging each data unit before sending another data unit. Conversely, sliding window protocol allows the transition of the several data units before sending an acknowledgement.
Among the two protocols, the sliding window protocol is more efficient than the stop-and-wait protocol.
Content: Stop-and-Wait Protocol Vs Sliding Window Protocol
|Basis for comparison||Stop-and-Wait Protocol||Sliding Window Protocol|
|Behaviour||Request and reply||Simultaneous transmit|
|Number of transferrable frames||Only one||Multiple|
|Acknowledgement||Sent after each arriving packet||Window of acknowledgement is maintained|
|Type of transmission||Half duplex||Full duplex|
Definition of Stop-and-Wait Protocol
In a communication, if the speed of transmitting data at the sender end is very much higher than the speed of reception of data at the receiver end, how the network is going to deal with these kinds of cases? It requires the working speed of sender and receiver should be unvarying. The stop-and-wait protocol has emerged as a solution to this problem. In this protocol, the sender sends a frame then waits for the acknowledgement. When the receiver sends an acknowledgement to the sender, it proceeds further and sends another frame. The transmission mode of the protocol is half duplex, as the sender transmits data to the receiver at a time and receiver sends the acknowledgement when data is received.
The example of the stop-and-wait protocol is the RPC (Remote Procedure Call) because it works in the similar pattern where the subroutine calls are implemented from the program in one device to the library routines on another device. As most programs are single-threaded, which make the sender wait for the reply before proceeding and sending other requests.
Definition of Sliding Window Protocol
Like stop-and-wait protocol, sliding window protocol is also a method to implement the flow control mechanism. It has eliminated the drawback of the stop-and-wait protocol where the restricted amount of data can be transmitted in one direction at a time. The performance of the sliding window protocol has improved by sending multiple frames bidirectionally at the same time (i.e., n>1, while stop-and-wait limits n to 1). In this scheme, the sender sends sequentially numbered frames to the recipient in order to keep track of the frames, if the header size is n bit the sequence can range from 0 to (2n-1).
The window here signifies a buffer utilised to store the data till the receiver does not read it, after reading the content the buffer is emptied. It uses two types of windows, sending window and receiving window which can range up to (2n-1). The sending window maintains the sequence number relating to the transmitted frames, and it is controlled at the sender’s end. Similarly, the receiver’s end also has a receiving window to keep track of the frames allowed to accept.
The TCP protocol works as the sliding window protocol and uses a buffer placed in the kernel of the operating system.
Key Differences Between Stop-and-Wait Protocol and Sliding Window Protocol
- The stop-and-wait protocol follows a request and reply model. As against, in sliding window protocol, the frames are spontaneously transmitted for the specific window size.
- Only one frame is transmitted at a time in the stop-and-wait protocol while sliding window transmits more than one frame at a time.
- The efficiency of the sliding window protocol is more than the stop-and-wait protocol because it produces short propagation delay.
- Stop-and-wait protocol generates an acknowledgement at the receiver end after receiving each frame whereas the acknowledgement in the sliding window is produced after receiving a particular set of frames.
- The mode of transmission in the stop-and-wait protocol is the half duplex. On the contrary, it is full duplex in case of the sliding window.
- Sliding window protocol effectively utilises the link. In contrast, link utilisation in the stop-and-wait protocol is inferior.
Both of the protocols, stop-and-wait and sliding window protocol provides the mechanism for flow control. However, the performance of the sliding window protocol is better than stop-and-wait protocol because it makes effective utilisation of the bandwidth, while the stop-and-wait protocol wastes the network resources.