1 / 73

Chapter 5 Peer-to-Peer Protocols and Data Link Layer

Chapter 5 Peer-to-Peer Protocols and Data Link Layer. PART I: General Overview Peer-to-Peer Protocols Data Link Layer Functions. Peer-to-Peer Protocols. Peer-to-Peer protocols: many protocols involve the interaction between two peers May be implemented at different layers. For example:

ciro
Télécharger la présentation

Chapter 5 Peer-to-Peer Protocols and Data Link Layer

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. Chapter 5 Peer-to-Peer Protocols and Data Link Layer PART I: General Overview Peer-to-Peer Protocols Data Link Layer Functions

  2. Peer-to-Peer Protocols • Peer-to-Peer protocols: many protocols involve the interaction between two peers • May be implemented at different layers. For example: • Data Link Layer (PPP, HDLC, etc) • Transport Layer (e.g., TCP) • Many networking services can be implemented at different layers: e.g., Error Detection & Retransmission, Sequencing, Timing, Flow Control, Segmentation & Blocking, Multiplexing, Security (Encryption, Authentication) etc • Focus mainly on Data Link Layer (DLC) services (in this part)

  3. Service Models • The service model specifies the information transfer service layer-n provides to layer-(n+1) • Important distinction is whether the service is: • Connection-oriented • Connection-less • Also, whether functions are implemented as: • End-to-End • Hop-by-Hop

  4. n + 1 peer process send n + 1 peer process receive Layer n connection-oriented service SDU SDU Connection-Oriented Transfer Connection-Oriented Service • Connection Establishment • Connection must be established between layer-(n+1) peers • Layer-n protocol must: Set initial parameters, e.g. sequence numbers; and Allocate resources, e.g. buffers • Message transfer phase • Exchange of SDUs • Disconnect phase • Example: PPP (Layer 2), TCP (Layer 4)

  5. Connectionless Transfer Service • No Connection setup, simply send SDU • Each message is sent independently • Must provide all address information per message • Simple & quick • Example: UDP, IP n + 1 peer process send n + 1 peer process receive Layer n connectionless service SDU

  6. End-to-End vs. Hop-by-Hop • A service feature can be provided by implementing a protocol • end-to-end across the network • across every hop in the network • Example: • Perform error control at every hop in the network or only between the source and destination? • Perform flow control between every hop in the network or only between source & destination? • There are tradeoffs between the two approaches

  7. Data Link operates over wire-like, directly-connected systems Frames can be corrupted or lost, but arrive in order Data link performs error-checking & retransmission Ensures error-free packet transfer between two systems Packets Packets Data link layer Data link layer Frames A B Physical layer Physical layer 1 1 2 2 3 3 1 2 1 2 2 1 1 2 Medium 2 1 B A 1 Physical layer entity 2 Data link layer entity 3 Network layer entity Example: Error control in Data Link Layer (a) (b)

  8. Messages Messages Segments Transport layer Transport layer Network layer Network layer Network layer Network layer Data link layer Data link layer Data link layer Data link layer End system A End system B Physical layer Physical layer Physical layer Physical layer Network Example: Error Control in Transport Layer • Transport layer protocol (e.g. TCP) sends segments across network and performs end-to-end error checking & retransmission • Underlying network is assumed to be unreliable

  9. Hop-by-Hop Data Data Data Data 1 2 3 4 5 ACK/NAK ACK/NAK ACK/NAK ACK/NAK End-to-End Approach Preferred Hop-by-hop cannot ensure E2E correctness, Works well when PHY layer is very noisy (e.g., wireless) But allows faster recovery Simple inside the network End-to-End Very efficient when PHY layer is reliable (e.g., fiber) More flexible if complexity at the edge 1 5 2 3 4 Data Data Data Data

  10. Directly connected, wire-like Losses & errors, but no out-of-sequence frames Applications: Direct Links; Computer LANs Data Links Services Framing Error control Flow control Multiplexing Security: Authentication & Encryption etc Examples Point-to-Point Protocol (PPP) Ethernet 802.3 (Wired) LAN IEEE 802.11 (Wireless) LAN Packets Packets Data link layer Data link layer Frames A B Physical layer Physical layer Data Link Layer

  11. Mapping stream of physical layer bits into frames Mapping frames into bit stream Frame boundaries can be determined using: Character Counts Control Characters Flags received frames transmitted frames Framing 0111110101 0110110111 Framing

  12. Data bits from higher layer Flag FCS Control Information Flag Address Framing & Bit Stuffing • Frame boundary defined by flag bits (e.g., 01111110) • Example: HDLC uses bit stuffing to prevent occurrence of flag 01111110 inside the frame • Transmitter inserts extra 0 after each consecutive five 1s inside the frame • Receiver checks for five consecutive 1s • if next bit = 0, it is removed • if next two bits are 10, then flag is detected • If next two bits are 11, then frame has errors

  13. Data to be sent (a) 0110111111111100 After stuffing and framing 0111111001101111101111100001111110 (b) Data received 01111110000111011111011111011001111110 After destuffing and deframing *000111011111-11111-110* Example: Bit stuffing & de-stuffing

  14. Error Detection & Retransmission • Purpose: to ensure a sequence of information packets is deliveredin order and without errorsor duplications despite physical layer problems • Technique known as: Automatic Repeat Request (ARQ) • Stop-and-Wait ARQ • Go-Back N ARQ • Selective Repeat ARQ • Basic elements of ARQ: • Error-detecting codes • ACKs (acknowledgment messages) • Timeout mechanisms

  15. 2 or more short messages 1 long message 1 block 2 or more blocks Segmentation & Blocking • To accommodate arbitrary message size, a layer may have to deal with messages that are too long or too short for its protocol • Segmentation & Reassembly: a layer breaks long messages into smaller blocks and reassembles these at the destination • Grouping & Ungrouping: a layer combines small messages into bigger blocks prior to transfer

  16. Pacing and Flow Control • Messages can be lost if receiving system does not have sufficient buffering to store arriving messages • If destination layer-(n+1) does not retrieve its information fast enough, destination layer-n buffers may overflow • Flow Control provide backpressure mechanisms that control transfer according to availability of buffers at the destination • Examples: TCP and HDLC

  17. Timing • Applications involving voice and video generate units of information that are related temporally • Destination application must reconstruct temporal relation in voice/video units • Network transfer introduces delay & jitter • Timing Recovery protocols use timestamps & sequence numbering to control the delay & jitter in delivered information • Examples: RTP & associated protocols in Voice over IP

  18. Multiplexing • Multiplexing enables multiple layer-(n+1) users to share a layer-n service • A multiplexing tag is required to identify specific users at the destination • Examples: UDP, IP

  19. Privacy, Integrity, & Authentication • Privacy: ensuring that information transferred cannot be read by others • Integrity: ensuring that information is not altered during transfer • Authentication: verifying that sender and/or receiver are who they claim to be • Security protocols provide these services and are discussed in Chapter 11

  20. Chapter 5Peer-to-Peer Protocols and Data Link Layer ARQ Protocols and Reliable Data Transfer

  21. Automatic Repeat Request (ARQ) • Purpose: to ensure a sequence of information packets is delivered in order and without errors or duplications despite transmission errors & losses • Combines error detection and retransmission to ensure data is delivered accurately • We will look at: • Stop-and-Wait ARQ • Go-Back N ARQ • Selective Repeat ARQ • Basic elements of ARQ: • Error-detecting codes • ACKs (acknowledgment messages) • Timeout mechanisms

  22. Header CRC Information packet Header CRC Control frame: ACKs Information frame Stop-and-Wait ARQ Transmit a frame, wait for ACK Error-free packet Packet Information frame Receiver (Process B) Transmitter (Process A) Timer set after each frame transmission ACK Control frame

  23. Information Frame: • Header: for control info • CRC Check: covers header & Info bits • CRC design: ensures error detection w high probability Control Frame: • Header: provides control info • ACKs: acknowledge receipt of a frame or group of frames • NAKs: a frame has been received in error

  24. (a) Frame 1 lost Time-out Time A Frame 0 Frame 1 Frame 1 Frame 2 ACK ACK B (b) ACK lost (Duplication of frames) Time-out Time A Frame 0 Frame 1 Frame 1 Frame 2 ACK ACK ACK B Need for Sequence Numbers • For station A, cases (a) & (b) are the same; A acts in same way • But in case (b) the receiving station B accepts Frame 1 twice • Question: How does B know the second frame is also Frame 1? • Answer: Add frame sequence number in header • Errors in the reverse channel • Loss of ACK results in duplicate packet • Use Slast : sequence number of most recent transmitted frame

  25. The transmitting station A misinterprets duplicate ACKs Incorrectly assumes second ACK acknowledges Frame 1 Question: How does the transmitter know second ACK is for Frame 0? Answer: Add frame sequence number in ACK header Use Rnext : sequence number of next frame expected by the receiver Implicitly acknowledges reception of all prior frames Problem with sequence numbers? Time-out Time A Frame 0 Frame 0 Frame 2 Frame 1 ACK ACK B Sequence Numbers (c) Premature Time-out (Gaps in delivered packet sequence)

  26. 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Rnext Slast Timer Slast Receiver B Transmitter A Rnext 1-Bit Sequence Number is Sufficient Global State: (Slast, Rnext) Error-free frame 0 arrives at receiver (0,0) (0,1) ACK for frame 0 arrives at transmitter ACK for frame 1 arrives at transmitter Error-free frame 1 arrives at receiver (1,0) (1,1)

  27. Transmitter Ready state Await request from higher layer for packet transfer When request arrives, transmit frame with updated Slast and CRC Go to Wait State Wait state Wait for ACK or timer to expire; block requests from higher layer If timeout expires retransmit frame and reset timer If ACK received: If sequence number is incorrect or if errors detected: ignore ACK If sequence number is correct (Rnext = Slast +1): accept frame, go to Ready state Receiver Always in Ready State Wait for arrival of new frame When frame arrives, check for errors If no errors detected and sequence number is correct (Slast=Rnext), then accept frame, update Rnext, send ACK frame with Rnext, deliver packet to higher layer If no errors detected and wrong sequence number discard frame send ACK frame with Rnext If errors detected discard frame Stop-and-Wait ARQ

  28. Stop-and-Wait Efficiency • Stop-and-wait works well over channels with small propagation delay • Inefficient when prop delay is much larger than time to transmit frame • Example: • Frame = 1000 bits over 1.5 Mbps channel • Time from beginning of Tx to receipt of ACK = 40 ms • No of bits that can be tx is 40 ms X 1.5Mbps = 60,000 bits • Efficiency = 1000/60,000 = 1.6% • Large delay-BW prod = prod of bit rate and delay before an action takes place • Delay-BW prod = LOST OPPORTUNITY in terms of Tx bits

  29. Last frame bit enters channel ACK arrives First frame bit enters channel Channel idle while transmitter waits for ACK t A B t Receiver processes frame and prepares ACK First frame bit arrives at receiver Last frame bit arrives at receiver Stop-and-Wait Efficiency • 10000-bit frame @ 1 Mbps takes 10 ms to transmit • If wait for ACK = 1 ms, then efficiency = 10/11= 91% • If wait for ACK = 20 ms, then efficiency =10/30 = 33%

  30. t0 = total time to transmit 1 frame A tproc B frame tftime tprop tprop tproc tack Stop-and-Wait Model bits/info frame bits/ACK frame channel transmission rate

  31. S&W Efficiency on Error-free channel bits for header & CRC Effective transmission rate: Transmission efficiency: Effect of frame overhead Effect of Delay-Bandwidth Product Effect of ACK frame

  32. Example: Impact of Delay-Bandwidth Product nf=1250 bytes = 10000 bits, na=no=25 bytes = 200 bits Stop-and-Wait does not work well for very high speeds or long propagation delays

  33. S&W Performance with Transmission Errors 1 successful transmission i – 1 unsuccessful transmissions Efficiency:

  34. Example: Impact of Bit Error Rate nf=1250 bytes = 10000 bits, na=no=25 bytes = 200 bits Find efficiency for random bit errors with p=0, 10-6, 10-5, 10-4 Bit errors impact performance as nfp approach 1

  35. Go-Back-N ARQ • Improve Stop-and-Wait efficiency by not waiting! • Keep channel busy by continuing to send frames • Allow a window of Ws non-acknowledged frames • Use m-bit sequence numbering • If ACK for oldest frame arrives before window is exhausted, we can continue transmitting • If window is exhausted, Go Back and retransmit all outstanding frames (starting from the oldest non-acknowledged one)

  36. 4 old frames not ACKed; so go back 4 Go-Back-4: Time fr 0 fr 1 fr 2 fr 3 fr 4 fr 5 fr 3 fr 4 fr 5 fr 6 fr 6 fr 7 fr 8 fr 9 A B Out-of-order frames are not accepted ACK1 ACK2 ACK4 ACK5 ACK3 ACK7 ACK6 ACK9 ACK8 Rnext 0 1 2 3 3 4 5 6 7 8 9 Go-Back-N ARQ • Frame transmissions are pipelined to keep the channel busy • (Pipeline: processing of new task before completion of previous task) • Window size larger than delay-BW product to keep channel full • Frame with errors and subsequent out-of-sequence frames are ignored • Transmitter is forced to go back when window of 4 is exhausted

  37. Time-out expires Stop-and-Wait ARQ Time fr 1 fr 0 fr 0 A B ACK1 Receiver is looking for Rnext=0 Four frames are outstanding; so go back 4 Go-Back-N ARQ fr 0 fr 1 fr 2 fr 3 fr 0 fr 1 fr 2 fr 3 fr 4 fr 5 fr 6 Time A B ACK1 ACK5 ACK2 ACK6 ACK4 ACK3 Receiver is looking for Rnext=0 Out-of-sequence frames Similarities between S&W and Go-back-N

  38. Similarities between S&W and go-back-N in error recovery Error: • S&W: error results in loss of Tx time equal to time-out period • Go-back-N: error results in loss of Tx time equal to the Tx of Ws frames Error Recovery: • S&W: Receiver is looking for frame with correct Rnext(0 or 1) • Go-back-N: Receiver is looking for frame with correct Rnext (0,1,…, N-1)

  39. Similarities between S&W and go-back-N in error recovery • S&W: Transmitter keeps sending the frame every time-out period until acknowledged • Go-back-N: Identify oldest outstanding unacknowledged frame and sent it together with the subsequent Ws-1 frames

  40. Need window size long enough to cover round trip time Time-out expires Stop-and-Wait ARQ Time fr 1 fr 0 fr 0 A B ACK1 Receiver is looking for Rnext=0 Four frames are outstanding; so go back 4 Go-Back-N ARQ fr 0 fr 1 fr 2 fr 3 fr 0 fr 1 fr 2 fr 3 fr 4 fr 5 fr 6 Time A B ACK1 ACK5 ACK2 ACK6 ACK4 ACK3 Receiver is looking for Rnext=0 Out-of-sequence frames

  41. Go-Back-N with Timeout • Problem with Go-Back-N as presented: • If frame is lost and source does not have frame to send, then window will not be exhausted and recovery will not be initiated • Use a timeout with each frame • When timeout expires, resend all outstanding frames

  42. Receiver Send Window Receive Window ... Frames transmitted and ACKed Slast Srecent Slast+Ws-1 Frames received Buffers Rnext oldest un-ACKed frame Slast Timer Slast+1 Timer ... most recent transmission Srecent Timer ... max Seq # allowed Slast+Ws-1 Go-Back-N Transmitter & Receiver Transmitter Receiver will only accept a frame that is error-free and that has sequence number Rnext When such a frame arrives, Rnext is incremented by one, and then the receive window slides forward by one Receiver sends an ACK with R_next; Tx assumes all prior frames received Send window: S_last to S_last +W_s -1 Window not allowed to slide beyond S_last +W_s -1 Need New Ack

  43. Transmitter Send Window m-bit Sequence Numbering ... Frames transmitted and ACKed 0 Slast 2m – 1 1 Srecent Slast+Ws-1 2 Slast send window i i + 1 i + Ws – 1 Sliding Window Operation Transmitter waits for error-free ACK frame with sequence number Slast When such ACK frame arrives, Slast is incremented by one, and the send window slides forward by one

  44. M = 22 = 4, Go-Back-3: Transmitter goes back 3 fr 0 fr 1 fr 0 fr 2 fr 2 fr 1 Time A ACK2 ACK3 ACK1 B Receiver has Rnext= 3 , so it rejects the old frame 0 Rnext 0 1 2 3 Maximum Allowable Window Size is Ws = 2m-1 Transmitter goes back 4 M = 22 = 4, Go-Back - 4: fr 0 fr 2 fr 3 fr 1 fr 1 fr 2 fr 3 Time fr 0 A B ACK1 ACK 0 ACK2 ACK3 Receiver has Rnext= 0, but it does not know whether its ACK for frame 0 was received, so it does not know whether this is the old frame 0 or a new frame 4 (4=0) Rnext 0 1 2 3 0

  45. Bidirectional Links • How can improve communication between A and B if information is flowing in both directions • Both A and B are implementing the Go-Back-N ARQ • So, both will have info to send + ACK (control frames) • Can be piggyback (attach) the control frames on the info frames?

  46. Bidirectional Links • What is the adv. of this piggybacking? • What if a frame arrives (carrying ACK) is in error? • What if a frame arrives (carrying ACK) is out of sequence? • What happens if the receiver has no info frames to send at this moment? How can be piggyback? Do we wait for info frame to come? Does a timer help here?

  47. Tout Tproc Tprop Tf Tprop Tf Required Timeout & Window Size • Timeout value: after which window is retransmitted • Ws should be large enough to keep channel busy for at least Tout

  48. Applications of Go-Back-N ARQ • HDLC (High-Level Data Link Control): bit-oriented data link control • V.42 modem: error control over telephone modem links

  49. Required Window Size for Delay-Bandwidth Product

  50. Efficiency of Go-Back-N • What affects the efficiency of GBN? • Errors on link • Delays in transmitting ack on reverse link (How do you make delays shorter?) • GBN is very efficient when Ws is large enough to keep channel busy, and if channel is error-free • Using Pfframe loss probability, the time to deliver a frame is: • tf if first frame transmission succeeds (1 – Pf) • tf + Wstf /(1-Pf) if the first transmission does not succeed (Pf) Delay-bandwidth product determines Ws

More Related