<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
false	B-General_Concept
sharing	I-General_Concept
is	O
a	O
performance-degrading	O
usage	O
pattern	O
that	O
can	O
arise	O
in	O
systems	O
with	O
distributed	O
,	O
coherent	B-General_Concept
caches	I-General_Concept
at	O
the	O
size	O
of	O
the	O
smallest	O
resource	O
block	O
managed	O
by	O
the	O
caching	O
mechanism	O
.	O
</s>
<s>
When	O
a	O
system	O
participant	O
attempts	O
to	O
periodically	O
access	O
data	O
that	O
is	O
not	O
being	O
altered	O
by	O
another	O
party	O
,	O
but	O
that	O
data	O
shares	O
a	O
cache	B-General_Concept
block	I-General_Concept
with	O
data	O
that	O
is	O
being	O
altered	O
,	O
the	O
caching	O
protocol	O
may	O
force	O
the	O
first	O
participant	O
to	O
reload	O
the	O
whole	O
cache	B-General_Concept
block	I-General_Concept
despite	O
a	O
lack	O
of	O
logical	O
necessity	O
.	O
</s>
<s>
By	O
far	O
the	O
most	O
common	O
usage	O
of	O
this	O
term	O
is	O
in	O
modern	O
multiprocessor	B-Operating_System
CPU	B-General_Concept
caches	I-General_Concept
,	O
where	O
memory	B-Architecture
is	O
cached	O
in	O
lines	B-General_Concept
of	O
some	O
small	O
power	O
of	O
two	O
word	O
size	O
(	O
e.g.	O
,	O
64	O
aligned	B-Application
,	O
contiguous	O
bytes	B-Application
)	O
.	O
</s>
<s>
If	O
two	O
processors	O
operate	O
on	O
independent	O
data	O
in	O
the	O
same	O
memory	B-General_Concept
address	I-General_Concept
region	O
storable	O
in	O
a	O
single	O
line	O
,	O
the	O
cache	B-General_Concept
coherency	I-General_Concept
mechanisms	O
in	O
the	O
system	O
may	O
force	O
the	O
whole	O
line	O
across	O
the	O
bus	B-General_Concept
or	O
interconnect	B-General_Concept
with	O
every	O
data	O
write	O
,	O
forcing	O
memory	B-Architecture
stalls	O
in	O
addition	O
to	O
wasting	O
system	O
bandwidth	O
.	O
</s>
<s>
In	O
some	O
cases	O
,	O
the	O
elimination	O
of	O
false	B-General_Concept
sharing	I-General_Concept
can	O
result	O
in	O
order-of-magnitude	O
performance	O
improvements	O
.	O
</s>
<s>
False	B-General_Concept
sharing	I-General_Concept
is	O
an	O
inherent	O
artifact	O
of	O
automatically	O
synchronized	O
cache	O
protocols	O
and	O
can	O
also	O
exist	O
in	O
environments	O
such	O
as	O
distributed	O
file	O
systems	O
or	O
databases	O
,	O
but	O
current	O
prevalence	O
is	O
limited	O
to	O
RAM	B-Architecture
caches	O
.	O
</s>
<s>
This	O
code	O
shows	O
the	O
effect	O
of	O
false	B-General_Concept
sharing	I-General_Concept
.	O
</s>
<s>
Each	O
thread	O
sequentially	O
increments	O
one	O
byte	B-Application
of	O
a	O
cache	B-General_Concept
line	I-General_Concept
atomically	O
,	O
which	O
as	O
a	O
whole	O
is	O
shared	O
among	O
all	O
threads	O
.	O
</s>
<s>
As	O
you	O
can	O
see	O
,	O
on	O
the	O
system	O
in	O
question	O
it	O
can	O
take	O
up	O
to	O
a	O
quarter	O
microsecond	O
to	O
complete	O
an	O
increment	O
operation	O
on	O
the	O
shared	B-General_Concept
cache	I-General_Concept
line	O
,	O
which	O
corresponds	O
to	O
approx	O
.	O
</s>
<s>
There	O
are	O
ways	O
of	O
mitigating	O
the	O
effects	O
of	O
false	B-General_Concept
sharing	I-General_Concept
.	O
</s>
<s>
For	O
instance	O
,	O
false	B-General_Concept
sharing	I-General_Concept
in	O
CPU	B-General_Concept
caches	I-General_Concept
can	O
be	O
prevented	O
by	O
reordering	O
variables	O
or	O
adding	O
padding	O
(	O
unused	O
bytes	B-Application
)	O
between	O
variables	O
.	O
</s>
<s>
However	O
,	O
some	O
of	O
these	O
program	O
changes	O
may	O
increase	O
the	O
size	O
of	O
the	O
objects	O
,	O
leading	O
to	O
higher	O
memory	B-Architecture
use	O
.	O
</s>
<s>
There	O
are	O
tools	O
for	O
detecting	O
false	B-General_Concept
sharing	I-General_Concept
.	O
</s>
<s>
There	O
are	O
also	O
systems	O
that	O
both	O
detect	O
and	O
repair	O
false	B-General_Concept
sharing	I-General_Concept
in	O
executing	O
programs	O
.	O
</s>
