Parity bit

From Wikipedia, the free encyclopedia

(Redirected from Parity (telecommunication))
Jump to: navigation, search
7 bits of data byte with parity bit
even odd
0000000 00000000 10000000
1010001 11010001 01010001
1101001 01101001 11101001
1111111 11111111 01111111

A parity bit is a binary digit that indicates whether the number of bits with value of one in a given set of bits is even or odd. Parity bits are used as the simplest error detecting code.

There are two types of parity bits: even parity bit and odd parity bit. An even parity bit is set to 1 if the number of ones in a given set of bits is odd (making the total number of ones even). An odd parity bit is set to 1 if the number of ones in a given set of bits is even (making the total number of ones odd). Even parity is actually a special case of a cyclic redundancy check (CRC), where the 1-bit CRC is generated by the polynomial x+1.

Additionally, parity bits can be referred to as mark parity, where the parity bit is always 1, and space parity, where the bit is always 0.

Contents

If an odd number of bits (including the parity bit) are changed in transmission of a set of bits then parity bit will be incorrect and will thus indicate that an error in transition has occurred. Therefore, parity bit is an error detecting code, but is not an error correcting code as there is no way to determine which particular bit is corrupted. The data must be discarded entirely, and re-transmitted from scratch. On a noisy transmission medium a successful transmission could take a long time, or even never occur. Parity does have the advantage, however, that it is about the best possible code that uses only a single bit of space and it requires only a number of XOR gates to generate. See Hamming code for an example of an error-correcting code.

For example, our parity bit can be computed as follows assuming we are sending a simple 4-bit value 1001 (the parity bit is the leftmost bit of the sent/received values):


A computes even parity:  1^0^0^1 = 0
A sends:                 01001
B receives:              01001
B validates even parity: 1^0^0^1 = 0
A computes odd parity:  ~(1^0^0^1) = 1
A sends:                11001
B receives:             11001
B validates odd parity: ~(1^0^0^1) = 1

This mechanism enables the detection of single bit errors, because if one bit gets flipped due to line noise, there will be an incorrect number of ones in the received data. In the two examples above, B's calculated parity value matches the parity bit in its received value, indicating there are no single bit errors. Consider the following example assuming even parity when sending 4-bit value 0010 (the parity bit is the leftmost bit of the sent/received values):

A computes even parity:    0^0^1^0 = 1
A sends:                   10010
*** TRANSMISSION ERROR ***
B receives:                11010
B validates even parity:   1^0^1^0 = 0

B's calculated parity value (0) does not match the parity bit (1) in its received value, indicating the bit error. Here's the same example (even parity, value 0010) but now the parity bit itself gets corrupted:

A computes even parity:    0^0^1^0 = 1
A sends:                   10010
*** TRANSMISSION ERROR ***
B receives:                00010
B validates even parity:   0^0^1^0 = 1

Once again, B's calculated parity value (1) does not match the parity bit (0) in its received value, indicating the bit error.

There is a limitation to parity schemes. A parity bit is only guaranteed to detect an odd number of bit errors. If an even number of bits have errors, the parity bit records the correct number of ones, even though the data is corrupt. (See also error detection and correction.) Consider the same example as before (even parity, value 0010) with an even number of corrupted bits:

A computes even parity:    0^0^1^0 = 1
A sends:                   10010
*** TRANSMISSION ERROR ***
B receives:                11011
B validates even parity:   1^0^1^1 = 1

B's calculated parity value (1) matches the parity bit (1) in its received value, thereby failing to catch the two bit errors.

Because of its simplicity, parity is used in many hardware applications where an operation can be repeated in case of difficulty, or where simply detecting the error is helpful. For example, the SCSI bus uses parity to detect transmission errors, and many microprocessor instruction caches include parity protection. Because the I-cache data is just a copy of main memory, it can be thrown away and re-fetched if it is found to be corrupted.

In serial data transmission, a common format is 7 data bits, an even parity bit, and one or two stop bits. This format neatly accommodates all the 7-bit ASCII characters in a convenient 8-bit byte. Other formats are possible; 8 bits of data plus a parity bit can convey all 8-bit byte values.

In serial communication contexts, parity is usually generated and checked by interface hardware (e.g., a UART) and, on reception, the result made available to the CPU (and so to, for instance, the operating system) via a status bit in a hardware register in the interface hardware. Recovery from the error is usually done by retransmitting the data, the details of which are usually handled by software (e.g., the operating system I/O routines).

A "parity track" was present on the first magnetic tape data storage in 1951.

A parity block is used by certain RAID levels. Redundancy is achieved by the use of parity blocks. If a single drive in the array fails, data blocks and a parity block from the working drives can be combined to reconstruct the missing data.

Given the diagram below, where each column is a disk, assume A1 = 00000111, A2 = 00000101, and A3 = 0000000. Ap, generated by XORing A1, A2, and A3, will then equal 00000010. If the second drive fails, A2 will no longer be accessible, but can be reconstructed by XORing A1, A3, and Ap:

A1 XOR A3 XOR Ap = 00000101

            RAID array
 A1        A2        A3        Ap
 B1        B2        Bp        B3
 C1        Cp        C2        C3
 Dp        D1        D2        D3
Note: Data blocks are in the format A#, parity blocks Ap.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.