sliding window protocol in computer netorks
computer networks notes computer networks tutorial

Sliding Window Protocol and How Does it Work?

Sliding Window Protocols

Sliding window protocol is a Data Link layer protocol of the TCP/IP model. This is a necessary protocol. Today in this tutorial, we will learn about some basic sliding window protocol concepts and how sliding window protocols work. We will also study different types of sliding window protocol.

Computer Science students should know about sliding windows protocol. Some time questions are asked on sliding window protocol in viva voce of computer network lab.

Sliding window protocol is a mark scoring topic for the GATE(CS/IT) and UGC NET(CS) exam. Generally, concepts based or problem-solving based questions are always asked in the GATE(CS/IT) Exam every year.

So I would like to suggest GATE(CS/IT) aspirants study Sliding Window Protocol.

sliding window protocol in computer netorks

Frequently Asked Questions

By the end of this sliding window protocol tutorial, students will be able to answer the following questions and can also solve the GATE (CS/IT) Questions Based on the sliding window protocol.

  • What is Sliding Window Protocol in Computer Network?
  • What are the types of sliding window protocol?
  • What is the sender window and receiver window?
  • What is the use of Sequence number in Sliding window Protocol?
  • How does sliding window protocol work?
  • What is GO BACK N ARQ?
  • What is Selective Repeat ARQ?
  • What are the differences between Selective Repeat ARQ and GO BACK N ARQ?
  • What is the window size in GO BACK N ARQ and Selective Repeat ARQ?
  • Definition of important terms related to sliding window protocol.

Definition Related to Sliding Window Protocol.

Before studying sliding window protocol, students need to understand the meaning and definition of the following essential terms. These are basic definition related to Flow Control in computer networks. Let’s understand each definition clearly.

Transmission Delay – Transmission delay is the total time taken to transmit the packet from host to outgoing link. If the data size of the packet to be transmitted and Bandwidth of the link is given, then Transmission Delay can be calculated as

 Transmission Delay(Tt)= Data Size/ Bandwidth 

Propagation Delay –  Propagation Delay is the time taken by the first bit from the host to the outgoing link to reach the destination. It depends on the distance and wave propagation speeds.

Propagation Delay = Distance / Speed

Efficiency – Efficiency is defined as the ratio of total useful time to the total cycle time of a packet.

.

Total cycle time = Tt (data) + Tp (data) +  Tt(acknowledgement) + Tp(acknowledgement)
                       = Tt(data) + Tp(data) + Tp(acknowledgement)
                        = Tt + 2*Tp

Where Tt is Transmission Delay and Tp is propagation delay.

But this is reminded that acknowledgements are very less in size, their transmission delay can be ignored.

Useful time is Tt ( Transmission Delay )

Efficiency = Useful Time / Total Cycle Time
                 = Tt/(Tt + 2*Tp) (For Stop and Wait)
                   = 1/(1+2a) [ Using a = Tp/Tt ]

Round Trip Time (RTT) – This is the twice of propagation delay.

What is Sliding Window Protocol in Computer Network ?

Sliding window protocol is a data link layer protocol that is responsible for sequential and reliable delivery of data packets from one location to another location. This protocol is used in the Transmission Control Protocol (TCP).

Note Point – Sliding Window Protocol is a method of Flow Control for the network data transfer.

In this protocol, both the sender and receiver use the sending and receiving window. This technology uses sequence numbers for packets. These Sequence Numbers are used at the end receiver side to check the missing data packet. The sequence number also helps the receiver to find out and avoid duplicate data packets

sliding window protocol

How Does Sliding Window Protocol Work ?

Sliding window protocol works on in which there is simultaneous two-way communication. The sliding window protocol has imaginary boxes on both the sender and receiver sides. It defines the upper limit of the frames, which can be transferred before an acknowledgment.

The receiver can acknowledge the frame at any point, and consequently, the sender can send a frame till the time window is full. The size of the window is specified. For example if the size of the window is n=8, than frames are numbered as 0,1,2,3,4,5,6,7,0,1,2,3,…….

Whenever the receiver sends the acknowledgment for the next frame, it also has successive frames to remove the duplicate frame.

For example, if the receiver wants frame 6, he will send acknowledgment with number 6 to receive the sender’s frame. On the other hand, when the sender checks the acknowledgment with number 6 he confirms that the receiver received packets till frame number 5.

The sliding window protocol provides Full-Duplex Communication.

Some key points to remember about sliding window protocol are as follow –

  • In the sliding window protocol, both sender and receiver maintain a finite buffer that holds outgoing and incoming packets from the other side.
  • For every packet sent by the sender, there is an acknowledgement by the receiver. The sender maintains a timer for every sent packet. If the acknowledgement is not in that period, then the packet is resent.
  • Efficiency can be improved by making use of full-duplex communication.

Key Points to remember about Sliding Window Protocol at Sender Side

  • If the header frame allows k bits, then sequence numbers range from 0 to (2 K – 1).
  • Suppose the size sender window size will be at most (2 K – 1). For example, if the frame allows 3 bits, then the window’s size will be 23-1 =7.
  • A buffer is provided to the sender with the size of the sender window.

