1 / 130

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

Chapter 5 Peer-to-Peer Protocols and Data Link Layer. PART I: Peer-to-Peer Protocols 5.1 Peer-to-Peer Protocols and Service Models 5.2 ARQ Protocols and Reliable Data Transfer 5.3 Other peer-to-peer Protocols: Flow Control Timing Recovery TCP Reliable Stream Service and Flow Control.

keitha
Download Presentation

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: Peer-to-Peer Protocols 5.1 Peer-to-Peer Protocols and Service Models 5.2 ARQ Protocols and Reliable Data Transfer 5.3 Other peer-to-peer Protocols: Flow Control Timing Recovery TCP Reliable Stream Service and Flow Control

  2. Chapter 5Peer-to-Peer Protocols and Data Link Layer PART II: Data Link Controls 5.4 Framing 5.5 Point-to-Point Protocol 5.6 High-Level Data Link Control 5.7 Link Sharing Using Statistical Multiplexing

  3. Chapter 5Peer-to-Peer Protocols and Data Link Layer 5.1 Peer-to-Peer Protocols and Service Models

  4. Layer-n peer processes execute protocol to provide service to layer-(n+1)       n + 1 peer process n + 1 peer process n peer process n peer process n – 1 peer process n – 1 peer process       Peer-to-Peer Protocols • Layer-(n+1) peer calls layer-n and passes Service Data Units (SDUs) for transfer SDU SDU PDU • Layer-n peers exchange Protocol Data Units (PDUs) to effect transfer • Layer-n delivers SDUs to destination layer-(n+1) peer

  5. Service Models • The service model specifies the information transfer service layer-n provided to layer-(n+1) • Two categories of service models: • Connection-oriented services • Connectionless services • A service offered by a given layer can include some of the following features: • Arbitrary message size or structure • Sequencing and Reliability • Timing, Pacing, and Flow control • Multiplexing • Privacy, integrity, and authentication

  6. n + 1 peer process send n + 1 peer process receive Layer n connection-oriented service SDU SDU Connection-Oriented Transfer Service • Connection Establishment phase • 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 • Data transfer phase • Exchange of SDUs • Disconnection phase • Example: TCP, PPP

  7. Connectionless Transfer Service • No Connection setup is required, simply send SDU • Each block of information is transmitted independently • All address information per block must be provided • Acknowledge is not required (Simple & quick) or required • Example: UDP, IP n + 1 peer process send n + 1 peer process receive Layer n connectionless service SDU

  8. 1 call = sequence of 1-byte messages (b) 1 voice mail= 1 message = entire sequence of speech samples (a) Message Size and Structure • What message size and structure will a service layer accept? • Different services impose restrictions on size & structure of data it will transfer • Single bit? Block of bytes? Byte stream? • Ex: Transfer of voice mail = 1 long message • Ex: Transfer of voice call = byte stream

  9. 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 • Blocking & Unblocking: a layer combines small messages into bigger blocks prior to transfer

  10. Reliability & Sequencing • Reliability: Are messages or information stream delivered error-free and without loss or duplication? • Sequencing: Are messages or information stream delivered in order? • ARQ protocolscombine error detection, retransmission, and sequence numbering to provide reliability & sequencing • Examples: TCP and HDLC

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

  12. 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

  13. 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

  14. 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 • Examples: IPSec, SSL

  15. 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?

  16. 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 Error Control in Data Link Layer (a) (b) Fig. 5.5

  17. 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 α End system β Physical layer Physical layer Physical layer Physical layer Network Error Control in Transport Layer • Transport layer protocol (e.g. TCP) sends segments across network and performs end-to-end error checking & retransmission • Usually, the underlying network is assumed to be unreliable Fig. 5.6

  18. 3 2 1 2 1 C 2 2 1 1 End System α End System β 1 1 1 2 2 2 3 3 3 2 4 1 4 2 2 2 1 2 1 2 1 1 1 3 Medium 2 1 B A Network 3 Network layer entity 4 Transport layer entity • Segments can experience long delays, can be lost, or arrive out-of-order because packets can follow different paths across network • The peer processes at the transport layer need to take into account all the characteristics of the network transfer service to be able to provide desired service to its higher layer

  19. Hop-by-hop Data Data Data Data 1 2 3 4 5 ACK/NAK ACK/NAK ACK/NAK ACK/NAK End-to-End versus hop-by-hop Approaches In situations where errors are likely, hop-by-hop error becomes necessary. Faster recovery End-to-end ACK/NAK In situations where errors are infrequent, end-to-end mechanisms are preferred. 1 5 2 3 4 Data Data Data Data

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

  21. Automatic Repeat Request (ARQ) • Suppose that the layer n+1 process requires a reliable data transfer service, and then layer n process would provide an ARQ protocol service • ARQ combines with error detection code and retransmission to ensure a sequence of information packets being delivered in order and without errors or duplications despite transmission errors & losses • Three basic types of ARQ protocols are investigated: • Stop-and-Wait ARQ • Go-Back N ARQ • Selective Repeat ARQ • Basic elements of ARQ: • ACKs (positive acknowledgments), • NAKs (negative acknowlegments) • Timeout Mechanism

  22. CRC Header Information packet Header CRC Control frame: ACKs Information frame 5.2.1 Stop-and-Wait ARQ Transmit a frame, wait for ACK Error-free Packet sequence Packet sequence Suppose that the layer n+1 requires a reliable data transfer service Layer n+1, PDU Information frame, PDU Receiver (Process B) Transmitter (Process A) Layer n A timer is set after a frame is transmitted Control frame

  23. (a) Frame 1 lost Time-out Time A Frame 0 Frame 1 Frame 1 Frame 2 ACK ACK B (b) ACK lost Time-out Time A Frame 0 Frame 1 Frame 1 Frame 2 ACK ACK ACK B Need for Sequence Numbers • In cases (a) & (b) the transmitting station A acts the same way • But in case (b) the receiving station B accepts frame 1 twice • Question: How does the receiver know the second frame is also frame 1? • Answer: Add frame sequence number in header • Slast is sequence number of most recent transmitted frame

  24. The transmitting station A misinterprets duplicate ACKs Incorrectly assumes second ACK acknowledges Frame 1 Question: How does the receiver know second ACK is for frame 0? Answer: Add frame sequence number in ACK header Rnext is the sequence number of next frame expected by the receiver to implicitly acknowledge the receipt of all prior frames Time-out Time A Frame 0 Frame 0 Frame 2 Frame 1 ACK ACK B Sequence Numbers (c) Premature Time-out

  25. 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 Numbering Suffices 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 Fig. 5.12 System State information in Stop-and Wait ARQ Error-free frame 1 arrives at receiver (1,0) (1,1)

  26. 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

  27. Ignore ACK 1 Slast:01 Slast=1 Time-out Time-out Rnext=1 Rnext:1 Fr 1 Fr 0 Fr 0 Fr 1 ACK 1 ACK 1 Slast=0 Slast=0 Rnext=1 Rnext: 01 Discard Frame 0 Discard Frame 1 Stop-and-Wait ARQ Example Slast=0 A B Error Frame Transmitter Wait state • If timeout expires • retransmit frame and reset timer • If ACK received: • If sequence number is incorrect or if errors detected: ignore ACK Receiver Always in Ready State • If no errors detected and wrong sequence number • discard frame • send ACK frame with Rnext • If errors detected • discard frame

  28. Applications of Stop-and-Wait ARQ • IBM Binary Synchronous Communications protocol (Bisync): character-oriented data link control • Xmodem: modem file transfer protocol • Trivial File Transfer Protocol (RFC 1350): simple protocol for file transfer over UDP

  29. Last frame bit enters channel ACK arrives First frame bit enters channel Channel idle while transmitter waits for ACK t A B t First frame bit arrives at receiver Last frame bit arrives at receiver Receiver processes frame and prepares ACK Performance Issues • 1000 bit frame @ 1.5 Mbps • If the time waiting for ACK = 40 ms, then efficiency = 1/60= 1.6% • If the time waiting for ACK = 1 ms, then efficiency =2/3 = 66.67% Fig. 5.13 Stop-and-Wait ARQ is inefficient when the time to receive an ACK Is large compared to the frame transmission time

  30. t0 = total time to transmit 1 frame A tproc B tprop tprop tproc tack frame tftime Delay Components in Stop-and-Wait ARQ bits/info frame bits/ACK frame delay components channel transmission rate

  31. Transmission Efficiency of Stop-and-Wait ARQ in Error-free channel Effective Information Transmission rate: bits for header & CRC Transmission efficiency η0: Effect of frame overhead Effect of Delay-Bandwidth Product Effect of ACK frame

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

  33. Transmission Efficiency of Stop-and-Wait ARQ in Channel with Errors • Let 1 – Pf = probability frame arrives without errors • Avg. number of transmissions for correct reception is 1/ (1–Pf ) • If 1 – Pf = 0.1, then on average a frame will have to be transmitted 10 times to get through • The Stop-and-Wait ARQ on average requires tsw = t0/(1 – Pf) seconds to get a frame through Effect of frame loss

  34. Example: Effect of Bit Error Rate nf=1250 bytes = 10,000 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 nf p approach 1

  35. Midterm Exam and Final Exam • Midterm: • Time: December 5 (Thursday) or 6, 2013 • Scope: Chapters 1 – 3 and Chapter 5; all contents given in the class before the beginning of December • Final Exam: • Time: January 9 (Thursday) or 10, 2014 • Scope: Chapter 5 – 6 and Some in Chapter 4 and Chapter 7; all after the end of November

  36. 5.2.2 Go-Back-N ARQ • Improve Stop-and-Wait ARQ by allowing the transmitter to continue sending frames to keep channel busy while the transmitter waits for acknowledgements • In Go-Back-N ARQ pipelines, a window size Ws, the maximum number of frames that can be outstanding without acknowledgement, is chosen larger than the delay-bandwidth product to ensure that the channel can be kept busy • Use m-bit sequence numbering from 0 to 2m-1 maximum • When will the ARQ protocol go back N? and N = ? • If ACK for oldest frame arrives before window is exhausted, frames can continue be transmitted • If window is exhausted and the timer is out, pull back and retransmit all outstanding frames

  37. 4 frames are outstanding; 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 The receiver ignores frame 3 and all subsequent frames because of out of sequence frames ACK1 ACK2 ACK4 ACK5 ACK3 ACK7 ACK6 ACK9 ACK8 Rnext 0 0 1 2 3 3 3 4 5 6 7 8 9 Go-Back-N ARQ • Frame transmission are pipelinedto keep the channel busy • Frame with errors and subsequent out-of-sequence frames are ignored • Transmitter is forced to go back when window of 4 is exhausted Pipelined Pipelined

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

  39. 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 commence • Use a timeout mechanism with each frame • When timeout expires, resend all outstanding frames

  40. Receiver Transmitter 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 Sequence Number allowed Slast+Ws-1 Go-Back-N Transmitter & Receiver 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 the receive window slides forward by one

  41. 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 Ws ≦ 2m– 1 *Note that the modular 2m arithmetic is used here

  42. Go-Back-N ARQ Protocol • Notice that the modulo 2m arithmetic is used here. • The transmitter is in ready state or block state. • If the transmitter is in the ready state waiting for a request from its higher layer. If there is request, it sends the frame with sequence number Srecent and sets the timer. • If Srecent= Slast+Ws-1, then the send window becomes empty and the transmitter goes into the blocking state. • If an error-free ACK frame is received with Rnext in the range between Srecent and Slast, the send window slides forward by setting Slast = Rnext and the maximum window size is Slast+Ws-1. • If the Rnext is outside the range from Srecent to Slast, the frame is discarded and no further action is taken.

  43. Go-Back-N ARQ Protocol • The transmitter is in block state, that is Srecent= Slast+Ws-1, denoting the send window becomes empty, and the transmitter refused to accept requests for packet transfer from the upper layer. • If a timer expires, the transmitter resends the corresponding packet and resets the timer. • If an error-free ACK frame is received with Rnext in the range between Srecent and Slast, the send window slides forward by setting Slast = Rnext and the maximum window size is Slast+Ws-1, then changing to the ready state. • If the Rnext is outside the range from Srecent to Slast, the frame is discarded and no further action is taken.

  44. Go-Back-N ARQ Protocol • The receiver is always in the ready state waiting for a notification of an arriving frame from the lower layer. • When a frame arrives, if no errors are detected and the sequence number is Rnext, then the frame is accepted, the sequence number is incremented to Rnext +1, an ACK frame is transmitted with sequence number Rnext +1, and the packet is delivered to its higher layer. • If the received frame is correct but with wrong sequence number, the frame is discarded and an ACK is sent with sequence number Rnext. • If an erroneous frame is received, the frame is discarded and no further action is taken.

  45. M = 22 = 4, Go-Back-3: Transmitter goes back 3 fr 0 fr 1 fr 0 fr 2 fr 2 fr 1 Time A But notice that the maximum sequence number can be from 0 to 2m-1 ACK2 ACK3 ACK1 B Receiver has Rnext= 3 , so it rejects the old frame 0, 1, 2, altogether. Rnext 0 1 2 3 3 Maximum Allowable Window Size is Ws = 2m-1 Transmitter goes back 4 and retransmits frame 0 - 3 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, and it regards this frame 0 is a new frame 0. But it is actually the old frame 0. It is a mistake. Therefore, Ws < 2mand the maximum allowable window size is Ws = 2m-1 Rnext 0 1 2 3 0 fr 3 ACK3

  46. SArecent RAnext Receiver Transmitter Transmitter Receiver SBrecent RBnext “B” Receive Window RBnext ACK Piggybacking in Bidirectional GBN “A” Receive Window Note 1: Out-of-sequence error-free frames discarded after Rnext examined RAnext “A” Send Window “B” Send Window ... ... Note 2: If no information frames are scheduled, the receiver can send the ACK timer. When the ACK timer expires a control frame conveying ACK is transmitted SAlast+WAs-1 SAlast SBlast SBlast+WBs-1 Buffers Buffers SAlast SBlast Timer Timer SAlast+1 SBlast+1 Timer Timer ... ... SArecent Timer Timer SBrecent ... ... SAlast+WAs-1 SBlast+WBs-1 Timer Timer

  47. 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

  48. Tproc Tout Tprop Tf Tprop Tf Required Timeout & Window Size • Timeout value should allow for: • Two propagation times + 1 processing time: 2 Tprop + Tproc • A frame that begins transmission at the receiver right before our frame arrives; one Tf (as the worst case !) must be counted • Next frame carrying the piggybacked ACK takes the second Tf • Ws should be large enough to keep channel busy for Tout Tout = 2 Tprop + 2 Tf +Tproc

  49. Required Window Size for Delay-Bandwidth Product

  50. Efficiency of Go-Back-N • GBN has a best possible efficiency, if Ws large enough to keep channel busy and the channel is error-free, namely, 1-n0/nf • If the channel is erroneous and assume that the frame loss probability is Pf, then time to deliver a frame successfully is tf + PfWstf /(1-Pf), where tf =nf/R • Notice that the dela-bandwidth product determines the Ws

More Related