html5-img
1 / 52

Data Link Layer Flow and Error Control

Data Link Layer Flow and Error Control. Flow Control. Flow Control Specifies the amount of data can be transmitted by sender before receiving permission to continue from receiver Error Control Allows receiver To find damaged or lost frames during transmission

devin
Download Presentation

Data Link Layer Flow and Error Control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Link Layer Flow and Error Control

  2. Flow Control • Flow Control Specifies the amount of data can be transmitted by sender before receiving permission to continue from receiver • Error Control Allows receiver To finddamaged or lost frames during transmission To coordinate re-transmission of those frames by sender • Flow Control & Error Control Flow control must acknowledge the correctly-received frames, So it is closely linked to error control

  3. Flow Control • Flow control • Sender transmits Faster than receiver can process them • Receiver will be forced to Drop some frames • Signaling • Signaling the sender to Slow Down to a rate acceptable to the receiver • Signaling can be Explicit or Implicit • e.g. , delay in sending back ACK to sender

  4. ARQ • Automatic Repeat reQuest • A flow and error control mechanism which uses: • Error detection • Timers • Acknowledgements • Retransmissions

  5. Automatic Repeat Request • If error(s) is detected in received Frame, return NAK to sender • NAK can be explicit or implicit (Expiration of sender Timer) • Sender starts a timerfor each frame • Timeout value = Expected delayfor sender to receive ACK for frame

  6. Automatic Repeat Request • Sender keepsa copy of each un-ACKed frame to re-transmit if required • If ACK is received, discarding the copy • If NAK is received (timer expired), re-transmit frame • ACK can be a separate frame or a control fieldPiggybacked in data frame going from receiver to sender

  7. Automatic Repeat Request • Flow and error control techniques at link layer • Stop-and-wait Protocol • Go-back-N Protocol • Selective-reject Protocol (A.K.A. selective repeat) • Sliding window Protocol

  8. Stop-and-Wait Protocol

  9. Stop-and-Wait Protocol • Each frame is assigned a Sequence Number • Source transmitsA Frame (e.g., frame SN= i) and waits for ACKnowledgement • Receiver acknowledges the receipt by sending back ACK • ACK includes the Request Number(RN) of next frame (i+1) • This implicitlysays that frame i is Error-Free • If frame iis in error, receiver discards it and sends ACK including RN=i

  10. Stop-and-Wait Protocol • Source waits for ACK until timer expires • Timeout =Tfram+2Tprop+Tack=2(Ttrans+Tprop)

  11. Stop-and-Wait Protocol • Retransmission, if timer expires &ACK not received • Frames are sequenced as 0, 1, 2, …, m • It is shown that for m>=1, transmissions have no conflict • Minimum possible frame sequence m=1 (0, 1, 0, 1, 0, 1, 0,) • Transmission Errors • Lost data frame • Damaged data frameat destination • Lost ACK

  12. Stop-and-Wait ARQ • Lost Frame • Source sends Data Frame and waits for ACK • Data Frame is lost • No ACK is replied by receiver • Timer expires • Source Retransmits the frame

  13. Stop-and-Wait ARQ • Damaged Frame at destination • Destination receives frame 1 in error • NACKis sent back (No ACK & Timer expires) • Sender knows Frame 1 is in error • Source Retransmitsframe 1

  14. Stop-and-Wait ARQ • Lost ACK • Frame1 is received at destination • Destination sends ACK 0 • Source does not receive ACK 0 • Timer expires • Source RetransmitsFrame 1 • Destination Discardsduplicated • Frmae1

  15. Stop-and-Wait Link Utilization • Source sends a single frame and waits for Tfram+2Tprop+Tack=2(Ttrans+Tprop) • Tpropislarge relative to Ttrans • Propagation delay is long relative to transmission time • Transmission of only one frame at a time • Waiting for a long time to receive ACK • Link is mostly idle • Stop-and-Wait Protocol ReducesLink Utilization

  16. Sliding Window Protocol

  17. Sliding Window Protocol • Allows Multiple Framesto be Transmittedat the same time • Transmitter and receiver have sequence numbers nt and nr • Frames and ACKs must be numbered • ntdenotes the next frame to be transmitted • i.e. the sequence number of the first frame not yet transmitted • nr is the first packet not yet received (Expected)

  18. Sliding Window Protocol • Transmitter and receiver have a window size wt and wr • Window size = # of frames that can be transmitted without an ACK • Transmitter sends wt frames continuously and wait for ACK • ACK Includes sequence nr • Receiver can ACK frames without permitting further transmission (Receive Not Ready=RNR) • Receiver must send a normal ACK to resume • Sliding window becomes stop-and-wait if window size is One

  19. Sliding Window Protocol

  20. Sliding Window Protocol Transmitter Operation • Transmitter needs to buffer so that if data is lost, it can be resent • Transmitter may transmit up to wt frame ahead of the latest acknowledgment na • It may transmit frame number nt, where nt < na+wt • It keeps the sent packets in buffer until ACK arrives

  21. Sliding Window Protocol Receiver Operation • Receiver needs to buffer so that if data is received out of order, it can be held until all packets are received • When a frame arrives • Receiver checks to see if the frame number falls in the receive window • If so, receiver accepts it and updates nr • If not, receiver discards it • Receiver sends ACK including current nr

  22. Sliding Window Protocol Sliding Window in a nutshell • Sender can transmit several framescontinuously before needing an ACK • If ACK received by sender before transmission is finished, sender can continue transmitting • An ACK can acknowledge the correct receipt of multiple frames at the Receiver • Frames may be ACKedby receiver at any time, and may be transmitted by sender as long as the window hasn’t filled up

  23. Sliding Window Example RR = Receive Ready window size = 7 segments

  24. Go-Back-NProtocol

  25. Go-Back-N Protocol • Most common form of error control based on Sliding Window • Window size W = N • Out of order (window) frames are discarded. • If frame F is in error • Receiver replies with rejection (REJ F / NACK) • Receiver discards frame F and all subsequent framesuntil it receives frame F correctly

  26. Go-Back-N Protocol • Upon receiving a NAK for frame F, transmitter must Go Back and retransmit frame F and all subsequent frames • Sender resends frame F (and all subsequent frames) when timer expires too • If window W is selected large enough, sender can transmit continuously if there are no transmission errors

  27. Go-Back-N Protocol • NAK 3 means Retransmit Frame 3 (also tells sender that all frames before frame 3 were received correctly) • Receiver discards all subsequent frames • Receiver only accepts Correct Frames received in Correct Order • So, receiver doesn’t need to Buffer any frames (to reorder them)

  28. Go-Back-N Protocol • Frame 2 is lost • Receiver is expecting Frame 2, But receives Frame 3 • Frame 3 (4,5,…) is discarded (even though correctly received) • NAK is sent for Frame 2 • Frame 2 and All Subsequences are Retransmitted

  29. Go-Back-N Protocol • Piggybacking • When traffic is Bi-Directional , ACK can be piggybacked on packets going in other direction • Each packet contains a • SNfield indicating the packet sequence number • RN field ACKs the packet in the other direction • If there is no packet before timeout, acknowledge RN is sent

  30. Selective Repeat Protocol

  31. Selective Repeat Protocol • SR attempts to retransmit only those packets that are actually lost • Receiver does not discard the frames received after an error-frame • Receiver must be able to accept good frames out of order • Receiver stores the correct frames in a buffer and waits for error-frame (Buffering)

  32. Selective Repeat Protocol • Receiver sends all frames to higher layer in order • Window protocol just like Go-Back-N • Window size W

  33. Selective Repeat Protocol Need for Buffer Sender must buffer all frames until they are ACKed • Up to W un-ACKed frames • Receiver must buffer frames until they can be delivered in order • Up to Wframes may have to be buffered at receiver • If the first frame is received in error

  34. Selective Repeat Protocol When Frame 2 received correctly, receiver can sends Frames 2-5 to its Network layer and send ACK 6 back to Sender

  35. Selective Repeat Protocol Retransmission Strategy • Receiver ACKs the correct frames • Not ACKed frames before time-out are assumed lost or in error • An explicit NAK (selective reject) can request retransmission of just one frame • NAK can expedite retransmission but is not strictly needed • Sender retransmits un-ACKed frame after a timeout or upon a NAK

  36. Link Utilization

  37. Link Utilization (Efficiency) Link Utilization is defined as the ratioof portion of communication link used for sending user data To bandwidth of the link User data rate Link data rate

  38. Stop-and-Wait Link Utilization

  39. ARQ Performance:Error-Free Stop-and-Wait T = Tframe + Tprop+Tproc+Tack +Tprop+ Tproc Tframe= Time to transmit Frame(Ttrans) Tprop= Propagation time Tproc= Processing time at station Tack = Time to transmit ACK Assume TprocandTack relatively small

  40. Error-Free Stop and Wait T ≈ Tframe + 2Tprop (time required to send a frame) Throughput = 1/T = 1/(Tframe + 2Tprop) frames/sec Normalize to link data rate (frames/sec): 1/ Tframe U= 1/(Tframe + 2Tprop) = Tframe= 1 1/ TframeTframe + 2Tprop 1 + 2a where a = Tprop/ Tframe

  41. Parameter a a = Propagation Time = d/V = Rd Transmission TimeL/R VL where d = Distance (m) V = Propagation speed (m/s) L = Frame length (b) R = Link data rate (b/s)

  42. Stop-and-Wait Timing tframe = 1, tprop = a

  43. Stop-and-Wait Performance a = Rd/VL

  44. Utilization (Example) Satellite Link Propagation Delay tprop = 270 ms Frame Size = 500 Bytes = 4 kb Data rate = 56 kbps ⇒ tframe = 4kb/56kb = 71 ms ⇒ a = tprop/tframe= 270/71 = 3.8 U = 1/(2a+1) = 0.12 Short Link Propagation Delay tprop = 5 μs Data Rate = 10 Mbps Frame = 500 bytes ⇒ tframe = 4k/10M = 400 μs ⇒ a=tprop/tframe= 5/400 = 0.012 U=1/(2a+1)=0.98

  45. Stop-and-Wait ARQwith Errors P = probability a single frame is in error Nt= 1 1 - P = average number of times each frame must be transmitted due to errors U= 1 = 1 – P Nt(1 + 2a) 1 + 2a

  46. Error-Free Sliding Window ARQ • Case 1: W ≥ 2a + 1 Ack for frame 1 reaches A before A has exhausted its window

  47. Error-Free Sliding Window ARQ • Case 2: W  2a +1 A exhausts its window at time t = W and cannot send additional frames until t = 2a + 1

  48. Normalized Throughput Error-Free Sliding Window ARQ  1 ; W ≥ 2a + 1 U = W ; W  2a +1 1 + 2a W times stop-and-wait throughput

  49. Selective Repeat ARQ  1 - P ; W ≥ 2a + 1 U = W(1 - P) ; W 2a +1 2a + 1 W times stop-and-wait (error) throughput

  50. Go-Back-N ARQ  1 - P W ≥ 2a + 1 1 + 2aP U = W(1 - P) W  2a +1 (2a + 1)(1 – P + WP) Why?

More Related