Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Parity bit
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Usage== Because of its simplicity, parity is used in many [[computer hardware|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 bus]]es use parity to detect transmission errors, and many [[microprocessor]] instruction [[CPU cache|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 communications|serial]] [[data transmission]], a common format is 7 data bits, an even parity bit, and one or two [[stop bit]]s. 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 [[Universal asynchronous receiver-transmitter|UART]]) and, on reception, the result made available to a [[Processor (computing)|processor]] such as the CPU (and so too, for instance, the [[operating system]]) via a status bit in a [[hardware register]] in the [[Interface (computing)|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. === RAID array === Parity data is used by RAID arrays ([[RAID|redundant array of independent/inexpensive disks]]) to achieve [[Redundancy (engineering)|redundancy]]. If a drive in the array fails, remaining data on the other drives can be combined with the parity data (using the Boolean [[XOR]] function) to reconstruct the missing data. For example, suppose two drives in a three-drive [[RAID 4]] array contained the following data: {| |- |Drive 1: |'''01101101''' |- |Drive 2: |'''11010100''' |} To calculate parity data for the two drives, an XOR is performed on their data: {| |- | |'''01101101''' |- | XOR |<ins>'''11010100'''</ins> |- | |'''10111001''' |} The resulting parity data, '''10111001''', is then stored on Drive 3. Should any of the three drives fail, the contents of the failed drive can be reconstructed on a replacement drive by subjecting the data from the remaining drives to the same XOR operation. If Drive 2 were to fail, its data could be rebuilt using the XOR results of the contents of the two remaining drives, Drive 1 and Drive 3: {| |- |Drive 1: |'''01101101''' |- |Drive 3: |'''10111001''' |} as follows: {| |- | || '''01101101''' || Drive 1 |- | XOR || <ins>'''10111001'''</ins> || Drive 3 |- | || '''11010100''' || Reconstructed Drive 2 |} The result of that XOR calculation yields Drive 2's contents. '''11010100''' is then stored on Drive 2, fully repairing the array. XOR logic is also equivalent to even parity (because ''a'' XOR ''b'' XOR ''c'' XOR ... may be treated as XOR(''a'',''b'',''c'',...), which is an n-ary operator that is true if and only if an odd number of arguments is true). So the same XOR concept above applies similarly to larger RAID arrays with parity, using any number of disks. In the case of a RAID 3 array of 12 drives, 11 drives participate in the XOR calculation shown above and yield a value that is then stored on the dedicated parity drive. Extensions and variations on the parity bit mechanism "double," "dual," or "diagonal" parity, are used in [[Non-standard RAID levels#RAID-DP|RAID-DP]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)