Flow Control

 


 

  Overview

 

 

  


The Players

 

 

 

 


Simple flow control protocol: Stop-and-Wait

 

assume (for now) error-free delivery

 

This sequence is repeated for every frame:

  1. sender reads data from its network layer
  2. sender assembles frame
  3. sender transmits frame
  4. receiver accepts frame
  5. receiver passes data to its network layer
  6. receiver transmits ACK to sender
  7. sender accepts ACK

 

Note that frame N+1 is not transmitted until ACK for frame N is received

 

What is maximum bandwidth utilization?

 


 

Stop-and-Wait with error control

 

called ARQ (automatic repeat request)

 

sender must be prepared to retransmit (buffer the data frame)

 

Here are the bad things that can happen:

 

Damaged Data Frame

Receiver: detects erroneous frame, responds with NAK rather than ACK

Sender: upon receipt of NAK, it retransmits last frame

 

Lost Data Frame

Receiver: can do nothing!

Sender: set timer upon transmit, then retransmit if timer expires before ACK/NAK received

 

Lost ACK frame

Sender: timer will expire because ACK not received. It assumes data frame lost and retransmit.

Receiver: receives duplicate frame! It must discard, then retransmit ACK. How does it know frame is duplicate?

 

Solution: each frame has sequence number. Alternating 0 and 1 will do. Sender appends sequence number to frame. Receiver attaches that number to ACK.

 

Lost NAK frame

Sender: timer will expire because NAK not received. It assumes data frame lost and retransmits.

Receiver: receives new copy of last frame. This is the frame it expected (it does not know the NAK was lost), so it accepts it.

 

 

 To summarize, solution requires:

 

Note: ACK sequence number not utilized here, but necessary for generalized sliding window protocol.

 


 

Flow control protocol : Sliding Window

 

 

 

Sender Window

 

 

 

Receiver Window

 

 

 


Basic error-free sliding window operation

 

Sender: Sender keeps buffer of n-1 consecutive frames. As sender sends each frame without receiving ACK, the window (but not buffer) grows smaller and smaller until it goes to size zero. At this point, it cannot send any more frames: none of the last n-1 frames has been ACKed and therefore all must be available for possible retransmission (not a factor, for error-free transmission). Once ACK is received, additional frames can be obtained from network layer for transmission.

 

Receiver: Receiver starts with empty buffer with capacity for n-1 consecutive frames. Window gets smaller and smaller as each frame received without ACK being sent (represents the number of available buffer space). If all n-1 buffer frames filled, window had size zero. At this point, it cannot receive any more frames until it sends an ACK. With error-free transmission, there is not much incentive to ACK until receiver buffer full. This changes when errors are introduced.

 


 

Sliding Window with Errors

 

Two basic strategies: Go-Back-N, and Selective-Reject (Selective-Repeat)

 

Essence of Go-Back-N: if a data frame is damaged/lost, all frames since previous ACK are retransmitted. Receiver has to discard all subsequent frames until it gets a new copy of the one it needed.

 

Essence of Selective-Repeat: if a data frame is damaged/lost, only the damaged/lost frame is retransmitted. Makes better use of bandwidth, but requires more complex logic. For instance, receiver must keep frames which it received correctly after the erroneous one, leaving a gap in the buffer. With Go-Back-N, it will discard these in the knowledge that the sender will retransmit them.