Parity bit

Parity bits are a super simple way to check for an error when transferring data over a network / cable.

THe idea is that we add an extra bit to the end of our data, which is called the parity bit.

What does the parity bit store?

This parity bit will tell the receiver whether the number of 1s in the group of data is even or odd, through a single bit in each ‘group’ of data.

For example, if we have the data 1010, we have two 1s, which is an even number. So, depending on our convention, we could set the parity bit to 0 to indicate that the number of 1s is even. If we had the data 1011, we have three 1s, which is an odd number. So, we could set the parity bit to 1 to indicate that the number of 1s is odd.

How does the receiver use the parity bit?

When the receiver gets the data, it can count the number of 1s in the data and compare it to the parity bit. If the parity bit says there should be an even number of 1s, but the receiver counts an odd number, then it knows that something went wrong during the transmission of the data.

It can ask the sender to send it again.

Benefits of parity bits

Downsides of parity bits

Even parity

In even parity, the parity bit is a 0 if the number of 1s in the data is even, and a 1 if the number of 1s is odd.

Odd parity

In odd parity, the parity bit is a 1 if the number of 1s in the data is even, and a 0 if the number of 1s is odd.

flashcards

QuestionAnswer
Parity bitAn extra bit added to the end of a group of data during transmission, used to detect errors by indicating whether the number of 1s in the data is even or odd.
What does a parity bit store?A single bit that tells the receiver whether the number of 1s in the data group is even or odd.
How does the receiver use the parity bit?The receiver counts the number of 1s in the data and compares it to the parity bit. If they don’t match (e.g., parity says even but count is odd), an error is detected and the receiver can ask the sender to resend.
What is a benefit of using parity bits?They are simple and easy to implement, and can usually detect single-bit errors (when one bit is flipped during transmission). In ascii, the ‘free bit’ in each character can serve as a parity bit.
What is a downside of parity bits?If an even number of bits (e.g., two) are flipped, the parity bit will still appear correct, so the error is undetected.
Does a parity bit indicate which bit is wrong?No, it only indicates that something is wrong. It cannot correct errors, only detect them.
How does adding a parity bit affect bandwidth?It requires sending more data (the extra parity bit), which uses more bandwidth and can make data transfer slower.
Does a parity bit provide security?No, it only detects accidental errors, not malicious attacks that intentionally change the data.
Even parity ruleThe parity bit is 0 if the number of 1s in the data is even, and 1 if the number of 1s is odd.
Odd parity ruleThe parity bit is 1 if the number of 1s in the data is even, and 0 if the number of 1s is odd.