1 / 81

COE 341: Data & Computer Communications (T081) Dr. Marwan Abu-Amara

COE 341: Data & Computer Communications (T081) Dr. Marwan Abu-Amara. Chapter 7: Data Link Control Protocols. Contents . Error Control Stop-and-Wait ARQ Go-Back-N ARQ Selective-Reject ARQ Flow Control Stop-and-Wait flow control Sliding-Window flow control High-Level Data Link (HDLC).

isra
Télécharger la présentation

COE 341: Data & Computer Communications (T081) Dr. Marwan Abu-Amara

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. COE 341: Data & Computer Communications (T081)Dr. Marwan Abu-Amara Chapter 7: Data Link Control Protocols

  2. Contents • Error Control • Stop-and-Wait ARQ • Go-Back-N ARQ • Selective-Reject ARQ • Flow Control • Stop-and-Wait flow control • Sliding-Window flow control • High-Level Data Link (HDLC) COE 341 – Dr. Marwan Abu-Amara

  3. What is Data Link Control • The logic or procedures used to convert the raw stream of bits provided by the physical layer into a “reliable” connection • Requirements and Objectives: • Frame synchronization • Error control • Flow control • Addressing • Multiplexing data and control on connection • Link management COE 341 – Dr. Marwan Abu-Amara

  4. Error & Flow Control • We now study two main functions of the data-link layer • Error control • Flow control • Why Error & Flow Control together? • We usually lump Error Control and Flow Control discussions together because the data-link protocols used for error control are also used for flow control COE 341 – Dr. Marwan Abu-Amara

  5. Error Control Definition • Error Control is the second type of methods used to “handle” errors in frames • First type is FEC • Error Control methods are those that use retransmission in the case an error occurs in a frame • This process is called Automatic Repeat Request (ARQ) • In general, a retransmission is needed if a: • Frame is erroneous • Frame is lost (i.e. does not arrive or arrives too late) • There are several reasons for this to happen (e.g. existence of noise, network congestion…) COE 341 – Dr. Marwan Abu-Amara

  6. Flow Control Definition • We define Flow Control as: “The set of procedures used to restrict the amount of data that a TX can send before waiting for an acknowledgement from the RX” (per Forouzan) • This is to avoid overwhelming the RX by the flow of data from TX • RX does not‘absorb’ the received data instantly • It buffers (temporarily stores) the data it receives to do some processing before sending it upward to higher layers • Without flow control, the RX buffer may overflow and data gets lost COE 341 – Dr. Marwan Abu-Amara

  7. Flow Control • Assume: • No frames lost • No frames arrive in error • Frames arrive in the same order they were sent, following a variable propagation delay COE 341 – Dr. Marwan Abu-Amara

  8. A Model of Frame Transmission Loss Only one frame traveling on the link at any given time Error COE 341 – Dr. Marwan Abu-Amara

  9. Error & Flow Control Protocols • There are three main types of error control protocols (ARQ-based): • Stop-and-Wait ARQ • Sliding Window ARQ • Go-back-N ARQ • Selective-Reject ARQ • There are two main types of flow control protocols: • Stop-and-Wait • Sliding Window COE 341 – Dr. Marwan Abu-Amara

  10. Categories of Error Control COE 341 – Dr. Marwan Abu-Amara

  11. Categories of Flow Control COE 341 – Dr. Marwan Abu-Amara

  12. Stop-and-Wait ARQ • Stop-and-Wait ARQ is a simple protocol: • TX keeps a copy of the last frame sent • After receiving the frame, RX sends back an ACK • After receiving this ACK, TX sends another frame and so on… • Both Data & ACK frames are alternately numbered with “0” or “1” • Data Frame “0” is acknowledged by ACK “1” • Data Frame “1” is acknowledged by ACK “0” COE 341 – Dr. Marwan Abu-Amara

  13. Stop-and-Wait ARQ: Normal Operation COE 341 – Dr. Marwan Abu-Amara

  14. Stop-and-Wait ARQ: Abnormal Operation • Stop-and-Wait ARQ deals with encountered anomalies as follows: • Lost or Damaged Frames: RX discards them silently i.e. without sending Negative-ACK (NACK) back to TX • RX keeps its current value for R (R var. defined on prev. slide) • Lost or Damaged ACK: • TX discards damaged ACK • TX keeps a timer, after sending a frame, within which ACK must be received. Otherwise, ACK is considered lost. • In both situations, Lost and Damaged ACK, the TX sends the frame again COE 341 – Dr. Marwan Abu-Amara

  15. Stop-and-Wait ARQ: Lost Frame COE 341 – Dr. Marwan Abu-Amara

  16. Stop-and-Wait ARQ: Lost ACK COE 341 – Dr. Marwan Abu-Amara

  17. Stop-and-Wait ARQ: Delayed ACK • Another abnormality: TX receiving a lateACK • Timer has already expired • The ACK was considered lost • Frame is re-sent again • This frame will be duplicate at RX and discarded • Also its ACK will be discarded when received back at TX • Then the late ACK arrives • Now TX can send the next frame COE 341 – Dr. Marwan Abu-Amara

  18. Stop-and-Wait ARQ: Delayed ACK Lost COE 341 – Dr. Marwan Abu-Amara

  19. Stop-and-Wait ARQ Piggybacking • Piggybacking is a method that combines the data and the ACK in one frame • It is useful in bidirectional communications • Stations can send their data along with ACK to data previously received • Piggybacking is faster and saves bandwidth COE 341 – Dr. Marwan Abu-Amara

  20. Stop-and-Wait ARQ Drawback • In Stop-and-Wait ARQ, the line is not efficiently utilized because only one frame is sent at a time • Its ACK must be awaited for • During this waiting period no frames are sent • Inefficiency gets even worse when • TX speed is high • TX quickly sends frame then sits idle • Propagation distance is high • It takes longer for the frame and its ACK to reach destination • Both cases leave the TX waiting idle for longer times COE 341 – Dr. Marwan Abu-Amara

  21. Stop-and-Wait Efficiency • Let: • Tf : Time to transmit a frame = Lf / R • TACK : Time to transmit an ACK = LACK / R • TProp : Propagation time = (link distance) / V • TProc : Processing time • We define the frame total time as (see next slide): • Ttotal = Tf + 2 TProp + TProc + TACK • The utilization of the link is defined as: • U = (Tf)/(Ttotal) COE 341 – Dr. Marwan Abu-Amara

  22. TX RX Tf Tprop Tproc Tprop TACK Stop-and-Wait Efficiency • It is common to ignore TProc and TACK because they are negligible compared to other times • In which case the utilization becomes: • U = (Tf)/(Tf +2Tprop) = 1/(1 + 2a) • Where: a = Tprop/Tf • a is called the “length of the link in bits”: length of medium in bits compared to frame length (Lf) • Notice that for very small a (i.e. when 1st transmitted bit reaches RX, source will still be transmitting), U 100% • Notice that for very big a (i.e. frame transmission is completed before 1st bit reaches destination), U 0% • Efficient for links where a << 1 (long frames on a short link, i.e. fills link) COE 341 – Dr. Marwan Abu-Amara

  23. Stop and Wait Efficiency: Example • Compare the efficiency of stop-and-wait error control for two links using the parameter ‘a’: • Fame size, L = 1000 characters of 8 bits each, = 8000 bits • Satellite link between 2 ground stations • d = 2 x 36,000 km, Data rate, R = 1 Mbps • Typical wave velocity, V = 3 x 108 m/s • Frame TX time, tf = L/R = 8000/(1x106) = 8 ms • Propagation time, tprop = d/V = 2x36x106/(3x108) = 240 ms • End of first frame reaches RX after 8+240 = 248 ms from start • ACK takes 240 ms more to reach TX, which sends 2nd frame after 488 ms • Utilization = 8/488 = 1.6% (=1/(2a+1)) • 200-m optical fiber link • Data rate, R = 1 Gbps • Typical wave velocity, V = 2 x 108 m/s • Frame TX time, tf = L/R = 8000/(1x109) = 8ms • Propagation time, tprop = d/V = 200/(2x108) = 1 ms • End of first frame reaches RX after 8+1 = 9 ms from start • ACK takes 1 ms more to reach TX, which sends 2nd frame after 10ms • Utilization = 8/10 = 80% (=1/(2a+1)) COE 341 – Dr. Marwan Abu-Amara

  24. Sliding Window Protocol • Stop-and-Wait can be very inefficient when a > 1 • Protocol: • Assumes full duplex line • Source A and Destination B have buffers each of size W frames • For k-bit sequence numbers: • Frames are numbered: 0, 1, 2, …, 2k-1, 0, 1, … (modulo 2k) • ACKs (RRs) are numbered: 0, 1, 2, …, 2k-1, 0, 1, … (modulo 2k) • A is allowed to transmit up to W frames without waiting for an ACK • B can receive up to W consecutive frames • ACK J (or RR J), where 0  J  2k-1, sent by B, means B has received frames up to frame J-1 and is ready to receive frame J • B can also send RNR J: B has received all frames up to J-1 and is not ready to receive any more • Window size W, can be less or equal to 2k-1 COE 341 – Dr. Marwan Abu-Amara

  25. W W W W Sliding Window Protocol • Example of Sliding-Window-Protocol: k = 3 bits, W = 7 • Observations: • A may Tx W = 7 frames (F0, F1, …, F6) • After F0, F1, & F2 are Tx-ed, window is shrunk (i.e. can not transmit except F3, F4, …, F6) • When B sends RR3, A knows F0, F1 & F2 have been received and B is ready to receive F3 • Window is advanced to cover 7 frames (starting with F3 up to F1) • A sends F3, F4, F5, & F6 • B responds with RR4 when F3 is received – A advances the window by one position to include F2 W = distance between first unacknowledged frame and last frame that can be sent COE 341 – Dr. Marwan Abu-Amara

  26. Go-back-N ARQ • Go-back-N ARQ improves the efficiency of the line by sending up to W frames before worrying about ACK • This is called Pipelining (several tasks are started before the 1st is finished) • For this, the frames must be sequentially numbered • Sequence number must be included in the header of the frame • If m bits are reserved for sequence number then the sequence numbers range from 0 to 2m – 1 • Example: • m = 3 bits, then seq. numbers range is 0-7 and could be used as: • 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1,… COE 341 – Dr. Marwan Abu-Amara

  27. Go-back-N ARQ Sliding Window • At the TX side, to hold the outstanding frames until they are individually ACK, we use a window • The window size W cannot exceed 2m – 1 • W is fixed in this protocol but may be variable in others (e.g. TCP) • Each time a proper ACK is received for a frame the window slides past this frame, hence the name Sliding Window • The acknowledged frames can be purged out of the TX memory • As an example, next slide shows that frame 0 and 1 have been acknowledged • So the sliding window slides just past them in (b) COE 341 – Dr. Marwan Abu-Amara

  28. TX Sliding Window In (b), frame 0 and frame 1 were properly acknowledged COE 341 – Dr. Marwan Abu-Amara

  29. RX Sliding Window • At the RX side, the size of the window is always 1 • The RX window is centered on the next expected frame number • If any other frame arrives (i.e. out of sequence arrival), it is immediately discarded • If the right frame arrives, the window slides past it to zoom on the next expected frame COE 341 – Dr. Marwan Abu-Amara

  30. RX Sliding Window COE 341 – Dr. Marwan Abu-Amara

  31. Go-back-N ARQ Control Variables • TX keeps track of three variables • S: Sequence number of the recently sent frame • SF: Sequence number of the first frame in the window • SL: Sequence number of the last frame in the window • The frame size W is related to these variables by: • W = SL– SF + 1 • On the other hand the RX has only one variable: • R: Expected frame sequence number COE 341 – Dr. Marwan Abu-Amara

  32. Go-back-N ARQ: TX & RX Control Variables COE 341 – Dr. Marwan Abu-Amara

  33. Timers & Acknowledgments • TX sets a timer for each frame sent • RX has no timers • RX sends an ACK if a frame arrives with no errors and in order • If RX receives damaged or out of sequence frame, it silently discards them until it receives the expected frame • The silence of the RX causes the TX timer to expire • This in turn causes the TX to go back and send all frames starting from the non-acknowledged frame • This is why it is called Go-back-N ARQ • Example: • If TX has already sent frame-6 but the timer for frame-3 expires without receiving an ACK for it, the TX goes back and send frames 3, 4, 5, 6 COE 341 – Dr. Marwan Abu-Amara

  34. Go-back-N ARQ Normal Operation COE 341 – Dr. Marwan Abu-Amara

  35. Go-back-N ARQ Lost Frame Operation Here, ACK2 acknowledges frames 0 & 1 at the same time COE 341 – Dr. Marwan Abu-Amara

  36. Quiz: Window Size Condition for Go-back-N ARQ • Earlier, we mentioned that the size of the window must be W  2m – 1 i.e. W < 2m where “m” is the number of bits reserved (in the frame overhead) for the sequence number • By comparing the figures across explain the need for this condition COE 341 – Dr. Marwan Abu-Amara

  37. Sliding Window Protocol • Animation for Sliding Window protocol • Sliding Window Protocol Simulation (http://www.cs.stir.ac.uk/~kjt/software/comms/jasper/SWP3.html) COE 341 – Dr. Marwan Abu-Amara

  38. Example: Problem 7-9 Two neighboring nodes (A and B) use a sliding-window protocol with a 3-bit sequence number. As the ARQ mechanism, go-back-N is used with a window size of 4. Assuming A is transmitting and B is receiving, show the window positions for the following succession of events: • Before A sends any frames • After A sends frame 0, 1, 2 and B acknowledges 0, 1 and the ACKs are received by A • After A sends frames 3, 4, and 5 and B acknowledges 4 and the ACK is received by A COE 341 – Dr. Marwan Abu-Amara

  39. W W W Example: Problem 7-9 - Solution a) b) c) COE 341 – Dr. Marwan Abu-Amara

  40. Sliding Window Protocol - Piggybacking • When using sliding window protocol in full duplex connections: • Node A maintains its own transmit window • Node B maintains its own transmit window • A frame contains: data field + ACK field • There is a sequence number for the data field, and a sequence number for the ACK field COE 341 – Dr. Marwan Abu-Amara

  41. Selective-Repeat ARQ • Go-back-N ARQ simplifies the job of the RX • RX keeps track of one control variable R only • Out-of-sequence frames are simply dropped, not buffered • However, this protocol is inefficient for noisy links where the probability of damaged frames is high • This means many retransmissions will occur which uses up the bandwidth of the link • For noisy links, a more efficient mechanism is used in which only the damaged frame is retransmitted (not all N frames) • It is called Selective-Repeat ARQ COE 341 – Dr. Marwan Abu-Amara

  42. Selective-Repeat ARQ TX & RX Windows • Window configuration for the TX is the same as for Go-back-N ARQ • However, the window size should be W (½  2m) i.e. W  2(m-1) • RX window must have the same size as the TX • This a major difference with Go-back-N ARQ where window W = 1 for the RX • RX window specifies a range of a acceptable frame sequence numbers • Also, in selective-repeat ARQ the RX uses negative ACK (NACK) to report the sequence of a damaged frame to the TX COE 341 – Dr. Marwan Abu-Amara

  43. Selective-Repeat ARQ: TX & RX Control Variables Here, S = SF COE 341 – Dr. Marwan Abu-Amara

  44. Selective-Repeat ARQ Operation: Lost Frame Example Here, ACK2 acknowledges frames 0 & 1 at the same time 0 COE 341 – Dr. Marwan Abu-Amara

  45. Quiz: Window Size Condition for Selective-Repeat ARQ • Earlier, we mentioned that the size of the window must be W  2m – 1 where “m” is the number of bits reserved (in the frame overhead) for the sequence number • By comparing the figures across explain the need for this condition COE 341 – Dr. Marwan Abu-Amara

  46. Sliding Window Protocol - Efficiency • Refer to Appendix A • When window size is W (for error free), link utilization, U, is given by where a = Tprop/Tf (i.e. length of link in bits) • Sliding window protocol can achieve 100% utilization if W  (2a + 1) • The smaller the W needed the better! (Why?) • To get high value for U, small value for a is needed as well !! COE 341 – Dr. Marwan Abu-Amara

  47. Sliding Window Efficiency: Example • Compare the efficiency of Sliding Window flow control for two links using the parameter ‘a’: • Fame size, L = 1000 characters of 8 bits each, = 8000 bits • Satellite link between 2 ground stations • d = 2 x 36,000 km, Data rate, R = 1 Mbps • Typical wave velocity, V = 3 x 108 m/s • Frame TX time, tf = L/R = 8 ms • Propagation time, tprop = d/V = 240 ms • a = tprop / tf = 30 • 100 % link utilization is achieved with window size W: W  (2 a+1)  (2 x 30 +1)  61 W = 61, k = 6 bit (Large window and buffer sizes) • For k = 3 bits, W = 7: Utilization U = W/(2a+1) = 7/(61) = 11.5% > 1.6% for Stop and wait. • 200-m optical fiber link • Data rate, R = 1 Gbps • Typical wave velocity, V = 2 x 108 m/s • Frame TX time, tf = L/R = 8ms • Propagation time, tprop = d/V = 1 ms • a = tprop / tf = 0.125 • 100 % link utilization is achieved with window size W: W  (2 a+1)  (2 x 0.125 +1)  1.25 i.e. W = 2 (A window of just 2 frames) COE 341 – Dr. Marwan Abu-Amara

  48. Stop-and-Wait & Sliding Window as Flow Control Protocols • Problem: • Qualitatively explain how the Stop-and-Wait and the Sliding Window protocols could be used for flow control • Hint: • Think about the use of ACK and when the RX could send it back to the TX COE 341 – Dr. Marwan Abu-Amara

  49. High-Level Data Link Control Protocol (HDLC) • One of the most important data link control protocols and it is the basis for many data link control protocols. • The job of the HDLC layer (Link Layer, Layer 2) is to ensure that data passed up to the next layer has been received exactly as transmitted (i.e error free, without loss and in the correct order) • Another important job is flow control, which ensures that data is transmitted only as fast as the receiver can receive it. • There are two distinct HDLC implementations • HDLC NRM (see (SDLC), and • HDLC Link Access Procedure Balanced (LAPB) • Usually when referring to HDLC people mean LAPB or some variation COE 341 – Dr. Marwan Abu-Amara

  50. High-Level Data Link Control Protocol (HDLC) • To satisfy a variety of applications, HDLC defines three types of stations, two link configurations, and three types of data transfer modes of operation. • Station types: • Primary Station (PS): • Responsible for controlling the operation of the link • Frames issued by the PS are called commands • Secondary Station (SS): Frames issued by the SS are called responses – operates under the control of a primary station • Combined Station: issues commands and responses • Link configurations: • Unbalanced: one primary plus one or more secondary • Balanced: two combined stations COE 341 – Dr. Marwan Abu-Amara

More Related