Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lecture #12: Data Link Layer. Error Control. C o n t e n t s l Services Provided by DLL l DLL data structures l Error Control Mechanisms –Error correcting.

Similar presentations


Presentation on theme: "1 Lecture #12: Data Link Layer. Error Control. C o n t e n t s l Services Provided by DLL l DLL data structures l Error Control Mechanisms –Error correcting."— Presentation transcript:

1

2 1 Lecture #12: Data Link Layer. Error Control. C o n t e n t s l Services Provided by DLL l DLL data structures l Error Control Mechanisms –Error correcting –Error detecting

3 2 DLL Services to the Network Layer Organizing the data transfer from source machine Network Layer to destination NL: l controls two interfaces - to the Network Layer (“upper”) and to the Physical Layer (lower”) l data on DLL level is presented by a bit stream in the Physical Layer interface and by a frame in the Network Layer interface l type of the DLL service vary between: –unacknowledged connectionless service –acknowledged connectionless service –acknowledged connection-oriented service

4 3 Note that undelivered data might be required on some upper layer, but DLL has the smallest re- transfer overload because it repeats only the missed frames Types of DLL Services l Unacknowledged connectionless service –no feedback upon delivery of the frames in the remote machine –no connection establishment before the exchange –application: by low error rate channels; real-time applications and wherever the system promptness dominates over the correctness l Acknowledged connectionless service –frames which delivery is not acknowledged for certain time-out can be retransmitted to the destination –application: unreliable channels such as wireless data transfer l Acknowledged connection-oriented service –3-phase transfer: connection establishment with initialization of parameters, allocation of local buffers etc.; frame[s] transmission and connection release –guarantees not only the frame delivery, but also the order of delivery 3/2

5 4 DLL Frames l Frame is the data structure to which DLL brakes the incoming bit stream provided by the physical layer. l Frames’ framing methods: –time gaps - inapplicable for any asynchronous transmission –character counting - very hard error recovering because of possible counter’s damage –framing characters with character stuffing - starting and stopping ASCII character sequences at the frame’s boundaries: starting characters DLE STX = “Data Link Escape” “Start of TeXt”starting characters DLE STX = “Data Link Escape” “Start of TeXt” stopping characters DLE ETX = “Data Link Escape” “End of TeXt”stopping characters DLE ETX = “Data Link Escape” “End of TeXt” stuffing sequence DLE for each incidental DLE sequence in the payloadstuffing sequence DLE for each incidental DLE sequence in the payload Application: limited; suitable for ASCII oriented applicationsApplication: limited; suitable for ASCII oriented applications –framing flags with bit stuffing... 3/3 3/4 5

6 5 DLL Frames –… framing flags with bit stuffing - starting and stopping bit sequences (“flags”) at the frame’s boundaries: start/stop bit pattern byte (6 “ 1 ”)start/stop bit pattern byte (6 “ 1 ”) stuffing bit “ 0 ” for each incidental sequence of 5 “ 1 ” in the payloadstuffing bit “ 0 ” for each incidental sequence of 5 “ 1 ” in the payload Application: universalApplication: universal –framing with redundant signal codes: possible when the physical layer can distinguish more than 2 conditions (“ 1 ”/” 0 ”) of the transferred signal; the exceeded signal states are used for flagging of the frames 3/5

7 6 Error Control l Two main mechanisms for error free transfer on DLL: –acknowledgement of each received frame –indexing of the sequence of outgoing frames l Acknowledged services require acknowledgement upon receiving of the frame. This mechanism includes: –sending acknowledgment frame from the receiver to the sender for each successfully received frame –initiation of one autonomous timer process by the sender for each outgoing frame - the going off the timer before the acknowledgement is interpreted by the sender as a transmission failure l Connection-oriented services require indexing of the outgoing frame sequence helps to keep up the consistency of the transmitted data in cases as: –repeated frames due to unacknowledged transmission –disordered frames due to transmission problems

8 7 Flow Control l Flow control synchronizes the rate at which frames are transmit between two heterogeneous computers in the case when faster sender transfers frame sequence to a slower receiver l Most developed control flow mechanisms are implemented in connection-oriented DLL protocols.

9 8 Error Codes - Main Terms l Codeword (CW): n bits, m bits data field (DF) + r bits error check (EC) redundancy l Hamming distance d = ||CW 1  CW 2 || - the number of different bits in two CWs. l ||{DF}|| = 2 m, however ||{EC}|| < 2 r - depending on the algorithm for check bits computation  list of the valid CWs - “complete code”. Hamming distance of complete code = min( ||CW i  CW j ||;  i, j: i  j ) Hamming distance of complete code = min( ||CW i  CW j ||;  i, j: i  j ) l d-tiple error in a CW: d bits of the original CW are received inverted mr n = m+r CW ECDF

