Download presentation

Presentation is loading. Please wait.

Published byShea Loar Modified over 3 years ago

1
5-1 Data Link Layer l Objective: to achieve reliable and efficient communication between 2 adjacent machines l Data link layer design issues n services provided to the network layer –unacknowledged connectionless service –acknowledged connectionless service –acknowledged connection-oriented service l call set-up l transmission l call release

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

3
5-3 Data Link Layer (cont’d) l Framing n 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 n physical layer (bit) encoding violation n hybrid methods (char. count with one of the others)

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

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

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

7
5-7 Data Link Layer (cont’d) l Error-correcting codes (cont’d) n Hamming code (corrects only single-bit errors) e.g. m = 7. Then 7 + r + 1 2 r, and consequently r 4. Consider an ASCII code 1001000, where even parity is adopted. Then, arrange the data and error-correcting bits as follows. 2 0 2 1 2 2 2 3 X X 1 X 0 0 1 X 0 0 0 r 1 r 2 m 1 r 3 m 2 m 3 m 4 r 4 m 5 m 6 m 7

8
5-8 Data Link Layer (cont’d) l Error-correcting codes (cont’d) n Hamming code (cont’d) 2 0 2 1 2 2 2 3 (position) r 1 r 2 r 3 r 4 (check bits) (3) m 1 1 1 (5) m 2 0 0 (6) m 3 0 0 (7) m 4 1 1 1 (9) m 5 0 0 (10) m 6 0 0 (11) m 7 0 0 0 Consequently, r 1 = 0, r 2 = 0, r 3 = 1 and r 4 = 0.

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

11
5-11 Data Link Layer (cont’d) l Error-detecting codes (cont’d) n 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)*x r /G(x) = Q(x) + R(x)/G(x), then [M(x)*x r + R(x)]/G(x) = Q(x). Proof: [M(x)*x r + R(x)]/G(x) = Q(x) + R(x)/G(x) + R(x)/G(x) = Q(x)

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

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

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

Similar presentations

OK

Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google