Error Detection and Correction Methods
The Data Link Layer is responsible for reliable data transfer between adjacent nodes. A critical aspect of this reliability is handling errors that may occur during transmission. Error detection identifies when errors have occurred, while error correction rectifies those errors.
One-Dimensional Parity Method
The one-dimensional parity method is a simple error detection technique. A single parity bit is appended to a block of data (a byte or a word) to make the total number of 1s in the block either even or odd, depending on the agreed-upon parity scheme.
Definition: A parity bit is an extra bit added to a block of data to detect errors. It ensures that the total number of 1s in the data block (including the parity bit) is either even (even parity) or odd (odd parity).
- Even Parity: The parity bit is set to 0 if the count of 1s in the data is even, and to 1 if the count of 1s is odd. This makes the total count of 1s (data + parity) even.
- Odd Parity: The parity bit is set to 0 if the count of 1s in the data is odd, and to 1 if the count of 1s is even. This makes the total count of 1s (data + parity) odd.
Example:
- Original data: 1011001 (four 1s)
- Even Parity: Parity bit is 0 (total 1s = 4). Transmitted: 10110010
- Odd Parity: Parity bit is 1 (total 1s = 5). Transmitted: 10110011
Detection Capability:
- Can detect all single-bit errors. If one bit flips, the parity check at the receiver will fail.
- Cannot detect an even number of bit errors (e.g., two bits flip). If two bits flip, the parity count remains the same, leading to an undetected error.
- No error correction capability.
Two-Dimensional Parity Method
Also known as Longitudinal Redundancy Check (LRC) or block parity, this method extends the one-dimensional parity concept to a block of data (e.g., multiple bytes). It arranges data into a table (rows and columns) and calculates a parity bit for each row and each column.
Mechanism:
- The data is organized into a block of m rows and n columns.
- A parity bit is calculated for each row, forming a parity column.
- A parity bit is calculated for each column, forming a parity row (often called the Frame Check Sequence or FCS for the block).
- The entire block, including parity row and column, is transmitted.
Example (Even Parity):
Consider a 3x4 data block. For even parity, we calculate parity for each row and column.
| Bit 1 | Bit 2 | Bit 3 | Bit 4 | Row Parity |
|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 |
In the table above, the last column represents the row parity bits (RP), and the last row (excluding the