10 9 Error Correction and Error Detection l Error-correcting codes: enough redundant information to reconstruct the original CW and its data field (DF) at the receiver. Application: simplex data channels that have no possibility for retransmission request. l Error-detecting codes: less redundant information that can only detect presence of corrupted bit[s] but is not enough to reconstruct the original CW. Application: more efficient than error- correction coding in all cases when feedback request is possible. l d-tiple error detecting needs coding of d+1 Hamming distance: thus after alterations of any d bits in a valid CW the obtained word is not a valid one (One more alteration could turn it in a valid one) l d-tiple error correction needs coding of 2d+1 Hamming distance: thus after alterations of any d bits in a valid CW the obtained word is still closer to the proper (original) CW in the list of legal words than any neighbor word of the list. Than the wrong CW can be replaced by the proper one.

11 10 Error Correcting Codes l For error-correcting code of distance 1: –2 m valid data fields –n illegal CWs at distance 1 of each valid CW –n+1 bit pattern needed to distinguish each valid CWs –2 n total bit patterns (all CWs)  one needs n: 2 m (n+1)  2 n  (m+r+1)  2 r  2 r +r+1  m –Examples: for m = 4 r min = 3; for r = 4 m max = 11 l Parity check: CW consists of check bits (c i ) and data bits (d i ) - the rest, Even(/odd) check sums modulo 2: s i =0(/1): 4c i =1, 2, 4, 8, (...powers of 2) 4d i =3, 5, 6, 7, … 4s 1 = c 1  d 3  d 5  d 7  d 9  …. 4s 2 = c 2  d 3  d 6  d 7  d 10  …. 4s 3 = c 4  d 5  d 6  d 7  d 12  …. mr n = m+r CWCW ECEC DFDF

12 11 Check Sums d i c 1 c 2 c 4 c 8 c 16 d i c 1 c 2 c 4 c 8 c 16 3= = = = = = = = = = = = = = s 1 := c 1  d 3  d 5  d 7  d 9  d 11  d 

13 12 Check Sums l Application: –mostly: correction of single isolated errors –correction of burst errors - only by matrix presentation of CWs: transmission of equi- significant bits of CWs and parity check of the completed CWs  transformation of a transmission burst error into single errors in sequence of CWs

14 13 Error Detecting Codes l Single block parity bit detects single error with unacceptably low probability (0.5) l n column parity bits in the last row of a n  k matrix block detect burst errors of length up to n. The full probability for error detection of this coding is 2 -n (the more parity bits the better detection) l Polynomial code (CRC - cyclic redundancy code) of length k. Based on presentation of bit strings as polynomials with binary coefficients: the k-bit string b k-1 b k-2 …b 1 b 0 is presented by the polynomial b k-1 x k-1 + b k-2 x k b 1 x + b 0

15 14 Cyclic Redundancy Code l Requisites: ¬m-bit message frame corresponding to polynomial M(x) ­r+1-bit generator sequence with corresponding generator polynomial G(x): r < m, b r =1 and b 0 =1 l Product: transmitted frame of size (m+r) bits containing the message and an r-bit checksum field. Transmitted frame polynomial form is T(x). The check sum field that turns guarantees that T(x) is dividable by the generator polynomial with a zero reminder (redundancy).

16 15 Cyclic Redundancy Code l CRC coding procedure consists of modulo 2 arithmetic operations: T(x)  2 r  G(x) = Q(x)  [ R(x)  G(x) ] and [for modulo 2 arithmetic  and (-) operations are equivalent; (-) operator does not exist]: [ T(x)  2 r ]  [ R(x)  G(x)] = Q(x) i.e. the expression T(x)  2 r  R(x) has to be dividable by G(x) with NO reminder (in case of correct transmission) quotient reminder generator polynomial

17 16 The divisor is going into the dividend if the last has as many bits as the former. Here  = 1 though < Cyclic Redundancy Coding coding G(x)G(x) M(x)M(x) Q(x)Q(x) R(x) {coding phase} R(x) {decoding phase} T(x)T(x) decoding

18 17 Cyclic Redundancy Decoding l Error pattern E(x): x i = 1 means that i-bit has been erroneously converted during transmission l Erroneously transmitted frame T e (x) = T(x)  E(x) l By CRC decoding T e (x)  G(x) = [T(x)  E(x)]  G(x)= E(x)  G(x) i.e. the error detection depends of whether the error pattern is dividable by the generator polynomial. Case study: ¶single errors: E(x)=x i. Detectable by any G(x) of more than 1 term; ·double errors: E(x)= x i + x j = x j (x i-j +1). Detectable by any G(x) that is not of type x(x k +1) for  k = 1, 2, …(i-j). ¸odd number errors: detectable by any G(x): G(x) = (x+1)G ´ (x) ¹burst errors of length k: E(x)= x i (x k-1 +…+1). Detectable by any G(x): G(x) = G ´ (x)+1 and k-1< r. Standard CRC polynomials: CRC12 = x 12 +x 11 +x 3 +x 2 +x bit character code CRC16 = x 16 +x 15 +x bit character code CRC-CCITT = x 16 +x 12 +x bit character code

19 18 Placement of the data link protocol. 3/3

20 19 3/3 Framing A character stream. (a) Without errors. (b) With one error.

21 20

22 21


Download ppt "1 Lecture #12: Data Link Layer. Error Control. C o n t e n t s l Services Provided by DLL l DLL data structures l Error Control Mechanisms –Error correcting."

Similar presentations


Ads by Google