What is Parity bit?

A single bit added to a bit string of data to fix whether the number of 1s is even or odd. Making the number of 1s even is even parity, making it odd is odd parity, and the value is the exclusive OR of all the data bits. Checking the parity at the receiver detects an odd number of bit errors, but not an even number, and does not show which bit is wrong. It is used in UART communication and to protect memories and registers, and combining several parity bits with overlapping coverage gives error-correcting codes such as Hamming codes.

Japanese name: パリティビット

Parity bit appears in 15 practice questions across 9 topics, including System Architecture and Reliability, Information Theory and Coding Basics, Logic circuits.

Field: Information Theory and Coding Basics

How to calculate it

With even parity, the parity bit is 1 if the data contain an odd number of 1s and 0 if they contain an even number. For example, the 7-bit data 1011001 contain four 1s, so the even parity bit is 0. In hardware it is obtained simply by passing all the bits through a tree of exclusive-OR gates.

Vertical and horizontal parity

If data are arranged like a table and a parity bit is added to each row and each column, a single-bit error can be located, and corrected, as the intersection of the row and the column whose parity does not match. Combining several parity bits with overlapping coverage in this way is the basic idea behind error-correcting codes such as Hamming codes.

Parity in RAID

RAID 5 records the exclusive OR of the data at the same position on several disks as parity. If any one disk fails, the lost data can be recalculated as the exclusive OR of the remaining data and the parity. This shows that when it is known which part has been lost (an erasure), a single parity can even restore it.

Try it: questions about Parity bit

When an even parity bit is added to the 7-bit data 1011001, what is the parity bit?

  1. A1
  2. B0
  3. CAlways 1 regardless of the data
Show answer and explanation

Answer: B. 0

Even parity sets the parity bit so the total number of 1s, including it, is even. 1011001 already has four 1s, so the parity bit is 0. If the receiver counts an odd number of 1s, a single-bit error is detected, but two simultaneous errors go unnoticed and the faulty bit cannot be located. Memories that need correction use ECC such as Hamming codes, which combine multiple parity bits.

Eight data bits plus one even parity bit, 9 bits in total, are sent. If each bit is in error independently with a probability of 1%, which of the following is closest to the probability of an error that the parity check cannot detect?

  1. AAbout 0.01%
  2. BAbout 0.34%
  3. CAbout 8.6%
Show answer and explanation

Answer: B. About 0.34%

A parity check detects an odd number of bit errors, but an even number of bit errors leaves the number of 1s even or odd as before, so it cannot be detected. Almost all undetectable errors are 2-bit errors, whose probability is 9C2 × 0.01² × 0.99⁷ = 36 × 0.0001 × 0.932 ≈ 0.0034. The probability of errors in 4 or more bits is far smaller, so the total is still about 0.34%.

FAQ

How often do errors slip past a parity check?

If bits fail independently, the errors that slip past are mainly 2-bit errors. When the bit error rate is small, two bits failing at once is much less likely still, so parity is useful in many cases. Burst errors, in which noise hits several bits in a row, are prone to produce an even number of errors, however, and a CRC is better suited to them.

How do you choose between even and odd parity?

Their detection ability is the same. With odd parity the parity bit is 1 even when the data are all 0s, so a fault such as a broken line that leaves every bit stuck at 0 is also detected as an error. Both sides of the link agree in advance on which one to use.

Parity bit in the explanations

Questions that mention Parity bit (15)

  1. When an even parity bit is added to the 7-bit data 1011001, what is the parity bit?
  2. Eight data bits plus one even parity bit, 9 bits in total, are sent. If each bit is in error independently with a probability of 1%, which of the following is closest to the probability of an error that the parity check cannot detect?
  3. A single even parity bit is added to a bit string of data so that the number of 1s is even, and the receiver checks the number of 1s. Which of the following correctly describes this check?
  4. Four rows of 4-bit data were sent with an even parity bit for each row at its right end and a final row of even parity bits for each column (vertical and horizontal parity). The received bits were row 1: 1011 1, row 2: 0100 0, row 3: 1100 0, row 4: 0101 0 and parity row: 0100 (the rightmost bit of each row is its row parity). If exactly one bit is wrong, which of the following is its position?
  5. A SECDED code, which corrects 1-bit errors and detects 2-bit errors, is added to 32 bits of data. The number of check bits r of a Hamming code is the smallest value satisfying 2^r ≥ number of data bits + r + 1, and SECDED adds 1 bit of overall parity to this. Which of the following is the number of check bits needed?
  6. On a 115200 bps UART using 8 data bits, no parity and 1 stop bit (8N1), roughly how many bytes can be sent per second?
  7. RAID 5 is built from four disks, each capable of 200 random input/output operations per second (IOPS). Each small random write requires four I/O operations in total: reading the old data and the old parity, and writing the new data and the new parity; cache effects are ignored. When only writes are performed, which is the number of writes the whole RAID 5 array can process?
  8. When is the output of a two-input XOR (exclusive OR) gate 1?
  9. Which technique do NAND flash controllers use to cope with the increase in read errors that comes with storing more bits per cell?
  10. Why can't quantum error correction directly use the classical approach of making three copies of the data and taking a majority vote?
  11. In a 16-word-deep asynchronous FIFO, why are the write and read pointers made 5 bits, one bit more than the address?
  12. Which three parts make up an IEEE 754 floating-point number?
  13. Which describes RAID 1?
  14. RAID 5 is built from four disks with a capacity of 4 TB each. Which is the capacity available for storing data?
  15. RAID 6 is built from six disks with a capacity of 8 TB each. Which is the correct combination of the capacity available for storing data and the number of disks that can fail at the same time without losing data?

Books on Information Theory and Coding Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

RAID ECC (error-correcting code) Hamming code UART CRC (cyclic redundancy check) Quantum error correction Qubit Quantum superposition Asynchronous FIFO Gray code

Back to the glossary