Chapter 7: Data Link Control Protocols - PowerPoint PPT Presentation

chapter 7 data link control protocols n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Chapter 7: Data Link Control Protocols PowerPoint Presentation
Download Presentation
Chapter 7: Data Link Control Protocols

play fullscreen
1 / 86
Chapter 7: Data Link Control Protocols
317 Views
Download Presentation
jeneva
Download Presentation

Chapter 7: Data Link Control Protocols

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. COE 341: Data & Computer Communications (T061)Dr. Radwan E. Abdel-Aal Chapter 7: Data Link Control Protocols

  2. Where are we: Chapter 7: Data Link: Flow and Error control Data Link Chapter 8: Improved utilization: Multiplexing Physical Layer Chapter 6: Data Communication: Synchronization, Error detection and correction Chapter 4: Transmission Media Transmission Medium Chapter 5: Encoding: From data to signals Chapter 3: Signals and their transmission over media, Impairments

  3. Contents • Flow Control • Stop-and-Wait flow control • Sliding-Window flow control • Error Control • Stop-and-Wait ARQ • Go-Back-N ARQ • Selective-Reject ARQ • High-Level Data Link (HDLC) • Basic Characteristics • Frame Structure • Operation

  4. 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” link • Performed by Data Link Control Protocol (Layer) • Requirements and Objectives: • Frame-level synchronization: Recognize frame start and end • Flow control: Regulate sending of frames to match the ability of RX to absorb them • Error control: Retransmission of damaged or unacknowledged frames • Addressing: Identify stations on a multipoint line • Allowing for control information and data on same link • Link management: To initiate, Maintain, and terminate data exchange

  5. Flow & Error Control • We now study two main functions of the data-link layer • Flow control • Error control • Flow & Error Control together? • We usually discuss Flow Control and Error Control together as they use the same data-link protocols

  6. Flow Control • Required to avoid the TX overwhelming the RX by the flow of data it sends • 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

  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

  8. A Model of Frame Transmission Loss Only one frame traveling on the link at any given time Error

  9. Main Flow Control Protocols • Two main types of flow control protocols: • Stop-and-Wait • Sliding Window

  10. Categories of Flow Control

  11. Stop and Wait • Frames sent and acknowledged one at a time: • Source transmits frame • Destination receives frame and replies with an acknowledgement ACK • Source waits for ACK before sending next frame • Destination can stop the flow by not sending ACK • Works well for large frames on a short link at a low data rate (frame ‘fills’ the link)

  12. Data Fragmentation • However, large blocks of data are often split into several smaller frames- Why? • Limited frame buffer size at RX • To reduce frame error probability • Errors are detected sooner (when frame received) • On error, we need to retransmit a smaller amount of data • On a shared medium, e.g. a LAN, this prevents a station from occupying the medium for a long time • “Stop and wait” then becomes inadequate in such situations

  13. Stop and Wait Link Utilization • Number of bits in a frame = L bits • R = Data rate, bps • Frame transmission time, tf sec: Time taken by the TX to emit all frame bits into medium tf is large for large frames and low data rates • d = Link physical length, m • V = Velocity of propagation over link, m/s • Propagation time, tp sec: Time for a bit to traverse the link • Link length in bits, B bits/link: The number of bits that ‘fill’ the link if data is transmitted continuously • a = Propagation time / Transmission time Smaller ‘a’ means better link utilization with large frames If tf = 1, a = Propagation time tp

  14. Stop and Wait Link Utilization Let frame transmission time tf = 1  a = Propagation time Link ‘full’ most of the time  Better utilized Link ‘empty’ most of the time !  Underutilized a < 1 a > 1 Overhead of an ACK frame in both cases ! tp > tf tp < tf

  15. Stop and Wait Link Utilization (Efficiency) • Let us define link utilization, U, as: • From previous slide, we see that U is given by: • Where ‘a’ is • Utilization is high for small a: U approaches 1, i.e. 100% efficiency • Shorter links, Higher propagation velocities • Larger frames sizes, Lower data rates • Efficiency is poor for large a: • Longer links, Lower propagation velocities • Smaller frames sizes, Higher data rates

  16. 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, tp = 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)) • 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, tp = 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)) Stop and Wait Efficiency: Example • Compare the efficiency of stop-and-wait flow control for two links using the parameter ‘a’: • Fame size, L = 1000 characters of 8 bits each, = 8000 bits

  17. Sliding Windows Flow Control • Avoids low efficiency of Stop-and-wait for a > 1 situations • Allows multiple frames to be “in transit” simultaneously on the link • RX has buffer space (memory) for W frames • So, TX can send up to W frames without waiting for ACK • Each frame carries a sequence number • ACK from RX includes number of the next frame expected • TX keeps a list of frames it can send • RX keeps a list of frames it expects to receive • The lists form sliding windows at TX and RX that shrink/expand as frames are sent and ACKs are received • Hence, Sliding Windows Flow Control

  18. k = 3 bits Frame Sequence Numbering • Frame sequence number is limited by the size of the corresponding field in the frame, e.g. k bits • Frames are numbered modulo 2k • For k = 3, frame sequence # is modulo 8, i.e.= 0,1,..., 7, 0,1,… • Window size (W) is limited to a maximum of 2k-1 Frame Sequence Number

  19. Send/Receive Frames Receive/Send ACKs Sliding-Window Diagram Deletion Marker k = 3 bits Max window size < 2k Expand Delete Shrink W = 7 Max # of frames TXed without ACKed Remove ACKed frames from buffer

  20. Example Sliding Window Max window size of 7 RX TX Shrink RR = Receiver Ready Expand Delete Received up to 2 Ready to receive 7 frames starting with 3 Received up to 3 Ready to receive 7 frames starting with 4

  21. Sliding Window Enhancements • Receiver can acknowledge receiving frames without permitting further transmission: (Receive Not Ready RNR) • Example RNR 5: “Received frames up to 4, but not ready for 5 and beyond” • RX must send a normal acknowledge (RR 5) later for TX to resume sending frames

  22. Sliding Window in a Duplex System • In a Duplex System, destination also transmits data back to source • Piggybacking: Utilizing data frames from destination to carry ACK traffic back to source to improve channel utilization • Additional field in the data frame for use by ACK • If no data to send, use a normal ACK frame (e.g. RR or RNR) • If data but no acknowledgement to send, insert the last acknowledgement number to prevent RX from using the number existing in the ACK field of the data frame. (When a station receives a duplicate ACK, it ignores it)

  23. Sliding Window Protocol: Efficiency • Much more efficient than Stop and wait for a>1 • Treats link as a pipeline to be filled with frames in transit simultaneously- not just one by one • With window size W and assuming no error, link utilization, U, is given by (Appendix 7A) where a = Propagation time/Frame transmission time • i.e. Sliding window protocol can achieve 100% utilization for W  (2a + 1). • The smaller the W needed for this the better! (Why?). This requires a small a.

  24. 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, tp = d/V = 240 ms • a = tp / 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, tp = d/V = 1 ms • a = tp / 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)

  25. Error Control • Use of retransmission to handle errors detected in frames (Backward Error Handling) • This process is called Automatic Repeat Request (ARQ) • Types of Problems: • Damaged frames (Frame arrives at RX in error) • Lost frames (Noise burst damages frame beyond recognition- so not recognized by RX) • Frames arriving too late e.g. due to network congestion.

  26. Error Control Techniques: • Error detection: Chapter 6 • Positive acknowledgment: (for one or more frames) From RX for Error-free frames, e.g. RR i • Negative acknowledgement requesting retransmission: RX sends negative ACK for damaged or lost frames, requesting retransmission, e.g. REJ i • How does RX detect a “lost” frame? Through receiving the next frame “out of sequence” – Unexpected (frames are numbered) • Retransmission after timeout: TX automatically retransmits a frame that has not been acknowledged following a predetermined time-out interval

  27. Automatic Repeat Request (ARQ) • Three main types of ARQ-based standard error control mechanisms • Stop-and-Wait ARQ • Sliding Window ARQ • Go-back-N ARQ • Selective-Reject ARQ • Similar to their corresponding application in flow control

  28. Categories of Error Control

  29. Stop and Wait ARQ: Damaged/Lost Frame • TX transmits a single frame (keeping a copy) • Then waits for ACK from RX • If frame reaches RX damaged (in error): • RX discovers this through error detection • It then discards the frame, and does not send ACK • TX “times out” on waiting for ACK • … and then retransmits the frame again automatically • RX thus receives only one correct copy of the frame • Same if frame was lost

  30. Stop and Wait ARQ: Lost ACK • ACK from RX for a correct frame is lost (reaches TX damaged beyond recognition): • TX will timeout and retransmit • RX gets two copies of that frame • Without labeling frames, RX will consider both copies as two different valid frames • To avoid this, TX labels frames alternately as 0, 1 (enough for Stop and Wait) • RX uses ACK0 and ACK1. Similar to sliding window: • ACK0: Received 1 and ready for 0 (RR 0) • ACK1: Received 0 and ready for 1 (RR 1)

  31. Stop and Wait ARQ = RR 1 ACK Damaged/Lost Frame Damaged/Lost ACK RX gets two good copies of F1. Labeling frames allows RX to realize this and discard one.

  32. Stop and Wait - Pros and Cons • Simple • Inefficient (As seen with flow control) • For improved efficiency, we use sliding-window based ARQ (Continuous ARQ)

  33. Sliding Window ARQ • Improves line utilization by sending up to W frames before worrying about ACK • A form of Pipelining (several tasks started before 1st is finished) • TX uses a window to mark frames to be transmitted until they are sent and acknowledged • The window size W should be ≤ 2k – 1, k is the size of the frame sequence field in the frame header, • Frame are given sequence numbers modulo 2k, i.e. for k = 3: 0,1,2,3,4,5,6,7,0,1,2,….. • W is fixed in this protocol, but may be variable in others • Each time a proper ACK is received for a number of frames the TX window slides past them, hence the name Sliding Window. This: • Releases those frames for deletion from TX memory • Introduces new frames for transmission

  34. TX Sliding Window Frames that can be TXed Frame TXed F0, F1 Positively ACKed In (b), frame 0 and frame 1 were properly acknowledged

  35. RX Sliding Window • At the RX side, the size of the window is always 1 • The RX window contains the sequence number for the frame expected to be received next • If a different frame arrives (i.e. out of sequence arrival), it is immediately discarded and the window does not slide • Once the right frame arrives, the window slides one step to the next expected frame

  36. RX Sliding Window F0 now expected F0 Received Correctly F1 now expected

  37. Sliding Window ARQ: Summary • Uses sliding (rigid) windows at TX and RX to track frame movement • TX uses timeout on waiting for ACK • If no error: RX acknowledges with RR i, where i is number of the next frame expected As you receive expected frame without error k As you receive ACKs Frames received correctly and have been or will soon be acknowledged Frames waiting to be received Frames received correctly. Have or will soon be acknowledged As you transmit Expected next frame to be received Next frame to be sent Size = 1 Size ≤ 2k-1

  38. Sliding Window ARQ: • Two main standard approaches: • Go Back N • Selective Reject

  39. Sliding Window ARQ: Go Back N • Error Scenarios: Will consider the following error scenarios • Damaged Frame • Lost Frame • Lost Positive ACK (RR) • Lost Negative ACK (REJ)

  40. Go Back N ARQ: Error Scenarios • Damaged Frame, i: • RX discards frame i and all subsequent frames until frame i is received correctly • RX can either: • Scenario 1.A: Send a negative ACK (REJ i ) • TX must go back(hence the name go back N) and retransmit that frame and allsubsequent frames transmitted in the mean time • Scenario 1.B: Does not send REJ (relies on TX time out) Handled as a lost frame (next)

  41. Go Back N ARQ: Error Scenarios • Lost Frame, i: • RX expects frame i but does not get it, • So TX does not get any ACK for it • Scenario 2.A: • TX carries on sending subsequent frames, i+1, … • RX gets frame (i+1)out of sequence (as it did not get i). This allows RX to discover the problem RX then either: • Sends REJ i (Note i, not i+1) • Takes no further action (relies on TX time out) • TX must then go back and retransmit frame i and allsubsequent frames transmitted in the mean time

  42. Go Back N ARQ: Error Scenarios • Lost Frame, i: TX carries on sending, RX does nothing, TX times out LHS of TX window: Frames sent but not yet ACKed RX frame pointer does not leave ‘2’ until F2 is correctly received Slide W to Uncover F0, F1 F3 Arriving out of sequence (Not the next expected frame ), RX stopped, but sent nothing to TX Go back 1 On F2 S points to next frame to be TXed R points to next frame to be RXed

  43. Go Back N ARQ: Error Scenarios Lost Frame, Contd. • Scenario 2.B: • TX does not send further frames after i, and RX does not send any RR or REJ (RX does not know there is a problem!) • TX times out waiting for RX response • Scenario B-1: • TX sends a polling command (RR with P bit = 1) to force RX to report its receiving status by sending RR i • When RX receives the RR i, it retransmits frame i • Scenario B-2: • TX retransmits frame i after timeout

  44. Go Back N ARQ: Error Scenarios • Lost Positive ACK (RR) from RX: • RX gets frame i and sends acknowledgement RR (i+1) • This RR frame is lost on its way to TX • Two Scenarios: • Scenario 3.A: • Next Acknowledgement from RX, e.g. RR (i+n) manages to reach TX before TX times out. This solves the problem, since ACKs are cumulative • Scenario 3.B: • TX times out before receiving any subsequent RR: • TX sends a polling command (RR with P bit = 1) to force RX to report its receiving status by sending RR i. It sets a P-bit timer. • TX Repeats step above a few times, if no success it initiates a Reset procedure

  45. Go Back N ARQ: Error Scenarios • Lost Negative ACK (REJ) from RX: Similar to RX not sending REJ i.e. Scenario 1.B for Damaged Frame.

  46. Transmitter Receiver Go back 3 (4, 5, 6, 7) and Retransmit them Go Back N Example TX does not wait Got 0, 1 Ready for 2 Frame 4 lost on the way Got 3 Ready for 4 Got 5 not 4  REJ 4 and beyond 7 0 1 2 3 4 5 6 7 0 1 2 Go back in window until you meet the rejected frame, and resume transmission from there RR 7 (+ ive ACK) lost on the way. TX times out Before getting any subsequent RRs after lost one TX polls RX for receiving status Any corrective action needed here at TX?

  47. Example: Two neighboring nodes (A and B) use a sliding-window go-back-N for error control with a 3-bit sequence number. The window size is 4. Assuming A is TX and B is RX, show the window positions at A for the following situations: • Before A sends any frames • After A sends frames 0, 1, 2 and receives RR 2 from B • Later, after A sends frames 3, 4, and 5 and receives RR 5 from B Send Next

  48. Window Size Condition for Go-back-N ARQ • Earlier, we mentioned that the size of the window must be W  2k – 1 i.e. W < 2k where “k” is the number of bits reserved (in the frame header) for the sequence number • Let k = 2, i.e. W should be < 4 • By comparing the figures across for W = 3 and W = 4, justify the need for this limit on window size in Go Back N on F0 TX goes back to send F0 on F0 F0 F0 TX goes back to send F0 All happened before timeout F0 F0 sent twice in both cases. Mistake is detected only on the left (for the correct W size)

  49. Selective Reject (Selective Repeat ARQ) • Also called selective retransmission • RX requests retransmission of only a rejected frame using SREJ i • Subsequent frames received after the rejected frame are buffered at RX (not thrown away as in Go Back N) • TX retransmits only frames that were specifically rejected and those that timed out • Less retransmission than Go Back N

  50. Selective Reject: Example 4 gets lost 5 received out of sequence, Problem detected, SREJ 4 sent 5, 6 • Only rejected frame (4) retransmitted • (not 4,5,6) • Normal transmission resumes where left (7) TX sends: 5,6,4,7,0 (complex sequencing) Acknowledge up to 6 + ive ACK lost on the way! TX times out before getting subsequent RRs to the lost ones So it polls RX for its receiving status Things turned out OK