Jump to content

Sliding window protocol

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Samitshah1 (talk | contribs) at 14:26, 18 August 2007 (Created page with ''''Sliding Window Protocol''' is a bi-directional data transmission protocol in the data link layer (OSI model). It is used to keep a record of the ...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Sliding Window Protocol is a bi-directional data transmission protocol in the data link layer (OSI model). It is used to keep a record of the packet sequences sent and their respective acknowledgements received by both the users.


Concept

At any instant of time, the sender maintains a set of sequence numbers which correspond to the packets it is permitted to send. Such packets are said to be a set of the sending window. Similarly, the receiver also maintains a receiving window which indicates the set of packets it is allowed to receive.

A window can be hypothesized as a a circle divided into parts where n is the number of bits required to represent, in binary, the maximum sequence number in a given sequence of packets.

The upper and lower edges of a sending window indicate the set of packets which are allowed to be sent but have not been acknowledged. The upper and lower edges of a receiving window indicate the set of packets it may accept.

Whenever the network layer sends a new packet, the upper edge of the sending window is advanced by one. As shown in the figure, when a new packet is sent from the network layer to the data link layer, the upper edge of the window advances to 1 which indicates that the data link layer is allowed to send the 0th and 1st packets as they are still unacknowledged. On receiving the 0th packet the receiving window in the data link layer of the recipient advances its lower edge by one indicating it has received the 0th packet and sends the recipient sends an acknowledgement. On receiving the acknowledgement, the sending winndow advances its lower edge by one indicating that the transmission and subsequent reception of the 0th packet is complete.


Variants

There are two variants:

  • Go back n
  • Selective repeat

Go back n corresponds to the example above where the window size is one. In this case, if an error occurs in receiving the nth frame(encapsulated packet) the receiver simply discards subsequent frames and does not send the acknowledgement corresponding to the nth frame. This compels the sender to resend all frames starting with the nth and thereafter. This deteriorates the data rate. In selective repeat, the window size is more than one, and the recipient can receive a number of frames. If a frame is received with an error it simply sends a 'negative acknowledgement' signal corresponding to the faulty frame prompting the sender to resend the frame. In the meantime, the recipient can store the subsequent frames, which have already been sent, in a buffer and wait for the remaining frame to be received. Once received, the frames are transferred in sequence to the network layer.