<s>
A	O
parity	B-Error_Name
bit	I-Error_Name
,	O
or	O
check	B-Error_Name
bit	I-Error_Name
,	O
is	O
a	O
bit	O
added	O
to	O
a	O
string	O
of	O
binary	O
code	O
.	O
</s>
<s>
Parity	B-Error_Name
bits	I-Error_Name
are	O
a	O
simple	O
form	O
of	O
error	B-Error_Name
detecting	I-Error_Name
code	I-Error_Name
.	O
</s>
<s>
Parity	B-Error_Name
bits	I-Error_Name
are	O
generally	O
applied	O
to	O
the	O
smallest	O
units	O
of	O
a	O
communication	O
protocol	O
,	O
typically	O
8-bit	O
octets	O
(	O
bytes	O
)	O
,	O
although	O
they	O
can	O
also	O
be	O
applied	O
separately	O
to	O
an	O
entire	O
message	O
string	O
of	O
bits	O
.	O
</s>
<s>
The	O
parity	B-Error_Name
bit	I-Error_Name
ensures	O
that	O
the	O
total	O
number	O
of	O
1-bits	O
in	O
the	O
string	O
is	O
even	O
or	O
odd	O
.	O
</s>
<s>
Accordingly	O
,	O
there	O
are	O
two	O
variants	O
of	O
parity	B-Error_Name
bits	I-Error_Name
:	O
even	B-Error_Name
parity	I-Error_Name
bit	O
and	O
odd	B-Error_Name
parity	I-Error_Name
bit	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
even	B-Error_Name
parity	I-Error_Name
,	O
for	O
a	O
given	O
set	O
of	O
bits	O
,	O
the	O
bits	O
whose	O
value	O
is	O
1	O
are	O
counted	O
.	O
</s>
<s>
If	O
that	O
count	O
is	O
odd	O
,	O
the	O
parity	B-Error_Name
bit	I-Error_Name
value	O
is	O
set	O
to	O
1	O
,	O
making	O
the	O
total	O
count	O
of	O
occurrences	O
of	O
1s	O
in	O
the	O
whole	O
set	O
(	O
including	O
the	O
parity	B-Error_Name
bit	I-Error_Name
)	O
an	O
even	O
number	O
.	O
</s>
<s>
If	O
the	O
count	O
of	O
1s	O
in	O
a	O
given	O
set	O
of	O
bits	O
is	O
already	O
even	O
,	O
the	O
parity	B-Error_Name
bit	I-Error_Name
's	O
value	O
is	O
0	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
odd	B-Error_Name
parity	I-Error_Name
,	O
the	O
coding	O
is	O
reversed	O
.	O
</s>
<s>
For	O
a	O
given	O
set	O
of	O
bits	O
,	O
if	O
the	O
count	O
of	O
bits	O
with	O
a	O
value	O
of	O
1	O
is	O
even	O
,	O
the	O
parity	B-Error_Name
bit	I-Error_Name
value	O
is	O
set	O
to	O
1	O
making	O
the	O
total	O
count	O
of	O
1s	O
in	O
the	O
whole	O
set	O
(	O
including	O
the	O
parity	B-Error_Name
bit	I-Error_Name
)	O
an	O
odd	O
number	O
.	O
</s>
<s>
If	O
the	O
count	O
of	O
bits	O
with	O
a	O
value	O
of	O
1	O
is	O
odd	O
,	O
the	O
count	O
is	O
already	O
odd	O
so	O
the	O
parity	B-Error_Name
bit	I-Error_Name
's	O
value	O
is	O
0	O
.	O
</s>
<s>
Even	B-Error_Name
parity	I-Error_Name
is	O
a	O
special	O
case	O
of	O
a	O
cyclic	O
redundancy	O
check	O
(	O
CRC	O
)	O
,	O
where	O
the	O
1-bit	O
CRC	O
is	O
generated	O
by	O
the	O
polynomial	O
x+1	O
.	O
</s>
<s>
In	O
mathematics	O
parity	B-Error_Name
can	O
refer	O
to	O
the	O
evenness	O
or	O
oddness	O
of	O
an	O
integer	O
,	O
which	O
,	O
when	O
written	O
in	O
its	O
binary	O
form	O
,	O
can	O
be	O
determined	O
just	O
by	O
examining	O
only	O
its	O
least	O
significant	O
bit	O
.	O
</s>
<s>
In	O
information	O
technology	O
parity	B-Error_Name
refers	O
to	O
the	O
evenness	O
or	O
oddness	O
,	O
given	O
any	O
set	O
of	O
binary	O
digits	O
,	O
of	O
the	O
number	O
of	O
those	O
bits	O
with	O
value	O
one	O
.	O
</s>
<s>
Because	O
parity	B-Error_Name
is	O
determined	O
by	O
the	O
state	O
of	O
every	O
one	O
of	O
the	O
bits	O
,	O
this	O
property	O
of	O
parity	B-Error_Name
—	O
being	O
dependent	O
upon	O
all	O
the	O
bits	O
and	O
changing	O
its	O
value	O
from	O
even	O
to	O
odd	B-Error_Name
parity	I-Error_Name
if	O
any	O
one	O
bit	O
changes	O
—	O
allows	O
for	O
its	O
use	O
in	O
error	B-Error_Name
detection	I-Error_Name
and	I-Error_Name
correction	I-Error_Name
schemes	O
.	O
</s>
<s>
In	O
telecommunications	O
the	O
parity	B-Error_Name
referred	O
to	O
by	O
some	O
protocols	O
is	O
for	O
error-detection	O
.	O
</s>
<s>
The	O
transmission	O
medium	O
is	O
preset	O
,	O
at	O
both	O
end	O
points	O
,	O
to	O
agree	O
on	O
either	O
odd	B-Error_Name
parity	I-Error_Name
or	O
even	B-Error_Name
parity	I-Error_Name
.	O
</s>
<s>
For	O
each	O
string	O
of	O
bits	O
ready	O
to	O
transmit	O
(	O
data	O
packet	O
)	O
the	O
sender	O
calculates	O
its	O
parity	B-Error_Name
bit	I-Error_Name
,	O
zero	O
or	O
one	O
,	O
to	O
make	O
it	O
conform	O
to	O
the	O
agreed	O
parity	B-Error_Name
,	O
even	O
or	O
odd	O
.	O
</s>
<s>
The	O
receiver	O
of	O
that	O
packet	O
first	O
checks	O
that	O
the	O
parity	B-Error_Name
of	O
the	O
packet	O
as	O
a	O
whole	O
is	O
in	O
accordance	O
with	O
the	O
preset	O
agreement	O
,	O
then	O
,	O
if	O
there	O
was	O
a	O
parity	B-Error_Name
error	I-Error_Name
in	O
that	O
packet	O
,	O
requests	O
a	O
re-transmission	O
of	O
that	O
packet	O
.	O
</s>
<s>
In	O
computer	O
science	O
the	O
parity	B-Error_Name
stripe	O
or	O
parity	B-Error_Name
disk	O
in	O
a	O
RAID	B-Architecture
provides	O
error-correction	B-Error_Name
.	O
</s>
<s>
Parity	B-Error_Name
bits	I-Error_Name
are	O
written	O
at	O
the	O
rate	O
of	O
one	O
parity	B-Error_Name
bit	I-Error_Name
per	O
n	O
bits	O
,	O
where	O
n	O
is	O
the	O
number	O
of	O
disks	O
in	O
the	O
array	O
.	O
</s>
<s>
In	O
this	O
way	O
,	O
using	O
one	O
parity	B-Error_Name
bit	I-Error_Name
creates	O
"	O
redundancy	O
"	O
for	O
a	O
region	O
from	O
the	O
size	O
of	O
one	O
bit	O
to	O
the	O
size	O
of	O
one	O
disk	O
.	O
</s>
<s>
In	O
electronics	O
,	O
transcoding	O
data	O
with	O
parity	B-Error_Name
can	O
be	O
very	O
efficient	O
,	O
as	O
XOR	B-Application
gates	O
output	O
what	O
is	O
equivalent	O
to	O
a	O
check	B-Error_Name
bit	I-Error_Name
that	O
creates	O
an	O
even	B-Error_Name
parity	I-Error_Name
,	O
and	O
XOR	B-Application
logic	O
design	O
easily	O
scales	O
to	O
any	O
number	O
of	O
inputs	O
.	O
</s>
<s>
XOR	B-Application
and	O
AND	O
structures	O
comprise	O
the	O
bulk	O
of	O
most	O
integrated	O
circuitry	O
.	O
</s>
<s>
If	O
an	O
odd	O
number	O
of	O
bits	O
(	O
including	O
the	O
parity	B-Error_Name
bit	I-Error_Name
)	O
are	O
transmitted	O
incorrectly	O
,	O
the	O
parity	B-Error_Name
bit	I-Error_Name
will	O
be	O
incorrect	O
,	O
thus	O
indicating	O
that	O
a	O
parity	B-Error_Name
error	I-Error_Name
occurred	O
in	O
the	O
transmission	O
.	O
</s>
<s>
The	O
parity	B-Error_Name
bit	I-Error_Name
is	O
only	O
suitable	O
for	O
detecting	O
errors	O
;	O
it	O
cannot	O
correct	B-Error_Name
any	O
errors	O
,	O
as	O
there	O
is	O
no	O
way	O
to	O
determine	O
which	O
particular	O
bit	O
is	O
corrupted	O
.	O
</s>
<s>
The	O
data	O
must	O
be	O
discarded	O
entirely	O
,	O
and	O
re-transmitted	B-Error_Name
from	I-Error_Name
scratch	I-Error_Name
.	O
</s>
<s>
However	O
,	O
parity	B-Error_Name
has	O
the	O
advantage	O
that	O
it	O
uses	O
only	O
a	O
single	O
bit	O
and	O
requires	O
only	O
a	O
number	O
of	O
XOR	B-Application
gates	O
to	O
generate	O
.	O
</s>
<s>
See	O
Hamming	B-Error_Name
code	I-Error_Name
for	O
an	O
example	O
of	O
an	O
error-correcting	B-Error_Name
code	I-Error_Name
.	O
</s>
<s>
Parity	B-Error_Name
bit	I-Error_Name
checking	O
is	O
used	O
occasionally	O
for	O
transmitting	O
ASCII	B-Protocol
characters	I-Protocol
,	O
which	O
have	O
7	O
bits	O
,	O
leaving	O
the	O
8th	O
bit	O
as	O
a	O
parity	B-Error_Name
bit	I-Error_Name
.	O
</s>
<s>
For	O
example	O
,	O
the	O
parity	B-Error_Name
bit	I-Error_Name
can	O
be	O
computed	O
as	O
follows	O
.	O
</s>
<s>
Bob	O
reports	O
correct	B-Error_Name
transmission	O
after	O
observing	O
expected	O
even	O
result	O
.	O
</s>
<s>
Alice	O
computes	O
parity	B-Error_Name
bit	I-Error_Name
value	O
:	O
</s>
<s>
Bob	O
reports	O
correct	B-Error_Name
transmission	O
after	O
observing	O
expected	O
odd	O
result	O
.	O
</s>
<s>
In	O
the	O
two	O
examples	O
above	O
,	O
Bob	O
's	O
calculated	O
parity	B-Error_Name
value	O
matches	O
the	O
parity	B-Error_Name
bit	I-Error_Name
in	O
its	O
received	O
value	O
,	O
indicating	O
there	O
are	O
no	O
single	O
bit	O
errors	O
.	O
</s>
<s>
Consider	O
the	O
following	O
example	O
with	O
a	O
transmission	O
error	O
in	O
the	O
second	O
bit	O
using	O
XOR	B-Application
:	O
</s>
<s>
There	O
is	O
a	O
limitation	O
to	O
parity	B-Error_Name
schemes	O
.	O
</s>
<s>
A	O
parity	B-Error_Name
bit	I-Error_Name
is	O
only	O
guaranteed	O
to	O
detect	O
an	O
odd	O
number	O
of	O
bit	O
errors	O
.	O
</s>
<s>
If	O
an	O
even	O
number	O
of	O
bits	O
have	O
errors	O
,	O
the	O
parity	B-Error_Name
bit	I-Error_Name
records	O
the	O
correct	B-Error_Name
number	O
of	O
ones	O
,	O
even	O
though	O
the	O
data	O
is	O
corrupt	O
.	O
</s>
<s>
(	O
See	O
also	O
Error	B-Error_Name
detection	I-Error_Name
and	I-Error_Name
correction	I-Error_Name
.	O
)	O
</s>
<s>
Bob	O
reports	O
correct	B-Error_Name
transmission	O
though	O
actually	O
incorrect	O
.	O
</s>
<s>
Bob	O
observes	O
even	B-Error_Name
parity	I-Error_Name
,	O
as	O
expected	O
,	O
thereby	O
failing	O
to	O
catch	O
the	O
two	O
bit	O
errors	O
.	O
</s>
<s>
Because	O
of	O
its	O
simplicity	O
,	O
parity	B-Error_Name
is	O
used	O
in	O
many	O
hardware	B-Architecture
applications	O
where	O
an	O
operation	O
can	O
be	O
repeated	O
in	O
case	O
of	O
difficulty	O
,	O
or	O
where	O
simply	O
detecting	O
the	O
error	O
is	O
helpful	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
SCSI	B-Architecture
and	O
PCI	O
buses	O
use	O
parity	B-Error_Name
to	O
detect	O
transmission	O
errors	O
,	O
and	O
many	O
microprocessor	B-Architecture
instruction	O
caches	B-General_Concept
include	O
parity	B-Error_Name
protection	O
.	O
</s>
<s>
In	O
serial	B-Protocol
data	O
transmission	O
,	O
a	O
common	O
format	O
is	O
7	O
data	O
bits	O
,	O
an	O
even	B-Error_Name
parity	I-Error_Name
bit	O
,	O
and	O
one	O
or	O
two	O
stop	O
bits	O
.	O
</s>
<s>
This	O
format	O
accommodates	O
all	O
the	O
7-bit	B-Protocol
ASCII	I-Protocol
characters	O
in	O
an	O
8-bit	O
byte	O
.	O
</s>
<s>
Other	O
formats	O
are	O
possible	O
;	O
8	O
bits	O
of	O
data	O
plus	O
a	O
parity	B-Error_Name
bit	I-Error_Name
can	O
convey	O
all	O
8-bit	O
byte	O
values	O
.	O
</s>
<s>
In	O
serial	B-Protocol
communication	I-Protocol
contexts	O
,	O
parity	B-Error_Name
is	O
usually	O
generated	O
and	O
checked	O
by	O
interface	B-Application
hardware	B-Architecture
(	O
e.g.	O
,	O
a	O
UART	O
)	O
and	O
,	O
on	O
reception	O
,	O
the	O
result	O
made	O
available	O
to	O
a	O
processor	O
such	O
as	O
the	O
CPU	O
(	O
and	O
so	O
too	O
,	O
for	O
instance	O
,	O
the	O
operating	B-General_Concept
system	I-General_Concept
)	O
via	O
a	O
status	O
bit	O
in	O
a	O
hardware	B-General_Concept
register	I-General_Concept
in	O
the	O
interface	B-Application
hardware	B-Architecture
.	O
</s>
<s>
Recovery	O
from	O
the	O
error	O
is	O
usually	O
done	O
by	O
retransmitting	O
the	O
data	O
,	O
the	O
details	O
of	O
which	O
are	O
usually	O
handled	O
by	O
software	O
(	O
e.g.	O
,	O
the	O
operating	B-General_Concept
system	I-General_Concept
I/O	O
routines	O
)	O
.	O
</s>
<s>
When	O
the	O
total	O
number	O
of	O
transmitted	O
bits	O
,	O
including	O
the	O
parity	B-Error_Name
bit	I-Error_Name
,	O
is	O
even	O
,	O
odd	B-Error_Name
parity	I-Error_Name
has	O
the	O
advantage	O
that	O
the	O
all-zeros	O
and	O
all-ones	O
patterns	O
are	O
both	O
detected	O
as	O
errors	O
.	O
</s>
<s>
Parity	B-Error_Name
data	O
is	O
used	O
by	O
RAID	B-Architecture
arrays	I-Architecture
(	O
redundant	B-Architecture
array	I-Architecture
of	I-Architecture
independent/inexpensive	I-Architecture
disks	I-Architecture
)	O
to	O
achieve	O
redundancy	O
.	O
</s>
<s>
If	O
a	O
drive	O
in	O
the	O
array	O
fails	O
,	O
remaining	O
data	O
on	O
the	O
other	O
drives	O
can	O
be	O
combined	O
with	O
the	O
parity	B-Error_Name
data	O
(	O
using	O
the	O
Boolean	O
XOR	B-Application
function	O
)	O
to	O
reconstruct	O
the	O
missing	O
data	O
.	O
</s>
<s>
For	O
example	O
,	O
suppose	O
two	O
drives	O
in	O
a	O
three-drive	O
RAID	B-Architecture
5	O
array	O
contained	O
the	O
following	O
data	O
:	O
</s>
<s>
To	O
calculate	O
parity	B-Error_Name
data	O
for	O
the	O
two	O
drives	O
,	O
an	O
XOR	B-Application
is	O
performed	O
on	O
their	O
data	O
:	O
</s>
<s>
The	O
resulting	O
parity	B-Error_Name
data	O
,	O
10111001	O
,	O
is	O
then	O
stored	O
on	O
Drive	O
3	O
.	O
</s>
<s>
Should	O
any	O
of	O
the	O
three	O
drives	O
fail	O
,	O
the	O
contents	O
of	O
the	O
failed	O
drive	O
can	O
be	O
reconstructed	O
on	O
a	O
replacement	O
drive	O
by	O
subjecting	O
the	O
data	O
from	O
the	O
remaining	O
drives	O
to	O
the	O
same	O
XOR	B-Application
operation	O
.	O
</s>
<s>
If	O
Drive	O
2	O
were	O
to	O
fail	O
,	O
its	O
data	O
could	O
be	O
rebuilt	O
using	O
the	O
XOR	B-Application
results	O
of	O
the	O
contents	O
of	O
the	O
two	O
remaining	O
drives	O
,	O
Drive	O
1	O
and	O
Drive	O
3	O
:	O
</s>
<s>
The	O
result	O
of	O
that	O
XOR	B-Application
calculation	O
yields	O
Drive	O
2	O
's	O
contents	O
.	O
</s>
<s>
XOR	B-Application
logic	O
is	O
also	O
equivalent	O
to	O
even	B-Error_Name
parity	I-Error_Name
(	O
because	O
a	O
XOR	B-Application
b	O
XOR	B-Application
c	O
XOR	B-Application
...	O
may	O
be	O
treated	O
as	O
XOR( a	O
,	O
b	O
,	O
c	O
,...	O
)	O
which	O
is	O
an	O
n-ary	O
operator	O
which	O
is	O
true	O
if	O
and	O
only	O
if	O
an	O
odd	O
number	O
of	O
arguments	O
are	O
true	O
)	O
.	O
</s>
<s>
So	O
the	O
same	O
XOR	B-Application
concept	O
above	O
applies	O
similarly	O
to	O
larger	O
RAID	B-Architecture
arrays	I-Architecture
with	O
parity	B-Error_Name
,	O
using	O
any	O
number	O
of	O
disks	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
a	O
RAID	B-Architecture
3	O
array	O
of	O
12	O
drives	O
,	O
11	O
drives	O
participate	O
in	O
the	O
XOR	B-Application
calculation	O
shown	O
above	O
and	O
yield	O
a	O
value	O
that	O
is	O
then	O
stored	O
on	O
the	O
dedicated	O
parity	B-Error_Name
drive	O
.	O
</s>
<s>
Extensions	O
and	O
variations	O
on	O
the	O
parity	B-Error_Name
bit	I-Error_Name
mechanism	O
"	O
double	O
,	O
"	O
"	O
dual	O
,	O
"	O
or	O
"	O
diagonal	O
"	O
parity	B-Error_Name
,	O
are	O
used	O
in	O
RAID-DP	O
.	O
</s>
<s>
A	O
parity	B-Error_Name
track	O
was	O
present	O
on	O
the	O
first	O
magnetic-tape	B-Architecture
data	I-Architecture
storage	I-Architecture
in	O
1951	O
.	O
</s>
<s>
Parity	B-Error_Name
in	O
this	O
form	O
,	O
applied	O
across	O
multiple	O
parallel	O
signals	O
,	O
is	O
known	O
as	O
a	O
transverse	B-Error_Name
redundancy	I-Error_Name
check	I-Error_Name
.	O
</s>
<s>
This	O
can	O
be	O
combined	O
with	O
parity	B-Error_Name
computed	O
over	O
multiple	O
bits	O
sent	O
on	O
a	O
single	O
signal	O
,	O
a	O
longitudinal	B-Error_Name
redundancy	I-Error_Name
check	I-Error_Name
.	O
</s>
<s>
In	O
a	O
parallel	O
bus	O
,	O
there	O
is	O
one	O
longitudinal	B-Error_Name
redundancy	I-Error_Name
check	I-Error_Name
bit	O
per	O
parallel	O
signal	O
.	O
</s>
<s>
Parity	B-Error_Name
was	O
also	O
used	O
on	O
at	O
least	O
some	O
paper-tape	O
(	O
punched	O
tape	O
)	O
data	O
entry	O
systems	O
(	O
which	O
preceded	O
magnetic-tape	O
systems	O
)	O
.	O
</s>
<s>
On	O
the	O
systems	O
sold	O
by	O
British	O
company	O
ICL	O
(	O
formerly	O
ICT	O
)	O
the	O
paper	O
tape	O
had	O
8	O
hole	O
positions	O
running	O
across	O
it	O
,	O
with	O
the	O
8th	O
being	O
for	O
parity	B-Error_Name
.	O
</s>
<s>
7	O
positions	O
were	O
used	O
for	O
the	O
data	O
,	O
e.g.	O
,	O
7-bit	B-Protocol
ASCII	I-Protocol
.	O
</s>
