Download presentation
Presentation is loading. Please wait.
Published byOsborn Webb Modified over 6 years ago
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 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 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 data sent data stored 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 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 , where even parity is adopted. Then, arrange the data and error-correcting bits as follows. X X X X 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) (position) r r r r4 (check bits) (3) m (5) m (6) m (7) m (9) m (10) m (11) m 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)*2r/G(x) = Q(x) + R(x)/G(x), then [M(x)*2r + R(x)]/G(x) = Q(x). Proof: [M(x)*2r + 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 by2r) divide M(x)*2r (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)*2r+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
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.