Error-detection and error-correction techniques

The link layer can detect and sometimes correct bit errors in transmitted data.

Basic idea

At the sender:

At the receiver:

Common techniques used for error detection in transmitted data:

More accurate error-detection methods reduce the chance of undetected errors, but they add more overhead (extra bits and processing).

Parity checks

Single parity bit

The simplest way to detect errors is to use a single parity bit.

If a message has d data bits, the sender adds a parity bit:

           d data bits         parity bit
                │                  │
                ↓                  ↓
┌───────────────────────────────┐┌───┐
│ 1 1 1 0 0 0 1 1 0 1 0 1 0 1 1 ││ 1 │
└───────────────────────────────┘└───┘

At the receiver:

Measurements have shown that:

Two-dimensional parity check

Two-dimensional parity check is an improved error detection method.

Step Explanations Data

Step 1: arrange the data

The data 101100010110111011001 is split into equal parts and arranged in a table (3 rows × 7 columns).

1 0 1 1 0 0 0
1 0 1 1 0 1 1
1 0 1 1 0 0 1

Step 2: add parity bits

Row parity: a parity bit is added at the end of each row.

1 0 1 1 0 0 0 1
1 0 1 1 0 1 1 1
1 0 1 1 0 0 1 0

Column parity: a final row of parity bits is added at the bottom.

1 0 1 1 0 0 0 1
1 0 1 1 0 1 1 1
1 0 1 1 0 0 1 0
1 0 1 1 0 1 0 0

Step 3: transmission

The sender transmits the full data (10110001 10110111 10110010 10110100), including the parity bits.

Step 4: checking at the receiver

The receiver rebuilds the same table and checks parity for every row and column.

If all rows and columns have even parity, the data is assumed to be correct and the parity bits are removed.

1 0 1 1 0 0 0 1
1 0 1 1 0 1 1 1
1 0 1 1 0 0 1 0
1 0 1 1 0 1 0 0

How is an error detected?

If a single bit changes during transmission:

The intersection of the faulty row and column shows the exact bit that is wrong, allowing it to be corrected.

Two-dimensional parity can:

This is called forward error correction (FEC). FEC techniques:

Checksumming

A common checksumming method is the Internet checksum (RFC 1071).

Algorithm 4-bit words example for simplicity

Sender

1. treat the data as a sequence of 16-bit words

0011
0101
0001

2. add the words using 1's complement arithmetic (wrapping any carry back into the sum

  0011
+ 0101
+ 0001
------
  1001

3. take the 1's complement of the final sum

1001 → 0110

4. store the result in the segment header as the checksum

0110

Receiver

1. add all of the received 16-bit words, including the checksum, using 1's complement arithmetic

  0011
+ 0101
+ 0001
+ 0110
------
  1111

2. take the 1's complement of the result

1111 → 0000

3. check whether the result is all 0 bits:

  • if it is, the checksum is valid (no error is detected)
  • if any bit is 1, the checksum indicates an error

since the result is all 0 bits, the checksum is valid

Advantages:

Disadvantages:

Checksumming is conceptually part of the transport layer and was designed to be implemented efficiently in software as part of the host operating system. For this reason, it uses a simple and fast error-detection technique.

Link-layer error detection can be implemented in dedicated network hardware (such as network adapters). Hardware can perform more complex error-detection algorithms efficiently, allowing stronger error protection than the simple transport-layer checksum.

Cyclic redundancy check (CRC)

A cyclic redundancy check (CRC) adds extra bits to data to detect errors during transmission.

CRC uses a special form of binary arithmetic known as polynomial arithmetic over GF(2) where:

The sender and receiver agree on a value G called the generator or generator polynomial.

Example for G = 1011:

          Sender

  Data bits to be protected
┌───────────────────────────┐
│         D = 1101          │
└───────────────────────────┘
      append r zeros
             ↓
┌───────────────────────────┐
│    D followed by zeros    │
│         1101 000          │
└───────────────────────────┘
              ↓
┌───────────────────────────┐
│        Divide by G        │
│     (generator = 1011)    │
└───────────────────────────┘
             ↓
     Remainder R = 001

      Transmitted frame:
┌───────────────────────────┐
│      Data D       │   R   │
│       1101        │  001  │
└───────────────────────────┘
       D || R (concat)

The receiver divides the received message by the same G:

             Receiver

          Received frame:
   ┌───────────────────────────┐
   │      Data D       │   R   │
   │       1101        │  001  │
   └───────────────────────────┘
           D || R (concat)
                ↓
   ┌───────────────────────────┐
   │        Divide by G        │
   │     (generator = 1011)    │
   └───────────────────────────┘
                ↓

         Modulo-2 division

                  1101001
                  ÷  1011
          ---------------
          remainder = 000

                ↓
   ┌───────────────────────────┐
   │      Check remainder      │
   └───────────────────────────┘
                |
       ─────────────────────
      │                     │
      ↓                     ↓
┌───────────────┐ ┌───────────────┐
│ Remainder = 0 │ │ Remainder ≠ 0 │
│ No error      │ │ Error         │
│ Accept frame  │ │ Reject frame  │
└───────────────┘ └───────────────┘

CRC works by enforcing a divisibility property: the sender chooses R so that the transmitted frame D || R produces a zero remainder when divided by G using modulo-2 arithmetic.

CRC is an error-detection mechanism, not an error-correction mechanism.

Previous Introduction to the link layer All ⏎ Next Multiple access links and protocols

A Kemar Joint