Topic 2 · Data transmission
Detecting errors
Why data gets corrupted, and how parity checks, checksums, echo checks, check digits, and ARQ catch the errors.
Why errors happen
On the way from sender to receiver, interference can flip bits, packets can be lost, or data can arrive out of order. The receiver needs a way to notice that the data it got is not what was sent.
Every method below works the same way: the sender adds some extra information calculated from the data, and the receiver recalculates it to see if it still matches.
Parity check
One bit of each byte is used as a parity bit. With even parity, the parity bit is set so the byte has an even number of 1s. With odd parity, the total number of 1s is odd.
The receiver counts the 1s. If the count is wrong for the agreed parity, an error has happened. Try flipping one bit below, then two.
Parity blocks
A parity block adds a parity bit to every byte (row) and a parity bit for every column. The column parity bits together form a parity byte under the block. If one bit is wrong, its row and its column will both fail, and where they cross shows exactly which bit to correct.
Checksum
The sender adds up the bytes in a block of data using an agreed calculation and sends the result, the checksum, with the data. The receiver does the same calculation. If its answer is different, the data is corrupted and is requested again.
Echo check
The receiver sends a copy of the data straight back. The sender compares the copy with the original. If they differ, the data is sent again.
Watch out. An echo check cannot tell whether the error happened on the way there or on the way back, and it doubles the data sent.
Check digits
A check digit is an extra digit at the end of a code, such as a barcode or ISBN, calculated from the other digits. It catches mistakes when the code is typed or scanned, such as a wrong digit or two digits swapped.
For ISBN-13, multiply the digits alternately by 1 and 3, add the results, and pick the check digit that makes the total a multiple of 10. Click a digit below to mistype it.
Automatic Repeat reQuest (ARQ)
ARQ uses acknowledgements and timeouts. After receiving a packet, the receiver checks it for errors (for example with a checksum) and sends back a positive acknowledgement if it is fine, or a negative acknowledgement if it is not.
If the sender gets a negative acknowledgement, or nothing at all before the timeout, it sends the packet again.
- 1Send packetStart the timer.
- 2Receiver checksError-checks the packet.
- 3AcknowledgePositive if correct, negative if not.
- 4Resend if neededNegative acknowledgement or timeout → send again.
Key terms
- Parity bit
- A bit added so the number of 1s is even (even parity) or odd (odd parity).
- Checksum
- A value calculated from a block of data and sent with it, so the receiver can check it.
- Echo check
- The receiver sends the data back so the sender can compare it with the original.
- Check digit
- A digit calculated from the other digits of a code, used to find data entry errors.
- ARQ
- Automatic Repeat reQuest: acknowledgements and timeouts trigger resending.
Check yourself
Using even parity, what parity bit is added to 1101001?Show answer
There are four 1s, already even, so the parity bit is 0.
Give one limitation of a parity check.Show answer
If an even number of bits are flipped, the count of 1s is still correct, so the error is not detected. It also cannot show which bit is wrong.
What happens in ARQ if the acknowledgement never arrives?Show answer
When the timeout is reached the sender assumes the packet was lost and sends it again.
Is a check digit used to detect transmission errors or data entry errors?Show answer
Data entry errors, such as mistyping or misscanning a code.