Header Ads Widget

Sliding Window Protocol

Sliding Window Protocol

Sliding Window protocols are those protocols that are used as a method of flow control in networks for the transfer of data.

  • With the help of the sliding window technique, multiple frames can be sent at a time by the sender before receiving any acknowledgment from the receiver.

  • Sliding Window protocols make the use of TCP(transmission control protocol).

  • The receiver can send the acknowledgment of multiple frames transmitted by the sender using a single ACK frame.

  • In the Sliding Window protocols, the term sliding window mainly refers to the imaginary box that can hold the frames of both the sender side as well as receiver side.

Sliding Window

The Sliding Window mainly provides the upper limit on the number of frames that can be transmitted before the requirement of an acknowledgment.

  • The frames get acknowledged by the receiver at any point even when the window is not completely full on the receiver side.

  • Also, the Frames may be transmitted by the source side even when at the time the window is not yet full on the sender side.

  • There is the specific size of the window, where the frames are numbered modulo- n, which simply means frames are numbered from 0 to n-1.
    For e.g. if n = 10, the frames are numbered 0, 1,2,3,4,5,6, 7,8,9, 0, 1,2,3,4,5,6, 7, 8,9,0, 1, ….

  • Whenever the receiver sends an acknowledgment (ACK)it also includes the number of the next frame that it expects to receive. For example, in the order to acknowledge the group of frames that ends in frame 6, the receiver needs to send the ACK that contains the number 7. When the sender sees an ACK with the number 7, then the sender comes to know that all the frames up to number 6 have been successfully received.

Let us now understand the working of the sliding window protocols:

There is a finite size buffer on the sender side as well as on the receiver side. The buffer on the sending side is also known as sending window while the buffer on the receiving side is known as receiving window.

  • Mainly the size of the sending window is used to determines the sequence number of the outbound frames.

  • Suppose the sequence number of the frames is a field of size n bit, then the assigned range of the sequence numbers is 0 to 2?????1.

  • As a result, the size of the sending window is 2?????1. In the order to accommodate a sending window whose size is 2?????1, there must be an n-bit sequence number that is chosen.

Each and every packet sent by the sender must get acknowledged by the receiver. There is a timer maintained by the sender for each sent packet and in case if there is a packet that is left unacknowledged in a certain time then the packet will be resent.

Also, the sender can send a whole window of packets before receiving an acknowledgment of the first packet in the window. And this will lead to higher transfer rates because the sender may send multiple packets without waiting for the acknowledgment of each packet.

Also, the receiver advertises its window size, which mainly indicates to the sender how much data it can receive. so that sender does not fill up the buffers of the receiver.

With the help of the modulo-n technique, the sequence numbers are mainly numbered. Let us take an example here if the size of the sending window size is 5, then the sequence numbers will be 0, 1, 2, 3, 4,0, 1, 2, 3, 4, 0, and so on.

The size of the receiving window indicates the maximum number of frames that the receiver can accept at a time. This size also determines the maximum number of frames that can be sent by the sender before receiving an acknowledgment.

In the sliding window, we make use of a technique known as Piggybacking. With the help of piggybacking technique, the acknowledgment is attached with the data frame.

Given below are two protocols that lie under the category of Sliding window are as follows;

  1. Go-Back-N ARQ Protocol

  2. Selective Repeat ARQ protocol

Sliding Window(Sender side)

In order to keep the track of the frames, the sender station sends the sequentially numbered frames.

  • As the sequence number to be used should occupy a field in the frame. Thus sequence number should be of a limited size.

  • If the k bits are allowed by the header of the frame, then the sequence number ranges from 0 to 2k-1.

  • There is a list of sequence numbers that is mainly maintained by the sender and on;y these are allowed to send by the sender.

  • The size of the sender window is at most 2k-1.

  • For example; if 4 bits are allowed by the frame then the size of the window is 2 raised to the power 4 -1
    16-1=15.

  • The buffer is provided to the sender that has the size equal to the size of the window.

Sliding Window(Receiver side)

The size of the window on the receiver side is always 1.

  • Acknowledgment of a frame is done by sending an ACK frame by the receiver to the sender along with the sequence number of the next expected frame.

  • It is explicitly announced by the receiver that it is prepared to receive N next frames, which begins with the number that is specified.

  • And this scheme is used in order to acknowledge multiple frames.

  • The window at the receiver side can hold 2,3,4 frame but holding the ACK frame until frame 4 has arrived. After the arrival, it will send the ACK along with sequence number 5 with which the acknowledgment of 2,3,4 is done at a time.

  • The buffer size needed by the receiver is 1.

Advantages of Sliding window

  • The transmission of multiple packets can be done without receiving an acknowledgment.

  • Using full duplex lines piggybacking can be done.

Disadvantages of the Sliding window

  • There is no limitation on sequence numbers that are required by this protocol.

  • There may be a wastage of bandwidth in some situations.


Go-Back-N ARQ

Go-Back-N ARQ is mainly a specific instance of Automatic Repeat Request (ARQ) protocol where the sending process continues to send a number of frames as specified by the window size even without receiving an acknowledgement(ACK) packet from the receiver.

The sender keeps a copy of each frame until the arrival of acknowledgement.

