DATA COMMUNICATION (ELA…) 1 DATA LINK CONTROL PROTOCOLS INTRODUCTION Synchronization and Interfacing are insufficient due to Probability of transmission errors Need of receiver to regulate arrival rate of data Layer of logic is added Data Link Control Key mechanisms 2 FLOW CONTROL FLOW CONTROL Stop Begin No Rcv Data from Tx Is there buffer capacity left? Yes Yes No More data to Tx? Clear Buffer Stop Rcv’ng Data from Tx Process Data Transfer Data to next upper layer 4 MODEL OF FRAME TRANSMISSION 5 FLOW CONTROL Definitions Transmission time Time taken to emit all bits onto the medium Proportional to length of frame Propagation time Time for a bit to traverse the link Options Stop-and-Wait Sliding Window 6 STOP-AND-WAIT FLOW CONTROL How does it work? Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames Not good when fragmentation is used 7 PERFORMANCE ISSUES Propagation Time a= Transmission Time d/V = = L/R Rd VL Where d Link distance (m) V Velocity of propagation (m/s) L Length of frame in bits R Data Rate (bps) 8 STOP-AND-WAIT – LINK UTILIZATION Tx Time = 1, Propagation time = a 9 a>1 a<1 SLIDING WINDOW FLOW CONTROL How does it work? Allows multiple frames to be in transit Receiver has buffer of length = W Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k) Frames are numbered modulo 2k 10 SLIDING WINDOW DIAGRAM 11 SLIDING WINDOW ENHANCEMENTS Receiver can acknowledge frames without permitting further transmission RNR Receive Not Ready Must send a normal ACK to resume If duplex, use piggybacking If no data to send, use ACK frame If data but no ACK to send Send last ACK number again, or have ACK valid flag (TCP) 12 ERROR CONTROL ERROR CONTROL Detection and correction of errors Lost frames Damaged frames Automatic Repeat Request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission 14 AUTOMATIC REPEAT REQUEST (ARQ) These techniques are all based on either Stopand-wait or Sliding Window flow control techniques Stop-and-wait ARQ Go-back-N ARQ Selective reject ARQ Selective retransmission 15 STOP-AND-WAIT ARQ Basic Operation t<To T R F(0) F(0) t=T …. o F(1) t=T …. o F(1) F(1) t<To F(1) F(1) Duplicate detected/16 discarded t t STOP-AND-WAIT ARQ Pros and Cons Simple Inefficient Referred to as Idle RQ 17 GO-BACK-N ARQ Most common implementation of Sliding Window flow control Uses window to control number of outstanding frames If no error, ACK as usual with next frame expected If error, reply with rejection (REJ) Discard that frame and all future frames until error frame received correctly Transmitter must go back and retransmit that frame and all subsequent frames 18 GO-BACK-N ARQ 19 SELECTIVE REJECT Also called selective retransmission Advantages Only rejected frames are retransmitted Subsequent frames are accepted by the receiver and buffered Minimizes retransmission Disadvantages Receiver must maintain large enough buffer More complex logic in transmitter 20 SELECTIVE REJECT ARQ 21 PERFORMANCE ISSUES PERFORMANCE ISSUES Stop-and-Wait Flow Control (No Errors) A sends a frame to B After receiving frame, B sends and ACK to A Process is repeated n times Thus, total time to transmit n frames can be expressed as Where T F Time to send a frame and receive ACK and 23 PERFORMANCE ISSUES Where TF t prop t frame t proc t prop t ack tprop Propagation time from A to B tframe Time to transmit a frame tproc Processing time at each station tack Time to transmit and ACK t proc 24 PERFORMANCE ISSUES TF t prop t frame t proc t prop tack t proc T nTF n(2t prop t frame) U n t fram e n(2t prop t fram e) Since a = tprop / tframe t fram e 2t prop t fram e 1 U 1 2a 25 PERFORMANCE ISSUES Sliding Window Flow Control (No Errors) 1 U W 2a 1 W W 2a 1 2a 1 26 PERFORMANCE ISSUES Stop-and-Wait Where ARQ (With Errors) 1 U N r (1 2a) Nr Expected # of transmissions of a frame 1 Nr 1 P 1 1 P U N r (1 2a) 1 2a 27 PERFORMANCE ISSUES Selective U Reject ARQ (With Errors) 1 P W 2a 1 W (1 P) 2a 1 W 2a 1 28 PERFORMANCE ISSUES Go-back-N U ARQ (With Errors) 1 P W 2a 1 1 2aP W (1 P) W 2a 1 (2a 1)(1 P WP) 29