The Parity Bit: Checking for Errors

 

Suppose you are transmitting data over a telephone line, say, or even within the computer system itself.  How do you know it arrived safely – that is, that nothing was lost or garbled?  Sometimes data is lost in transit, owing to bit synchronization, hardware failure, and the like.

To signal the computer that the bits in a byte have stayed the way they are supposed to, another bit is added to the byte as a check.  This bit is called a parity bit or check bit.  Thus, in an eight-bit EBCDIC byte, the parity bit is a ninth bit.

       As figure 4-7 shows, the parity bit stored with each byte alerts the computer system if any bits are flawed or missing because – since we are using an odd parity system – the number of 1 bits must add up to an odd number.  (If even parity were used, the number of 1 bits would have to add up to an even number.   Computers vary: some use odd parity, some use even.)


       As you might suspect, a parity check is not infallible.  For instance, for any of the letters in Figure 4-7, if two 1s were dropped, the number of 1 bits would still add up to an odd number – and the computer would not notice that the byte was erroneous.  But two bit failures within one byte in one move are not likely to occur.