1 / 148

Unit 3

Unit 3. Data link layer. Topics. Data link layer design issues Error detection and correction Elementary data link protocols Sliding window protocols Example data link protocols HDLC LAP. Data link layer design issues. Data link layer design issues.

Télécharger la présentation

Unit 3

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. Unit 3 Data link layer

  2. Topics • Data link layer design issues • Error detection and correction • Elementary data link protocols • Sliding window protocols • Example data link protocols • HDLC • LAP

  3. Data link layer design issues

  4. Data link layer design issues • Services provided to the network layer • Framing • Error control • Flow control

  5. Data link layer design issues • Functions of data link layer • Providing a well-defined service interface to the network layer • Determining how the bits of the physical layer are grouped into frames • Dealing with transmission errors • Regulating the flow of frames so that slow receivers are not swamped by fast senders

  6. Data link layer design issues Relationship between packets and frames

  7. Services provided to the network layer • Main service to be provided is to transfer data from the network layer on the sending machine to the network layer on the destination machine. a) virtual communication b) actual communication

  8. Types of services provided • Three reasonable possibilities for data link services: 1. Unacknowledged connectionless service 2. Acknowledged connectionless service 3. Acknowledged connection-oriented service

  9. Unacknowledged connectionless service • Source sends independent frames to the destination without the destination acknowledging them. • No connection is established or released • If a frame is lost due to noise on the line, no attempt is made to recover it. • Appropriate when the error rate is very low • Appropriate for real-time traffic, such as speech, in which late data are worse than bad data • Mostly LANs use this.

  10. Acknowledged connectionless service • Next step to improve reliability • No connections used but for each frame received, the receiver sends an acknowledgement. • If frame is not received within specified time, the sender will retransmit it. • Suitable for communication over unreliable channels, such as wireless systems

  11. Acknowledged connection oriented service • The source and the destination establish a connection before data transfer. • Each frame sent is numbered • The data link layer guarantees that each frame sent is indeed received. • It also guarantees that each frame is received exactly once and all frames are received in the right order. • Connection-oriented service provides the network layer with the equivalent of a reliable bit stream.

  12. Acknowledged connection oriented service • The data transfer takes place by following three phases: • Connection establishment • One or more frames actually transmitted • Connection is released.

  13. Example of WAN subnet consisting of routers connected by point-to-point leased lines • Fig. placement of the data link protocol

  14. Framing • The data link uses the services provided by the physical layer. • The physical layer will not be perfect. It is up to the data link layer to detect, and if necessary, correct errors. • The usual approach is for the data link layer to break the bit stream up into discrete frames and compute the checksum for each frame. • When a frame arrives at the destination, the checksum is recomputed. • If the newly computed checksum is different from the one contained in the frame, the data link layer knows that an error has occurred and takes steps to deal with it.

  15. Framing • Breaking the bit stream into frames is called as framing. One way is to insert time gaps between frames. • But practically this technique does not work satisfactorily, because networks generally do not make any guarantees about timing. • So following methods are used: • Character count. • Starting and ending characters, with character stuffing. • Starting and ending flags, with bit stuffing. • Physical layer coding violations.

  16. Character count • In this method, a field in the header is used to specify the number of characters in the frame. • This number helps the receiver to know the number of characters in the frame following this count. • Disadvantage: • An error can change the character count • If the wrong character count is received then the receiver will get out of synchronization and will be unable to locate the start of next frame. • This method is rarely used in practice.

  17. Character count Character count Without error With one error

  18. Starting and ending character with character stuffing • Here starting character is used before the start of each frame and an end character is used at the end of each frame. • Flag byte FLAG. is used as starting and ending delimiter • Two consecutive flag bytes indicate the end of one frame and start of the next one. • Problem in case of programs or floating point numbers. • Solution is to use escape sequence (ESC) before flag. • The data link layer at the receiving side removes the ESC byte before sending to the network layer • Known as byte or character stuffing

  19. Starting and ending character with character stuffing Character (or) byte-oriented

  20. Disadvantages of character stuffing • A major disadvantage of using this framing method is that it is closely tied to 8-bit characters in general and the ASCII character code in particular. • We need a technique to allow arbitrary sized characters.

  21. Bit stuffing • This technique allows the frames to contain arbitrary number of bits and codes. • At the beginning and end of each frame , a specific bit pattern 01111110 called flag byte is transmitted. • Since there are six consecutive 1s in this byte, a technique called bit stuffing is used. • Whenever the sender data link layer detects the presence of 5 consecutive 1s in the data, it automatically stuffs a 0 bit in the outgoing bit stream. • De-stuffing is done at the receiving end.

  22. Bit stuffing • Original data (b) the data as they appear on the line • (c) the data as they are stored in the receivers memory after de-stuffing Flags (01111110) at the beginning and end Bit-oriented framing with bit stuffing

  23. Physical layer coding violations • This method of framing 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. • Normally, a 1 bit is a high-low pair and a 0 bit is a low-high pair. • The combinations high-high and low-low are not used for data and they can be used as frame boundaries.

  24. Error control The usual way to ensure reliable delivery is to provide the sender with some feedback about what is happening at the other end of the line. Data Frame Sender Receiver Acknowledgement (ACK) Or negative Acknowledgement (NAK)

  25. Error control An additional complication comes from the possibility that hardware troubles may cause a frame to vanish completely. In this case, the receiver will not react at all. This possibility is dealt with by introducing timers into the data link layer.

  26. Error control network layer network layer correct and ordered Sender Receiver retransmit if time-out ACK if correct error code packet ack physical layer physical layer error code

  27. Error control • However, when frames may be transmitted multiple times there is a danger that the receiver will accept the same frame two or more times, and pass it to the network layer more than once. • To prevent this from happening, it is generally necessary to assign sequence numbers to outgoing frames, so that the receiver can distinguish retransmissions from originals.

  28. Flow control • What to do with a sender that systematically wants to transmit frames faster than the receiver can accept them? • The usual solution is to introduce flow control to throttle the sender into sending no faster than the receiver can handle the traffic. • This throttling generally requires some kind of a feedback mechanism, so the sender can be made aware of whether or not the receiver is able to keep up.

  29. Flow control • Various flow control schemes are there, but most of them use the same basic principle. • The protocol contains well-defined rules about when a sender may transmit the next frame. • These rules often prohibit frames from being sent until the receiver has granted permission, either implicitly or explicitly. • Two techniques are there: • Stop and wait flow control • Sliding window flow control

  30. Error detection and correction

  31. Error detection and correction • Error correcting codes • Error detecting codes

  32. Error detection and correction • Transmission errors are going to be a fact of life for many years to come. (in local loop, in wireless communications) • As a result of the physical processes that generate them, errors on some media (e.g., radio) tend to come in bursts rather than singly. • Disadvantage: They are much harder to detect and correct than isolated errors.

  33. Error detection and correction Advantage: error model: bursty errors every packet would be in error bursty error, only one packet is incorrect

  34. Types of error • Single bit error: only one bit gets corrupted. Common in parallel transmission. • Multiple bit errors: more than one bits get corrupted • Burst error: more than one bit gets corrupted at the same place or at once. Very common in serial transmission of data. Occurs when the duration of noise is greater than the duration of one bit.

  35. Single bit error: • Multiple bit error:

  36. Burst error:

  37. Error detection techniques • Use of redundancy: additional bits are added to facilitate detection and correction of errors. • Popular techniques: • Simple parity check • Two-dimensional parity check • Checksum • Cyclic redundancy check

  38. Simple parity check • The simplest and most popular error detection technique • Appends a parity bit to the end of the data • Even parity: means the number of 1’s in the given word including parity bit should be even (2,4,6…) • Odd parity: means the number of 1’s in the given word including parity bit should be odd (1,3,5…)

  39. Performance of simple parity check • Simple parity check can detect all single bit errors. • It can also detect burst errors if the number of bits in error is odd. • The technique is not foolproof against burst errors that inverts more than one bits. If an even number of bits are inverted due to error, the error is not detected. • It cannot correct errors.

  40. Two dimensional parity check • Performance can be improved by using two dimensional parity check, which organizes the block of bits in the form of a table • Parity check bits are calculated for each row which is equivalent to a simple parity check bit • Parity check bits are also calculated for all columns • Both are sent along with the data • At the receiving end these are compared with the parity bits calculated on the receiving data

  41. Example

  42. LRC and VRC • Two sets of parity bits are generated known as: Longitudinal redundancy check (LRC) Vertical redundancy check (VRC)

  43. Performance • Extra overhead is traded for better error detection capability • Two-dimensional parity check significantly improves error detection capability compared to simple parity check • It can detect many burst errors but not all • It cannot correct the errors

  44. Checksum • At the senders end: • The data is divided into k segments each of m bits. • The segments are added using one’s complement arithmetic to get the sum • The sum is complemented to get the checksum • The checksum segment is sent along with the data segments

  45. Checksum • At the receiver’s end: • All received segments are added using one’s complement arithmetic to get the sum • The sum is complemented • If the result is zero the received data is accepted otherwise discarded

  46. Performance • The checksum detects all errors involving an odd number of bits • It also detects most errors involving even number of bits

  47. Cyclic redundancy check • One of the most powerful and commonly used error detecting codes • Basic approach: • Given a m-bit block of bit sequence, the sender generates an n-bit sequence known as frame check sequence (FCS), so that the resulting frame, consisting of m+n bits, is exactly divisible by some predetermined number • The receiver divides the incoming frame by that number and, if there is no remainder, assumes there was no error

  48. Cyclic redundancy check

  49. Modulo-2 arithmetic

More Related