Parity bit
A parity bit, or check bit, is a bit added to a string of binary code. Parity bits are a simple form of error detecting code. Parity bits are generally applied to the smallest units of a communication protocol, typically 8-bit octets (bytes), although they can also be applied separately to an entire message string of bits. The parity bit ensures that the total number of 1-bits in the string is even or odd. Accordingly, there are two variants of parity bits: even parity bit and odd parity bit. In the case of even parity, the parity bit is selected so the total number of set bits (including the parity bit) is even; if the number of bits set in the data is odd, the parity bit is set to 1 to... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
A parity bit, or check bit, is a bit added to a string of binary code. Parity bits are a simple form of error detecting code. Parity bits are generally applied to the smallest units of a communication protocol, typically 8-bit octets (bytes), although they can also be applied separately to an entire message string of bits. The parity bit ensures that the total number of 1-bits in the string is even or odd. Accordingly, there are two variants of parity bits: even parity bit and odd parity bit. In the case of even parity, the parity bit is selected so the total number of set bits (including the parity bit) is even; if the number of bits set in the data is odd, the parity bit is set to 1 to make the total even. In the case of odd parity, the coding is reversed: the parity bit is chosen so the total number of set bits (including the parity bit) is odd. Parity is a special case of a cyclic redundancy check (CRC), where the 1-bit CRC is generated by the polynomial x+1. ==Parity== In mathematics parity can refer to the evenness or oddness of an integer, which, when written in its binary form, can be determined just by examining only its least significant bit. In information technology parity refers to the evenness or oddness, given any set of binary digits, of the number of those bits with value one. Because parity is determined by the state of every one of the bits, this property of parity—being dependent upon all the bits and changing its value from even to odd parity if any one bit changes—allows for its use in error detection and correction schemes. In telecommunications the parity referred to by some protocols is for error-detection. The transmission medium is preset, at both end points, to agree on either odd parity or even parity. For each string of bits ready to transmit (data packet) the sender calculates its parity bit, zero or one, to make it conform to the agreed parity, even or odd. The receiver of that packet first checks that the parity of the packet as a whole is in accordance with the preset agreement, then, if there was a parity error in that packet, requests a retransmission of that packet. In computer science the parity stripe or parity disk in a RAID provides error-correction. Parity bits are written at the rate of one parity bit per n bits, where n is the number of disks in the array. When a read error occurs, each bit in the error region is recalculated from its set of n bits. In this way, using one parity bit creates "redundancy" for a region from the size of one bit to the size of one disk. See below. In electronics, transcoding data with parity can be very efficient, as XOR gates output what is equivalent to a check bit that creates an even parity, and XOR logic design easily scales to any number of inputs. XOR and AND structures comprise the bulk of most integrated circuitry. ==Error detection== "K" character (4Bh = 1001011b) framed as 1 start bit, 7 data bits (least significant bit first), even parity, and 1 stop bit: 7E1. If an odd number of bits (including the parity bit) are transmitted incorrectly, the parity bit will be incorrect, thus indicating that a parity error occurred in the transmission. The parity bit is suitable only for detecting errors; it cannot correct any errors, as there is no way to determine which particular bit is corrupted. The data must be discarded entirely, and retransmitted from scratch. On a noisy transmission medium, successful transmission can therefore take a long time or even never occur. However, parity has the advantage that it uses only a single bit and requires only a number of XOR gates to generate. See Hamming code for an example of an error-correcting code. Parity bit checking is used occasionally for transmitting ASCII characters, which have 7 bits, leaving the 8th bit as a parity bit. For example, the parity bit can be computed as follows. Assume Alice and Bob are communicating and Alice wants to send Bob the simple 4-bit message 1001. 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, Bob's calculated parity value matches the parity bit in its received value, indicating there are no single bit errors. Consider the following example with a transmission error in the second bit using XOR: There is a limitation to parity schemes: a parity bit will only 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 but with an even number of corrupted bits: Bob observes even parity, as expected, thereby failing to catch the two bit errors. ==Error correction== A single parity bit, by itself, cannot perform error correction. However, if errors are located by some other means, then a parity bit may be used as a single-erasure code: if a set of bits has known parity, and any single one is missing, it is simple to deduce the value of the missing bit. For example, if one of set of data blocks is identified as corrupt by a per-block checksum, then its contents may be recovered from the other blocks and a parity block. This is described in more detail in below. Multiple parity bits form the basis of many error-correction schemes, such as Hamming codes and the Adaptive Cross-Parity system used by the IBM 3480 family of tape drives . For example, early single-level cell flash memory chips implemented single error correction over blocks of 512 bytes (2 12 = 4096 bits) by assigning each bit a 12-bit address. For each address bit, two parity bits were computed: one for the 2048 bits with that address bit clear, and a second for the 2048 bits with that address set. The resultant 24 parity bits were stored in the "out of band" storage associated with each block. Obviously, if any single data bit were in error, it would result in a parity violation for each of the 12 parity sets it was a member of, giving its address and making correction straightforward. A single errors in a parity bit would result in a single parity violation which could be ignored, and multiple errors would result in more complex patterns. More complex parity check patterns form the basis of low-density parity-check codes which are the state-of-the-art error correction used by current ( ) flash storage systems. ==Usage== Because of its simplicity, parity is used in many hardware applications in which an operation can be repeated in case of difficulty, or simply detecting the error is helpful. For example, the SCSI and PCI buses use parity to detect transmission errors, and many microprocessor instruction caches include parity protection. Because the Instruction cache data is just a copy of the main memory, it can be disregarded and refetched 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. That format accommodates all the 7-bit ASCII characters in an 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 (such as a UART) and, on reception, the result made available to a processor such as the CPU (and so too, 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 (such as the operating system I/O routines). When the total number of transmitted bits, including the parity bit, is even, odd parity has the advantage that both all-zeros and all-ones patterns are detected as errors. If the total number of bits is odd, only one of the patterns is detected as an error, and the choice can be made based on what the more common error is expected to be. ==References== ==External links== Different methods of generating the parity bit, among other bit operations fr:Somme de contrôle#Exemple : bit de parité
Cite this
"Parity bit". 1791050220. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1378275641 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy