0
0
Computer Networksknowledge~6 mins

Error detection (parity, CRC, checksum) in Computer Networks - Full Explanation

Choose your learning style9 modes available
Introduction
When data travels from one place to another, it can get changed by mistakes or noise. Detecting these errors quickly helps computers know if the data is correct or needs to be sent again.
Explanation
Parity
Parity adds a single extra bit to a group of data bits to make the total number of 1s either even or odd. This helps detect if one bit has changed during transmission. It is simple but can only detect an odd number of errors.
Parity uses one extra bit to check if data has an odd number of errors.
Checksum
A checksum adds up all the data values in a message and sends this sum along with the data. The receiver adds the data again and compares it to the checksum to find errors. It can detect many errors but might miss some if errors cancel out.
Checksum sums data values to find errors by comparing sums at sender and receiver.
Cyclic Redundancy Check (CRC)
CRC treats data as a long binary number and divides it by a fixed binary number called a polynomial. The remainder of this division is sent with the data. The receiver does the same division and checks the remainder to detect errors. CRC is very good at finding common errors.
CRC uses division by a fixed number to create a strong error-detecting code.
Real World Analogy

Imagine sending a letter with a secret code that helps the receiver know if any words got smudged or changed during delivery. Different codes catch different kinds of mistakes, from simple typos to complex smudges.

Parity → A simple yes/no check like counting if the number of red balls in a bag is odd or even
Checksum → Adding up the prices of items on a shopping list to check if the total bill matches
Cyclic Redundancy Check (CRC) → Using a special math puzzle on the letter that only fits if no words were changed
Diagram
Diagram
┌───────────────┐       ┌───────────────┐       ┌───────────────┐
│   Sender      │       │   Channel     │       │   Receiver    │
│               │──────▶│ (Data + Code) │──────▶│               │
│ Data + Parity │       │               │       │ Check Parity  │
│ Data + Checksum│      │               │       │ Checksum Calc │
│ Data + CRC    │       │               │       │ Check CRC     │
└───────────────┘       └───────────────┘       └───────────────┘
This diagram shows data sent from sender to receiver with added error detection codes passing through a channel.
Key Facts
Parity bitA single bit added to data to make the number of 1s even or odd for error detection.
ChecksumA value calculated by adding data parts to detect errors during transmission.
Cyclic Redundancy Check (CRC)An error-detecting code using polynomial division to find errors in data.
Error detectionThe process of finding mistakes in data after transmission.
Common Confusions
Parity can detect all errors in data.
Parity can detect all errors in data. Parity only detects errors if an odd number of bits are wrong; it misses errors with an even number of bit changes.
Checksum always guarantees error-free data.
Checksum always guarantees error-free data. Checksum can miss errors if multiple errors cancel each other out, so it is not foolproof.
CRC is the same as checksum.
CRC is the same as checksum. CRC uses polynomial division and is more powerful and reliable than simple checksum methods.
Summary
Error detection helps find mistakes in data sent over networks to ensure accuracy.
Parity uses one bit to check for odd errors, checksum sums data values, and CRC uses math division for strong error detection.
Each method has strengths and weaknesses, with CRC being the most reliable among the three.