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

Preview:

Citation preview

Data Link Layer

Data Link Layer Topics to Cover

Error Detection and Correction

Data Link Control and ProtocolsMultiple Access

Local Area Networks

Wireless LANs

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

Data can be corrupted during transmission.

Some applications require that errors be detected and corrected.

Note

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.

Redundancy

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

Error Detection

Simple Parity Check

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

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.

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.

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.

Two-dimensional Parity-check Code

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

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.

Data Link Layer Topics to Cover

Error Detection and Correction

Data Link Control and ProtocolsMultiple Access

Local Area Networks

Wireless LANs

Data Link Layer

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

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

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

Hamming code (Contd.)

Positions of Redundancy Bits

Redundancy Bits Calculation

Example

Error Correction using Hamming Code

Burst Error Correction

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

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

Example

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

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

Recommended