1 / 14

Data Link Layer

Data Link Layer. Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided to the network layer unacknowledged connectionless service acknowledged connectionless service acknowledged connection-oriented service

jola
Download Presentation

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. Data Link Layer • Objective: to achieve reliable and efficient communication between 2 adjacent machines • Data link layer design issues • services provided to the network layer • unacknowledged connectionless service • acknowledged connectionless service • acknowledged connection-oriented service • call set-up • transmission • call release

  2. Data Link Layer (cont’d) • Framing • character count • use a field in the header to indicate the number of characters in the frame • e.g. 512345678980123456 • unreliable and rarely used • starting & ending characters, with character stuffing • STX and ETX are used for frame synchronization • DLE and DLE insertion are used for data transparency

  3. Data Link Layer (cont’d) • Framing • starting & ending characters/flags, with bit stuffing • 01111110 as flag byte (flag pattern) for frame and character sync. (for beginning and end) • zero bit insertion (bit stuffing) to achieve data transparency -- to insert a 0 after 5 contiguous 1’s • e.g. original data 011011111111111111110010 data sent 011011111011111011111010010 data stored 011011111111111111110010 • physical layer (bit) encoding violation • hybrid methods (char. count with one of the others)

  4. Data Link Layer (cont’d) • Error control • error detection • ACK’s and NACK’s • time-out mechanism • sequence numbers • Flow control • for speed mismatch (sender faster than receiver), finite receiver buffer or occasional unavailability of the receiver • feedback mechanism is typically required

  5. Data Link Layer (cont’d) • Error detection and correction • causes of errors • random vs. bursty errors • error-correcting codes vs. error-detecting codes • Error-correcting codes • codeword (m data-bits + r check bits; let n=m+r) • Hamming distance (H.D.) between 2 codewords • Hamming distance of the complete code: the min. Hamming distance between any 2 distinct codewords

  6. Data Link Layer (cont’d) • Error-correcting codes (cont’d) • to detect d errors required a distance d+1 code (e.g. d =1 for parity check where H.D.=2) • to correct d errors requires a distance 2d +1 code e.g. 0000000000 0000011111 1111100000 1111111111 • a lower bound on r to correct any single-bit error: Each of the 2m legal messages has n illegal codewords at a distance of 1 from it. Then 2m(n+1)  2n, and 2m(m+r+1)  2m+r. Consequently, m+r+1  2r.

  7. Data Link Layer (cont’d) • Error-correcting codes (cont’d) • Hamming code (corrects only single-bit errors) e.g. m = 7. Then 7 + r + 1  2r, and consequently r  4. Consider an ASCII code 1001000, where even parity is adopted. Then, arrange the data and error-correcting bits as follows. 20 21 22 23 X X 1 X 0 0 1 X 0 0 0 r1 r2 m1 r3 m2 m3 m4 r4 m5 m6 m7

  8. Data Link Layer (cont’d) • Error-correcting codes (cont’d) • Hamming code (cont’d) 20 21 22 23 (position) r1 r2 r3 r4 (check bits) (3) m1 1 1 (5) m2 0 0 (6) m3 0 0 (7) m4 1 1 1 (9) m5 0 0 (10) m6 0 0 (11) m7 0 0 0 Consequently, r1= 0, r2 = 0,r3 = 1 and r4 = 0.

  9. Data Link Layer (cont’d) • Error-correcting codes (cont’d) • Hamming code (cont’d) • to correct at most k consecutive bit errors n k order of transmission If each row contains at most 1 bit error, then the error(s) can be corrected.

  10. Data Link Layer (cont’d) • Error-detecting codes • parity check • block sum check • cyclic redundancy code (CRC) • using methods based upon polynomial codes which is more efficient to detect error bursts • a set of check digits is generated and appended to the end of each frame to be transmitted • the receiver performs a similar computation on the message and the check bits • if an error is found, then claim error(s); otherwise, claim correctness (true with a high probability)

  11. Data Link Layer (cont’d) • Error-detecting codes (cont’d) • cyclic redundancy code (cont’d) • theory behind M(x) = an m-bit number (message) G(x) = an (r+1)-bit number (generator/divisor) R(x) = an r-bit number (remainder based on modulo-2 arithmetic) Q(x) = quotient Property: If M(x)*xr/G(x) = Q(x) + R(x)/G(x), then [M(x)*xr + R(x)]/G(x) = Q(x). Proof: [M(x)*xr + R(x)]/G(x) = Q(x) + R(x)/G(x) + R(x)/G(x) = Q(x)

  12. Data Link Layer (cont’d) • Error-detecting codes (cont’d) • cyclic redundancy code (cont’d) • algorithm • sender • append r zeros to M(x) (M(x) is multiplied by xr) • divide M(x)*xr (using modulo-2 arithmetic/bit-wise XOR) by G(x) to calculate R(x) • append R(x) to M(x) and transmit • receiver • divide the received info. (M(x)*xr+R(x)) by G(x) • if the remainder is 0, OK; otherwise, report error(s)

  13. Data Link Layer (cont’d) • Error-detecting codes (cont’d) • cyclic redundancy code (cont’d) • example (Fig. 3-7, p. 189)

  14. Data Link Layer (cont’d) • Error-detecting codes (cont’d) • cyclic redundancy code (cont’d) • G(x) of K bits should detect • all single-bit errors • all double-bit errors • all odd number of bit errors • all error bursts with length < K • most error bursts with length K • example CRC • CRC-16 • CRC-CCITT • CRC-32

More Related