Hello all,
Today we will talk about the parity bit used by RAID arrays.
A parity bit is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.
There are two variants of parity bits: even parity bit and odd parity bit. When using even parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is odd, making the entire set of bits (including the parity bit) even. When using odd parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is even, keeping the entire set of bits (including the parity bit) odd. In other words, an even parity bit will be set to "1" if the number of 1's + 1 is even, and an odd parity bit will be set to "1" if the number of 1's +1 is odd.
Even parity is a special case of a cyclic redundancy check (CRC), where the 1-bit CRC is generated by the polynomial x+1.
If the parity bit is present but not used, it may be referred to as mark parity (when the parity bit is always 1) or space parity (the bit is always 0).
Mean of Parity
Parity is the process of ensuring accurate data transfer between nodes during communication. Parity bits are appended to the raw data bits to create an even or odd number of bits; Number of bits of value 1.
The source then transmits this data over the link and checks and validates bits at the destination. Data is considered accurate if the number of bits (even or odd) matches the number transferred from the source.
Techpedia Interpreting Parity
Parity check is created to eliminate data communication errors. It is a simple network data verification method with an easy-to-understand working mechanism.
For example, if the raw data is 101001, there are three ones. When even parity is used, a parity bit with the value 1 is added to the left of the data so that the number of 1s is even; The transferred data changes to 11010001. However, if parity is used, the parity bit value is zero; 01010001. If the original data contains an even number of 1s (1101001), then if parity is used and the transferred data becomes 11101001, the parity bit with the value 1 is added to the left of the data so that the number of 1s is odd.
The receiver agrees to use the same parity as the sender, and the parity is either even. If this protocol is not configured correctly, communication is not possible. Once the data arrives at the receiver, if the data is transferred incorrectly, the parity bit value will be incorrect; Therefore, an error occurred during transmission.
Parity is used for communication, although more advanced protocols such as Microcom Network Protocol (MNP) and ITU-T V.42b have been replaced as standards for modem communication. It is still used for memory storage device testing, for example, to run a memory check while reading data.
Parity is a very basic method that detects simple errors, but not errors caused by electrical noise changing the number of bits. In fact, both the receive and transmit bits have errors that cancel each other out.
While the chance of this happening on a PC is largely remote, a third bit can be allocated for parity in large computer systems where data integrity needs to be ensured.
Redundant Array of Independent Disks (RAID) also uses an enhanced form of parity-based protection to check horizontal and vertical parity. Write a second set of parity data on all drives to avoid loss in the event of an error.
When a RAID drive parity check fails, the parity information is used to rebuild the data along with the data on other disks. The bits on the remaining drives are added. If they add up to odd numbers, the correct information on the failed drive must be even and vice versa.
RAID array
Parity data is used by RAID arrays (Redundant Array of Independent/Inexpensive Disks) to achieve 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 5 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 11010100
_____________
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:
10111001
XOR 01101101
_____________
11010100
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 which is true if and only if an odd number of arguments are 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.
RAID LEVEL 5

Following are the key points to remember for RAID level 5.
Minimum 3 disks.
Good performance (as blocks are striped).
Good redundancy (distributed parity).
Best cost effective option providing both performance and redundancy. Use this for DB that is heavily read oriented. Write operations will be slow.
Thank you.

