1 / 50

CEN 4500 Data Communications

CEN 4500 Data Communications. Chapter 3: The Data Link Layer. Instructor: S. Masoud Sadjadi http://www.cs.fiu.edu/~sadjadi/Teaching/ sadjadi At cs Dot fiu Dot edu. Recap: Data Link Layer. Data link layer is the second layer in the hierarchy of the hybrid reference model

phila
Download Presentation

CEN 4500 Data Communications

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. CEN 4500 Data Communications Chapter 3: The Data Link Layer Instructor: S. Masoud Sadjadi http://www.cs.fiu.edu/~sadjadi/Teaching/ sadjadi At cs Dot fiu Dot edu

  2. Recap: Data Link Layer • Data link layer is the second layer in the hierarchy of the hybrid reference model • Is to transform a raw transmission facility into a line that appears free of undetected transmission errors. CEN 4500, S. Masoud Sadjadi

  3. Recap: Data Link Layer • We will study algorithms for achieving reliable, efficient communication between two adjacent machines at the data link layer. • Adjacent machines are two machines that are connected by a communication channel that acts conceptually like a wire (e.g., coaxial cable, telephone line, or point-to-point wireless channel) • A channel is called “wire-like” if the bits are delivered in exactly the same order in which they are sent. • What makes this layer essential is the fact that • communication channels make errors occasionally, • they have only a finite data rate, and • there is a non-zero propagation delay CEN 4500, S. Masoud Sadjadi

  4. Agenda • Design Issues • Error Detection and Correction • Elementary Data Link Protocols • Sliding Window Protocols • Protocol Verification • Example Data Link Protocols • Summary CEN 4500, S. Masoud Sadjadi

  5. Data Link Layer Design Issues • Functions of the Data Link Layer • Providing a well-defined service to the network layer • Dealing with transmission errors • Regulating the flow of data so that slow receivers are not swamped by fast senders • Solution • Data link layer takes the packets from the network layer and encapsulates them into frames for transmission. • A frame contains header, payload (packet), and trailer. • Frame management is what data link layer is all about. CEN 4500, S. Masoud Sadjadi

  6. Functions of the Data Link Layer • Relationship between packets and frames. CEN 4500, S. Masoud Sadjadi

  7. Services Provided to Network Layer • The principle service is transferring data from the network layer on the source machine to the network layer on the destination machine. • (a) Virtual communication. • (b) Actual communication. CEN 4500, S. Masoud Sadjadi

  8. Reasonable Service Possibilities • Unacknowledged connectionless service • When error-rate is very low, so that the recovery is left to the higher layers • Also for real-time traffic, such as voice • Most LANs use this on the data link layer • Acknowledged connectionless service • Useful over unreliable channels, such as wireless • Acknowledged connection-oriented service • Each frame is numbered to guarantee exactly once and in-order delivery of frames • A reliable bit stream CEN 4500, S. Masoud Sadjadi

  9. Services Provided to Network Layer • Placement of the data link protocol. CEN 4500, S. Masoud Sadjadi

  10. Framing • Physical layer accepts a raw bit stream and attempt to deliver it to the destination. • It is up to the data link layer to detect and, if necessary, correct errors. • The usual approach is for data link layer to break the bit stream up into discrete frames and compute the checksum for each frame. • Framing Methods • Character count: count can be garbled • Flag bytes with byte stuffing: starting and ending delimiters • Starting and ending flags, with bit stuffing • Physical layer coding violations CEN 4500, S. Masoud Sadjadi

  11. Framing: Character Count • A character stream. • (a) Without errors. • (b) With one error. CEN 4500, S. Masoud Sadjadi

  12. Framing: Flag Bytes w/ Byte Stuffing • What if the flag byte’s bit pattern happens occurs in the date? Insert a escape byte (ESC) • (a) A frame delimited by flag bytes. • (b) Four examples of byte sequences before and after stuffing. CEN 4500, S. Masoud Sadjadi

  13. Framing: Bit Stuffing • Each frame starts and ends with a special bit pattern, 01111110 (in fact, a flag byte). • Whenever the sender’s data link layer encounters five consecutive 1s in the data, it automatically stuffs a 0 bit into the outgoing bit stream Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing. CEN 4500, S. Masoud Sadjadi

  14. Framing: Physical Layer Coding Violation • This method is only applicable to networks in which the encoding on the physical medium contains some redundancy. • For example, some LANs encode 1 bit of data by using 2 physical bits • A 1 bit is a high-low pair • A 0 bit is a low-high pair • So, every data bit has a transition in the middle: easy for the receiver to locate the bit boundaries. • High-high and low-low are not used for data! CEN 4500, S. Masoud Sadjadi

  15. Agenda • Design Issues • Error Detection and Correction • Elementary Data Link Protocols • Sliding Window Protocols • Protocol Verification • Example Data Link Protocols • Summary CEN 4500, S. Masoud Sadjadi

  16. Error Background • Transmission errors will be with us for a while • The local loops are still twisted copper pairs • Wireless communication is becoming more common • Error Property • As a result of the physical process that generates them, errors on some media (e.g., radio) tend to come in bursts rather than singly. • A burst error does not imply that all the bits are wrong; it just implies that at least the first and last are wrong • If errors were independent, most block would contain errors • However, they are much harder to correct than are isolated errors CEN 4500, S. Masoud Sadjadi

  17. Error Handling • Error Detection • On channels that are highly reliable, such as fiber, it is cheaper to detect errors and retransmit data • Error-detecting codes add enough redundant information to detect errors. • Error Correction • On channels such as wireless links that make many errors, retransmission does not make much sense • Error-correcting codes need to include enough redundant information not only to detect the error but also to correct it CEN 4500, S. Masoud Sadjadi

  18. Error-Detecting Codes: CRC • Cyclic Redundancy Check (CRC) • Also known as polynomial code • Based on treating bit strings as representations of polynomials with coefficients of 0 and 1 only • A k-bit frame is regarded as the coefficient list for a polynomial with k terms, ranging from xk-1 to x0. • For example, 110001 represents x5 + x4 + x0 • Polynomial arithmetic is done modulo 2 • There are no carries for addition or borrows for subtractions, both are identical to exclusive OR CEN 4500, S. Masoud Sadjadi

  19. The sender and receiver agree upon a generator polynomial,G(x), both of its high and low bits are 1 To compute the checksum for some frame with m bits, corresponding to the polynomial M(x), the frame must be longer than the generator polynomial We append a checksum to the end of the frame, so that the resulting polynomial is dividable by G(x) CRC Calculation of the polynomial code checksum. CEN 4500, S. Masoud Sadjadi

  20. Error-Correcting Code: Hamming Code • A frame consists of m data bits and r redundant, or check, bits. • n = m + r; called n-bit codeword. • Hamming Distance • The number of bit positions in which two codewords differ • If two codewords are a Hamming distance d apart, it will require d single-bit errors to convert one into the other. • Given the algorithm to compute the check bits, that are 2m legal codewords out of 2n codewords • The Hamming distance of the complete code (the list of legal codewords) is the minimun distance of any two codewords in the list. CEN 4500, S. Masoud Sadjadi

  21. Error-Correcting Code: Hamming Code • To detect d errors • you need a distance d + 1 code • If you receive a frame with d error, it will have an illegal codeword • To correct d errors • you need a distance 2d + 1 code • The closer legal codeword is the one to pick • Example, Parity Bit • The number of 1s are either even or odd • A code with single parity has distance 2 CEN 4500, S. Masoud Sadjadi

  22. How many check bit do we need to be able to correct a 1 bit error? For each 2m legal codewords, we need to have n illegal ones, so n + 1 codewords should be reserved 2m(n + 1) < 2n OR (m + r + 1) < 2r Error-Correcting Code: Hamming Code Hamming code to correct burst errors. CEN 4500, S. Masoud Sadjadi

  23. Agenda • Design Issues • Error Detection and Correction • Elementary Data Link Protocols • Sliding Window Protocols • Protocol Verification • Example Data Link Protocols • Summary CEN 4500, S. Masoud Sadjadi

  24. Elementary Data Link Protocols • An Unrestricted Simplex Protocol • Protocol 1 • A Simplex Stop-and-Wait Protocol • Protocol 2 • A Simplex Protocol for a Noisy Channel • Protocol 3 • Try the simulator on your own and discuss it in your study group! CEN 4500, S. Masoud Sadjadi

  25. Assumptions for the Protocols • The physical, data link, and network layers are independent processes that communicate by passing messages back and forth. • Machine A is trying to send a long message to machine B, using a reliable, connection-oriented service. • Later, we will consider the case where B will try to send a message to A simultaneously. • A has an infinite supply of data ready to be sent to B. • In a realistic situation, the data link layer will not sit in a tight loop waiting for an event, but it will be implemented using interrupts • Machines do not crash • As far as the data link layer is concerned, the packet passed across the interface to data link is pure data. CEN 4500, S. Masoud Sadjadi

  26. Protocol Definitions Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h. CEN 4500, S. Masoud Sadjadi

  27. Protocol Definitions(ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h. CEN 4500, S. Masoud Sadjadi

  28. Unrestricted Simplex Protocol:Protocol 1 CEN 4500, S. Masoud Sadjadi

  29. Simplex Stop-and-Wait Protocol:Protocol 2 CEN 4500, S. Masoud Sadjadi

  30. A Simplex Protocol for a Noisy Channel: Protocol 3 A positive acknowledgement with retransmission protocol. Continued  CEN 4500, S. Masoud Sadjadi

  31. A Simplex Protocol for a Noisy Channel : Protocol 3 (ctd.) A positive acknowledgement with retransmission protocol. CEN 4500, S. Masoud Sadjadi

  32. Agenda • Design Issues • Error Detection and Correction • Elementary Data Link Protocols • Sliding Window Protocols • Protocol Verification • Example Data Link Protocols • Summary CEN 4500, S. Masoud Sadjadi

  33. Sliding Window Protocols • Need for both way transmission of data • Using two simplex channels: two expensive • Using one channel in both directions (intermixed), with temporarily delaying the ack (piggybacking) • A One-Bit Sliding Window Protocol • Protocol 4 • A Protocol Using Go Back N • Protocol 5 • A Protocol Using Selective Repeat • Protocol 6 CEN 4500, S. Masoud Sadjadi

  34. Sliding Window Protocols (2) • On the sender side: the frames that are sent or can be sent (no ack yet). • On the receiver side: the frames that it may accept (discards other frames). A sliding window of size 1, with a 3-bit sequence number. (a) Initially. (b) After the first frame has been sent. (c) After the first frame has been received. (d) After the first acknowledgement has been received. CEN 4500, S. Masoud Sadjadi

  35. A One-Bit Sliding Window Protocol: Protocol 4 Continued  CEN 4500, S. Masoud Sadjadi

  36. A One-Bit Sliding Window Protocol : Protocol 4 (ctd.) CEN 4500, S. Masoud Sadjadi

  37. A One-Bit Sliding Window Protocol : Protocol 4 (2) Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case, if both sides starts sending simultaneously (similar situation can occur as a result of premature timeouts). The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet. CEN 4500, S. Masoud Sadjadi

  38. A Protocol Using Go Back N : Protocol 5 Pipelining and error recovery. Effect on an error when (a) Receiver’s window size is 1. (b) Receiver’s window size is large. CEN 4500, S. Masoud Sadjadi

  39. Sliding Window Protocol Using Go Back N : Protocol 5 Continued  CEN 4500, S. Masoud Sadjadi

  40. Sliding Window Protocol Using Go Back N: Protocol 5 Continued  CEN 4500, S. Masoud Sadjadi

  41. Sliding Window Protocol Using Go Back N: Protocol 5 Continued  CEN 4500, S. Masoud Sadjadi

  42. Sliding Window Protocol Using Go Back N : Protocol 5 CEN 4500, S. Masoud Sadjadi

  43. Sliding Window Protocol Using Go Back N: Protocol 5 • Simulation of multiple timers in software. CEN 4500, S. Masoud Sadjadi

  44. A Sliding Window Protocol Using Selective Repeat: Protocol 6 Continued  CEN 4500, S. Masoud Sadjadi

  45. A Sliding Window Protocol Using Selective Repeat : Protocol 6 (2) Continued  CEN 4500, S. Masoud Sadjadi

  46. A Sliding Window Protocol Using Selective Repeat: Protocol 6 (3) Continued  CEN 4500, S. Masoud Sadjadi

  47. A Sliding Window Protocol Using Selective Repeat: Protocol 6 (4) CEN 4500, S. Masoud Sadjadi

  48. A Sliding Window Protocol Using Selective Repeat : Protocol 6 (5) (a) Initial situation with a window size seven. (b) After seven frames sent and received, but not acknowledged. (c) Initial situation with a window size of four. (d) After four frames sent and received, but not acknowledged. CEN 4500, S. Masoud Sadjadi

  49. Problem with non-sequential receive • Suppose that we have a 3-bit seq. number • The sender is permitted to send up to 7 frames before it is required to wait for an ACK • Initially, we have (a) • The sender transmits 0, 1, 2, 3, 4, 5, and 6 • The receiver accepts any frame between 0 to 6 (inclusive) • All seven frames arrive correctly, so the receiver acknowledges them and advances its window (b) • Suppose that all the ACKs are lost • The sender times out and retransmits frame 0 • The receiver accepts this frame as it is within 7, 0, …, 5 • The receiver sends a piggybacked ACK for frame 6, since 0, …, 6 have been received previously. • The sender is happy that all its transmission are through and advances its window, and send 7, 0, …, 5. • Receiver then sends from 7 and the old frame 0 to the network!!! • Therefore, the network gets an incorrect frame and the protocol fails!! CEN 4500, S. Masoud Sadjadi

  50. Summary • Data Link Layer • The task of data link layer is to convert the raw bit stream offered by the physical layer into a stream of frames for use by the network layer. • Framing methods: character count, byte and bit stuffing. • It provides error control, flow control • Protocols • Protocols 1 to 6 • Sliding window protocols • Protocol Verification: FSMs & Petri Nets • Examples: SDLC, HDLC, and PPP. CEN 4500, S. Masoud Sadjadi

More Related