On 10/13/05, Jeff The Riffer <[EMAIL PROTECTED]> wrote: > And for the person asking about what Parity is and how it works: > > http://www.datastorageconsultants.com/parity/parity.htm > > Like I said, it's math. :)
And, it's really just the count of the 1 bits modulo 2. Which is just the last bit of the count expressed in binary. If you count in binary: 0 1 01 10 11 Notice that the last bit flips everytime you increment the count. So if all you want to know is whether the count of 1 bits is odd or even, you just count and disregard anything but the low order bit. There are actually two variants called odd parity where the parity bit indicates that the total number of on (including the parity bit) bits is odd, and even parity where the parity bit indicates that the total number of on bits is even. To calculate even parity start the parity at zero, and go through the bits one by one, and xor each bit into the parity bit, if the new bit is a one, the parity bit flips, if it's a zero it stays the same. To calculate odd parity, either start the parity bit at one, or just invert it at the end. Another, and older, use of parity is for error detection in RAM, dating back to the days of core memory, and still in use today. Parity is really just a primitive checksum (like a VERY simple hash with lots of collisions). It will let you detect errors in which an odd number of bits are wrong, the most common case is a single bit in error. You can detect the fact that a bit is wrong, you just don't know which bit. In order to CORRECT a single bit error, you need more bits of information so as to know WHICH bit is wrong. In the raid case, that additional information is which drive is bad, so together they can use parity to correct errors caused by failure of a single drive. -- Rick DeNatale Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/ -- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