Key Points to remember Sliding Window Protocol – Receiver Side.

  • The receiver maintains a window size of 1.
  • The receiver acknowledges a frame by sending an ACK frame which includes the sequence number of the next frame expected.
  • The receiver also says to the sender that it is ready to receive how many next N frame and this scheme can also be used to acknowledge multiple frames.
  • The receiver needs a buffer of size 1.

What are the different types of Sliding Window Protocols?

There are two types of sliding window protocol. Let” see them one by one.

1.Go Back N ARQ: This protocol is known as the Go Back N Automatic Repeat Request protocol. It is a data link layer protocol. In this protocol, the sender can send multiple frames before receiving the acknowledgment from the receiver.

However, the sender keeps a copy of these frames until the acknowledgment arrives. For example, in GO- Back -N, the N is the sender’s window size; if it is GO-Back-5, the sender will send frame 1 to 5 before receiving the knowledge of frame 1.

All the frames are numbers to deal with the most and duplicate frames. If the sender does not receive the receiver’s acknowledgment, then all the frames available in the current window will be retransmitted.

Working of GO Back N is as Shown In Figure 2.

GO Back N ARQ

The regular operation of the sliding window protocol is shown in part 1 of Figure 2, and in part (b), the peculiarity is illustrated.

Suppose there is a situation that B waits for A’s first frame before sending one of its frames then sequence for this situation is shown in (a)

and in this situation, every frame is accepted.

But suppose another situation if A and B starts the communication at the same time, their first frames cross, and the data link layers then get

into the situation (b).

In a situation like part a of the image (a), every frame arrival brings a new packet for the network layer, so there are no duplicates. In a situation like part (b), part (b) of image figure, half of the frames are duplicate, even

though there are no transmission errors.

Points to Remember About Go Back N ARQ

  • Receiver window Size = 1.
  • Sender Window Size =( 2 K – 1 ) Where K is several bits received for the header’s window size.
  • The efficiency of GO Back N ARQ
  • Efficiency = (2 K – 1) * Ttransmission/(Ttransmission + RTT)
  • Ws + Wr <= ASN ( Available Sequence Number)
  • Uses cumulative /Piggybacking acknowledgement
  • Go Back N is also known as “conservative protocol””

2.Selective Repeat ARQ: The protocol is known as selective repeat automatic repeat request. It is also a data link layer protocol. However, this protocol handles the error situation effectively.

In this protocol, the size of the sender and receiver window is equal. If the receiver receivers any corrupted frame, he does not just discard it.

The receiver sends the negative acknowledgment to the sender. When the sender receives the negative acknowledgment, he sends the frame again.

selective repeat

In Figure 3, we see go back n for the case in which the receiver’s window is large. Frames 0 and 1 are correctly received and acknowledged. Frame 2, however, is damaged or lost. The sender, unaware of this problem, continues to send frames until the timer for frame two expires. Then it backs up to frame two and starts all over with it, sending 2, 3, 4, etc., all over again.

Point to Remember about Selective Repeat

  • Sender Window Size = Receiver Window Size = N/2, Where N= maximum ASN and its value is 2 K
  • It uses piggybacking/cumulative/independent acknowledgement.
  • It also accepts out of orders of packets.
  • Efficiency = (2 K – 1) * Ttransmission/(Ttransmission + RTT)
  • With Piggyback throughput = 2* Packet/RTT

Note – Students can also read  computer networks Tutorial 

Differences between Go Back N ARQ and Selective Repeat ARQ

The Differences between Go Back N ARQ and Selective Repeat ARQ are as follow –

Go Back N ARQ

  • Retransmit all the frames in case of corrupted frame
  • Waste high Bandwidth if faces more errors
  • Window size is N-1
  • Sorting is not required at both sender and receiver ends
  • No searching technique is needed
  • CPU Usage is less
  • More frequently used
  • Ack has requested frame number

Selective Repeat ARQ

  • Retransmit only the corrupts frame
  • Use less Bandwidth
  • Window size is <= (N+1)/2
  • The receiver needs to sort to manage the sequence of frames
  • The sender needs to use the searching to select requested frames
  • CPU usage is high because searching and sorting is needed
  • Ack has lost frame number
  • Less used because it has a complex structure

 Conclusion and Summary

The sliding window protocol is known as the error control protocol. Both types of sliding window protocols are effective in various situations. The protocols use the method of Error Detection and Error Correction at the Data Link Layer.

The elementary difference between Go Back N ARQ and Selective Repeat ARQ is Go Back N ARQ retransmits all frames, and Selective Repeat ARQ only retransmit the required and damaged frame.

The users can use a protocol based on sender and receiver CPU power, Bandwidth, and buffer. However, Selective Repeat ARQ is more effective than Go Back N ARQ because it uses less Bandwidth, and all the frames will be received by the receiver without any difficulty.

I kindly request to readers, please give your feedback and suggestion. If you find any mistake in this tutorial, then comment.

Don stop learning and practice.

All the Best !!

Leave a Reply

Your email address will not be published. Required fields are marked *