Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control...

30
Data Link Layer

Transcript of Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control...

Page 1: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Data Link Layer

Page 2: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Data Link Layer Topics to Cover

Error Detection and Correction

Data Link Control and ProtocolsMultiple Access

Local Area Networks

Wireless LANs

Page 3: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Error Detection

• Why we need it ?– To avoid retransmission of whole packet or

message• What to do if error detected ?

– Discard, and request a new copy of the frame:

• explicitly or implicitly

– Try to correct error, if possible

Page 4: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Data can be corrupted during transmission.

Some applications require that errors be detected and corrected.

Note

Page 5: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Types of Errors• Single Bit

Error– In a single-bit

error, only 1 bit in the data unit has changed.

Burst Error A burst error

means that 2 or more bits in the data unit have changed.

Page 6: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Redundancy

• To detect or correct errors, we need to send extra (redundant) bits with data.

Page 7: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Error Detection

Page 8: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Simple Parity Check

• A simple parity-check code is a single-bit error-detecting code in which n = k + 1.

Page 9: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Example• Let us look at some transmission scenarios. Assume the

sender sends the dataword 1011. The codeword created from this dataword is 10111, which is sent to the receiver. We examine five cases:

1. No error occurs; the received codeword is 10111. The syndrome is 0. The dataword 1011 is created.

2. One single-bit error changes a1 . The receivedcodeword is 10011. The syndrome is 1. No dataword is created.

3. One single-bit error changes r0 . The received codeword is 10110. The syndrome is 1. No dataword is created.

Page 10: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Example (contd.)4. An error changes r0 and a second error changes a3 . The received codeword is 00110. The syndrome is 0. The dataword

0011 is created at the receiver. Note that here the dataword is wrongly created due to the syndrome value. 5. Three bits—a3, a2, and a1—are changed by errors.

The received codeword is 01011. The syndrome is 1. The dataword is not created. This shows that the simple parity check, guaranteed to detect one single error, can also find any odd number of errors.

Page 11: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Performance

• A Simple parity check can detect all single-bit errors. It can detect burst errors only if the total number of errors in each data unit is odd.

Page 12: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Two-dimensional Parity-check Code

Page 13: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Two-Dimensional Parity

0 1 0 0 0 1 1 1

0 1 1 0 0 0 1 1

0 1 1 0 1 1 1 1

0 1 1 0 0 0 0 0

1 0 0 1 0 0 1 1

0 1 1 0 1 1 0 0

1 1 0 1 0 1 0 0

0 1

1

0 1

1

Page 14: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Performance

• 2D parity check increases the likelihood of detecting burst errors. As we have seen in the example given in the previous slide, a redundancy of n bits can easily detect a burst error of n bits. There is, however, one pattern of errors that remains un-detectable. If 2 bits in one data unit are damaged and 2 bits in exactly in the same positions in another data unit are also damaged, the checker will not detect an error.

Page 15: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Data Link Layer Topics to Cover

Error Detection and Correction

Data Link Control and ProtocolsMultiple Access

Local Area Networks

Wireless LANs

Page 16: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Data Link Layer

Page 17: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Error Correction

1. By retransmission– flow and error control protocols

2. Forward Error Correction (FEC)– require more redundancy bits– should locate the invalid bit or bits– n-bit code word contains m data bits + r

redundancy bitsn=m+r

– m+r+1 bits discoverable by r bits– 2r>=m+r+1

Page 18: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Data and redundancy bits

Number ofdata bits

m

Number of redundancy bits

r

Total bits

m + r

1 2 3

2 3 5

3 3 6

4 3 7

5 4 9

6 4 10

7 4 11

Page 19: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Hamming Code

• Hamming codes provide for FEC using a “Block Parity”– i.e, instead of one parity bit send a block of parity

bits• Allows correction of single bit errors• This is accomplished by using more than one

parity bit• Each computed on different combination of

bits in the data

Page 20: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Hamming code (Contd.)

Page 21: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Positions of Redundancy Bits

Page 22: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Redundancy Bits Calculation

Page 23: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Example

Page 24: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Error Correction using Hamming Code

Page 25: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Burst Error Correction

Page 26: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Hamming Distance• The Hamming distance between two words is

the number of differences between corresponding bits.

Let us find the Hamming distance between two pairs of words.1. The Hamming distance d(000, 011) is 2 because

2. The Hamming distance d(10101, 11110) is 3 because

Page 27: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

To guarantee the detection of up to s errors in all cases, the minimum

Hamming distance in a block code must be dmin = s + 1.

Note

Page 28: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

Example

Page 29: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

To guarantee correction of up to t errors in all cases, the minimum Hamming distance in a

block code must be dmin = 2t + 1.

Note

Page 30: Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.

A code scheme has a Hamming distance dmin = 4. What is the error detection and correction capability of this scheme?

SolutionThis code guarantees the detection of up to three errors(s = 3), but it can correct up to one error. In other words, if this code is used for error correction, part of its capability is wasted. Error correction codes need to have an odd minimum distance (3, 5, 7, . . . ).

Example