This protocol is a practical approach to the sliding window.

  • In Go-Back-N ARQ, the size of the sender is N and the size of the receiver window is always 1.

  • This protocol makes the use of cumulative acknowledgements means here the receiver maintains an acknowledgement timer; whenever the receiver receives a new frame from the sender then it starts a new acknowledgement timer. When the timer expires then the receiver sends the cumulative acknowledgement for all the frames that are unacknowledged by the receiver at that moment.

  • It is important to note that the new acknowledgement timer only starts after the receiving of a new frame, it does not start after the expiry of the old acknowledgement timer.

  • If the receiver receives a corrupted frame, then it silently discards that corrupted frame and the correct frame is retransmitted by the sender after the timeout timer expires. Thus receiver silently discards the corrupted frame. By discarding silently we mean that: “Simply rejecting the frame and not taking any action for the frame".

  • In case after the expiry of the acknowledgement timer, suppose there is only one frame that is left to be acknowledged. In that case, the receiver sends the independent acknowledgement for that frame.

  • In case if the receiver receives the out of order frame then it simply discards all the frames.

  • In case if the sender does not receive any acknowledgement then the entire window of the frame will be retransmitted in that case.

  • Using the Go-Back-N ARQ protocol leads to the retransmission of the lost frames after the expiry of the timeout timer.

The Need of Go-Back-N ARQ

    This protocol is used to send more than one frame at a time. With the help of Go-Back-N ARQ, there is a reduction in the waiting time of the sender.

    With the help of the Go-Back-N ARQ protocol the efficiency in the transmission increases.

    Send (sliding) window for Go-Back-N ARQ

    Basically, the range which is in the concern of the sender is known as the send sliding window for the Go-Back-N ARQ. It is an imaginary box that covers the sequence numbers of the data frame which can be in transit.

    The size of this imaginary box is 2m-1 having three variables Sf( which indicates send window, the first outstanding frame), Sn(indicates the send window, the next frame to be sent), SSize.(indicates the send window, size).

    • The sender can transmit N frames before receiving the ACK frame.

    • The size of the send sliding window is N.

    • The copy of sent data is maintained in the sent buffer of the sender until all the sent packets are acknowledged.

    • If the timeout timer runs out then the sender will resend all the packets.

    • Once the data get acknowledged by the receiver then that particular data will be removed from the buffer.

    Whenever a valid acknowledgement arrives then the send window can slide one or more slots.

    Sender Window Size

    As we have already told you the Sender window size is N.The value of N must be greater than 1.

    In case if the value of N is equal to 1 then this protocol becomes a stop-and-wait protocol.

    Receive (sliding) window for Go-Back-N ARQ

    The range that is in the concern of the receiver is called the receiver sliding window.

    • The receive window is mainly an abstract concept of defining an imaginary box whose size is 1and has a single variable Rn.

    • The window slides when a correct frame arrives, the sliding occurs one slot at a time.

    • The receiver always looks for a specific frame to arrive in the specific order.

    • Any frame that arrives out of order at the receiver side will be discarded and thus need to be resent by the sender.

    • If a frame arrives at the receiver safely and in a particular order then the receiver send ACK back to the sender.

    • The silence of the receiver causes the timer of the unacknowledged frame to expire.

    Design of Go-Back-N ARQ

    With the help of Go-Back-N ARQ, multiple frames can be transit in the forward direction and multiple acknowledgements can transit in the reverse direction. The idea of this protocol is similar to the Stop-and-wait ARQ but there is a difference and it is the window of Go-Back-N ARQ allows us to have multiple frames in the transition as there are many slots in the send window.

    Window size for Go-Back-N ARQ

    In the Go-Back-N ARQ, the size of the send window must be always less than 2m and the size of the receiver window is always 1.

    Flow Diagram

    Advantages

    Given below are some of the benefits of using the Go-Back-N ARQ protocol:

    • The efficiency of this protocol is more.

    • The waiting time is pretty much low in this protocol.

    • With the help of this protocol, the timer can be set for many frames.

    • Also, the sender can send many frames at a time.

    • Only one ACK frame can acknowledge more than one frame.

    Disadvantages

    Given below are some drawbacks:

    • Timeout timer runs at the receiver side only.

    • The transmitter needs to store the last N packets.

    • The retransmission of many error-free packets follows an erroneous packet.


    Selective Repeat ARQ

    It is also known as Sliding Window Protocol and used for error detection and control in the data link layer.

    In the selective repeat, the sender sends several frames specified by a window size even without the need to wait for individual acknowledgement from the receiver as in Go-Back-N ARQ. In selective repeat protocol, the retransmitted frame is received out of sequence.

    In Selective Repeat ARQ only the lost or error frames are retransmitted, whereas correct frames are received and buffered.

    The receiver while keeping track of sequence numbers buffers the frames in memory and sends NACK for only frames which are missing or damaged. The sender will send/retransmit a packet for which NACK is received.

    Example

    Given below is an example of the Selective Repeat ARQ −

    Explanation

    Step 1 − Frame 0 sends from sender to receiver and set timer.

    Step 2 − Without waiting for acknowledgement from the receiver another frame, Frame1 is sent by sender by setting the timer for it.

    Step 3 − In the same way frame2 is also sent to the receiver by setting the timer without waiting for previous acknowledgement.

    Step 4 − Whenever sender receives the ACK0 from receiver, within the frame 0 timer then it is closed and sent to the next frame, frame 3.

    Step 5 − whenever the sender receives the ACK1 from the receiver, within the frame 1 timer then it is closed and sent to the next frame, frame 4.

    Step 6 − If the sender doesn’t receive the ACK2 from the receiver within the time slot, it declares timeout for frame 2 and resends the frame 2 again, because it thought the frame2 may be lost or damaged.

    Post a Comment

    0 Comments