Monday, 17 June 2013

Sliding Window Protocol


Sliding Window Protocol
In this method, each outbound frame contains a sequence number, ranging  from 0 up to some maximum. For a n-bit sliding window, the range of sequence number is 0 to 2n-1 and frames are numbered module 2n i.e. after sequence number 2n-1, the next sequence number is 0.
      Let us consider a 3-bit sliding window, the sequence number can range from 0 to 7. Accordingly frames are numbered modulo 8, i.e. 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, ..........7, 0, 1, 2,........
     At any instant of time, the sender maintains a set of sequence numbers corresponding to frames it is allowed to send. These frames are said to fall within the sending window. Similarly, the receiver also maintains a receiving window, corresponding to the set of frames, it is allowed to accept.
      At the beginning of the communication, the sender begins sending the frame with the first sequence number 0 and keeps on transmitting till sequence number 2n-1 is reached from n-bit sliding window.
     The receiver also opens up a window with the same sequence number to receive the frames in the order in which they are sent. Any frame falling outside the receiver's window is discarded. In this way, all frames are received.


     Consider a 3-bit sliding window as illustrated in Figure. The shaded rectangle in the figure indicates that the sender may transmit 7 frames, beginning with frame 6. Each time a frame is sent, the shaded window shrinks, each time an acknowledgement is received, the shaded window grows.
   The mechanism described provides a form of flow control in which the receiver must only be able to accommodate 2n-1 frames beyond the one it has last acknowledged. To supplement this, most protocols also allow a station to completely cut off the flow of frames from the other side by sending a Receiver Not Ready (RNR) message, which acknowledges former frames but forbids transfer of future frames. At some subsequent point, the station must sent a normal acknowledgement to reopen the window. All the above discussion is for transmission in one direction only.
    If two stations exchange data simultaneously, each needs to maintain two windows, one for transmit and one for receive, and each side needs to send the data and acknowledgements to the other. To provide efficient support for this requirement, a technique called piggybacking is used.

Piggybacking

In this technique each data frames includes a field that holds the sequence number of that frame plus a field that holds the sequence number used for acknowledgement. These cases are in order :
(a) If a station has data to send and acknowledgement to send, it sends both together in one frame, thereby saving communication capacity.

(b) If a station has an acknowledgement but no data to send, it sends a separate acknowledgement frame.

(c) If a station has data to send but no new acknowledgement to send, it must repeat the last acknowledgement that it sent because the data frame includes field for the acknowledgement number and some value must be put into that field. When a station receives a duplicate acknowledgement, it simply ignores it.

> Combining data to be sent with control information is called piggybacking. Thus, piggybacking means combining data to be sent and acknowledgement of the frame received in one single frame.

Previous Page <<                                                                                                     

No comments:

Post a Comment