<s>
A	O
concurrent	B-Algorithm
hash	I-Algorithm
table	I-Algorithm
or	O
concurrent	B-Operating_System
hash	B-Algorithm
map	I-Algorithm
is	O
an	O
implementation	O
of	O
hash	B-Algorithm
tables	I-Algorithm
allowing	O
concurrent	B-Operating_System
access	I-Operating_System
by	O
multiple	O
threads	B-Operating_System
using	O
a	O
hash	B-Error_Name
function	I-Error_Name
.	O
</s>
<s>
Concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
represent	O
a	O
key	O
concurrent	B-Operating_System
data	I-Operating_System
structure	I-Operating_System
for	O
use	O
in	O
concurrent	B-Architecture
computing	I-Architecture
which	O
allow	O
multiple	O
threads	B-Operating_System
to	O
more	O
efficiently	O
cooperate	O
for	O
a	O
computation	O
among	O
shared	O
data	O
.	O
</s>
<s>
Due	O
to	O
the	O
natural	O
problems	O
associated	O
with	O
concurrent	B-Operating_System
access	I-Operating_System
-	O
namely	O
contention	B-General_Concept
-	O
the	O
way	O
and	O
scope	O
in	O
which	O
the	O
table	O
can	O
be	O
concurrently	O
accessed	O
differs	O
depending	O
on	O
the	O
implementation	O
.	O
</s>
<s>
Furthermore	O
,	O
the	O
resulting	O
speed	O
up	O
might	O
not	O
be	O
linear	O
with	O
the	O
amount	O
of	O
threads	B-Operating_System
used	O
as	O
contention	B-General_Concept
needs	O
to	O
be	O
resolved	O
,	O
producing	O
processing	O
overhead	O
.	O
</s>
<s>
There	O
exist	O
multiple	O
solutions	O
to	O
mitigate	O
the	O
effects	O
of	O
contention	B-General_Concept
,	O
that	O
each	O
preserve	O
the	O
correctness	O
of	O
operations	O
on	O
the	O
table	O
.	O
</s>
<s>
As	O
with	O
their	O
sequential	O
counterpart	O
,	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
can	O
be	O
generalized	O
and	O
extended	O
to	O
fit	O
broader	O
applications	O
,	O
such	O
as	O
allowing	O
more	O
complex	O
data	O
types	O
to	O
be	O
used	O
for	O
keys	O
and	O
values	O
.	O
</s>
<s>
When	O
creating	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
,	O
the	O
functions	O
accessing	O
the	O
table	O
with	O
the	O
chosen	O
hashing	B-Error_Name
algorithm	I-Error_Name
need	O
to	O
be	O
adapted	O
for	O
concurrency	B-Architecture
by	O
adding	O
a	O
conflict	O
resolution	O
strategy	O
.	O
</s>
<s>
Herlihy	O
and	O
Shavit	O
describe	O
how	O
the	O
accesses	O
to	O
a	O
hash	B-Algorithm
table	I-Algorithm
without	O
such	O
a	O
strategy	O
-	O
in	O
its	O
example	O
based	O
on	O
a	O
basic	O
implementation	O
of	O
the	O
Cuckoo	B-Algorithm
hashing	I-Algorithm
algorithm	O
-	O
can	O
be	O
adapted	O
for	O
concurrent	B-Operating_System
use	O
.	O
</s>
<s>
further	O
describe	O
a	O
table	O
access	O
scheme	O
based	O
on	O
cuckoo	B-Algorithm
hashing	I-Algorithm
that	O
is	O
not	O
only	O
concurrent	B-Operating_System
,	O
but	O
also	O
keeps	O
the	O
space	O
efficiency	O
of	O
its	O
hashing	B-Error_Name
function	I-Error_Name
while	O
also	O
improving	O
cache	O
locality	O
as	O
well	O
as	O
the	O
throughput	O
of	O
insertions	O
.	O
</s>
<s>
When	O
hash	B-Algorithm
tables	I-Algorithm
are	O
not	O
bound	O
in	O
size	O
and	O
are	O
thus	O
allowed	O
to	O
grow/shrink	O
when	O
necessary	O
,	O
the	O
hashing	B-Error_Name
algorithm	I-Error_Name
needs	O
to	O
be	O
adapted	O
to	O
allow	O
this	O
operation	O
.	O
</s>
<s>
This	O
entails	O
modifying	O
the	O
used	O
hash	B-Error_Name
function	I-Error_Name
to	O
reflect	O
the	O
new	O
key-space	O
of	O
the	O
resized	O
table	O
.	O
</s>
<s>
A	O
concurrent	B-Operating_System
growing	O
algorithm	O
is	O
described	O
by	O
Maier	O
et	O
al	O
.	O
</s>
<s>
Mega-KV	O
is	O
a	O
high	O
performance	O
key-value	O
store	O
system	O
,	O
where	O
the	O
cuckoo	B-Algorithm
hashing	I-Algorithm
is	O
used	O
and	O
the	O
KV	O
indexing	O
is	O
massively	O
parallelized	B-Operating_System
in	O
batch	O
mode	O
by	O
GPU	O
.	O
</s>
<s>
As	O
with	O
any	O
concurrent	B-Operating_System
data	I-Operating_System
structure	I-Operating_System
,	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
suffer	O
from	O
a	O
variety	O
of	O
problems	O
known	O
in	O
the	O
field	O
of	O
concurrent	B-Architecture
computing	I-Architecture
as	O
a	O
result	O
of	O
contention	B-General_Concept
.	O
</s>
<s>
Examples	O
for	O
such	O
are	O
the	O
ABA	B-Operating_System
problem	I-Operating_System
,	O
race	B-Operating_System
conditions	I-Operating_System
,	O
and	O
deadlocks	B-Operating_System
.	O
</s>
<s>
The	O
extent	O
in	O
which	O
these	O
problems	O
manifest	O
or	O
even	O
occur	O
at	O
all	O
depends	O
on	O
the	O
implementation	O
of	O
the	O
concurrent	B-Algorithm
hash	I-Algorithm
table	I-Algorithm
;	O
specifically	O
which	O
operations	O
the	O
table	O
allows	O
to	O
be	O
run	O
concurrently	O
,	O
as	O
well	O
as	O
its	O
strategies	O
for	O
mitigating	O
problems	O
associated	O
with	O
contention	B-General_Concept
.	O
</s>
<s>
When	O
handling	O
contention	B-General_Concept
,	O
the	O
main	O
goal	O
is	O
the	O
same	O
as	O
with	O
any	O
other	O
concurrent	B-Operating_System
data	I-Operating_System
structure	I-Operating_System
,	O
namely	O
ensuring	O
correctness	O
for	O
every	O
operation	O
on	O
the	O
table	O
.	O
</s>
<s>
This	O
is	O
also	O
known	O
as	O
concurrency	B-Operating_System
control	I-Operating_System
.	O
</s>
<s>
Using	O
atomic	B-General_Concept
instructions	I-General_Concept
such	O
as	O
compare-and-swap	B-Operating_System
or	O
fetch-and-add	B-Operating_System
,	O
problems	O
caused	O
by	O
contention	B-General_Concept
can	O
be	O
reduced	O
by	O
ensuring	O
that	O
an	O
access	O
is	O
completed	O
before	O
another	O
access	O
has	O
the	O
chance	O
to	O
interfere	O
.	O
</s>
<s>
Operations	O
such	O
as	O
compare-and-swap	B-Operating_System
often	O
present	O
limitations	O
as	O
to	O
what	O
size	O
of	O
data	O
they	O
can	O
handle	O
,	O
meaning	O
that	O
the	O
types	O
of	O
keys	O
and	O
values	O
of	O
a	O
table	O
have	O
to	O
be	O
chosen	O
or	O
converted	O
accordingly	O
.	O
</s>
<s>
Using	O
so	O
called	O
Hardware	B-Operating_System
Transactional	I-Operating_System
Memory	I-Operating_System
(	O
HTM	O
)	O
,	O
table	O
operations	O
can	O
be	O
thought	O
of	O
much	O
like	O
database	B-General_Concept
transactions	I-General_Concept
,	O
ensuring	O
atomicity	B-General_Concept
.	O
</s>
<s>
An	O
example	O
of	O
HTM	O
in	O
practice	O
are	O
the	O
Transactional	B-Operating_System
Synchronization	I-Operating_System
Extensions	I-Operating_System
.	O
</s>
<s>
With	O
the	O
help	O
of	O
locks	B-Operating_System
,	O
operations	O
trying	O
to	O
concurrently	O
access	O
the	O
table	O
or	O
values	O
within	O
it	O
can	O
be	O
handled	O
in	O
a	O
way	O
that	O
ensures	O
correct	O
behavior	O
.	O
</s>
<s>
This	O
can	O
however	O
lead	O
to	O
negative	O
performance	O
impacts	O
,	O
in	O
particular	O
when	O
the	O
locks	B-Operating_System
used	O
are	O
too	O
restrictive	O
,	O
thus	O
blocking	O
accesses	O
that	O
would	O
otherwise	O
not	O
contend	O
and	O
could	O
execute	O
without	O
causing	O
any	O
problems	O
.	O
</s>
<s>
Further	O
considerations	O
have	O
to	O
be	O
made	O
to	O
avoid	O
even	O
more	O
critical	O
problems	O
that	O
threaten	O
correctness	O
,	O
as	O
with	O
livelocks	O
,	O
deadlocks	B-Operating_System
or	O
starvation	B-Operating_System
.	O
</s>
<s>
A	O
phase	O
concurrent	B-Algorithm
hash	I-Algorithm
table	I-Algorithm
groups	O
accesses	O
by	O
creating	O
phases	O
in	O
which	O
only	O
one	O
type	O
of	O
operation	O
is	O
allowed	O
(	O
i.e.	O
</s>
<s>
a	O
pure	O
write-phase	O
)	O
,	O
followed	O
by	O
a	O
synchronization	O
of	O
the	O
table	O
state	O
across	O
all	O
threads	B-Operating_System
.	O
</s>
<s>
Widely	O
used	O
within	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
,	O
read-copy-update	B-Operating_System
(	O
RCU	O
)	O
is	O
especially	O
useful	O
in	O
cases	O
where	O
the	O
number	O
of	O
reads	O
far	O
exceeds	O
the	O
number	O
of	O
writes	O
.	O
</s>
<s>
Naturally	O
,	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
find	O
application	O
wherever	O
sequential	O
hash	B-Algorithm
tables	I-Algorithm
are	O
useful	O
.	O
</s>
<s>
The	O
advantage	O
that	O
concurrency	B-Architecture
delivers	O
herein	O
lies	O
within	O
the	O
potential	O
speedup	O
of	O
these	O
use-cases	O
,	O
as	O
well	O
as	O
the	O
increased	O
scalability	O
.	O
</s>
<s>
Considering	O
hardware	O
such	O
as	O
multi-core	B-Architecture
processors	I-Architecture
that	O
become	O
increasingly	O
more	O
capable	O
of	O
concurrent	B-Architecture
computation	I-Architecture
,	O
the	O
importance	O
of	O
concurrent	B-Operating_System
data	I-Operating_System
structures	I-Operating_System
within	O
these	O
applications	O
grow	O
steadily	O
.	O
</s>
<s>
perform	O
a	O
thorough	O
analysis	O
on	O
a	O
variety	O
of	O
concurrent	B-Algorithm
hash	I-Algorithm
table	I-Algorithm
implementations	O
,	O
giving	O
insight	O
into	O
the	O
effectiveness	O
of	O
each	O
in	O
different	O
situations	O
that	O
are	O
likely	O
to	O
occur	O
in	O
real	O
use-cases	O
.	O
</s>
<s>
As	O
expected	O
low	O
contention	B-General_Concept
leads	O
to	O
positive	O
behavior	O
across	O
every	O
operation	O
,	O
whereas	O
high	O
contention	B-General_Concept
becomes	O
problematic	O
when	O
it	O
comes	O
to	O
writing	O
.	O
</s>
<s>
The	O
latter	O
however	O
is	O
a	O
problem	O
of	O
high	O
contention	B-General_Concept
in	O
general	O
,	O
wherein	O
the	O
benefit	O
of	O
concurrent	B-Architecture
computation	I-Architecture
is	O
negated	O
due	O
to	O
the	O
natural	O
requirement	O
for	O
concurrency	B-Operating_System
control	I-Operating_System
restricting	O
contending	O
accesses	O
.	O
</s>
<s>
In	O
spite	O
of	O
this	O
,	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
still	O
prove	O
invaluable	O
even	O
in	O
such	O
high	O
contention	B-General_Concept
scenarios	O
when	O
observing	O
that	O
a	O
well-designed	O
implementation	O
can	O
still	O
achieve	O
very	O
high	O
speedups	O
by	O
leveraging	O
the	O
benefits	O
of	O
concurrency	B-Architecture
to	O
read	O
data	O
concurrently	O
.	O
</s>
<s>
However	O
,	O
real	O
use-cases	O
of	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
are	O
often	O
not	O
simply	O
sequences	O
of	O
the	O
same	O
operation	O
,	O
but	O
rather	O
a	O
mixture	O
of	O
multiple	O
types	O
.	O
</s>
<s>
As	O
such	O
,	O
when	O
a	O
mixture	O
of	O
insert	O
and	O
find	O
operations	O
is	O
used	O
the	O
speedup	O
and	O
resulting	O
usefulness	O
of	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
become	O
more	O
obvious	O
,	O
especially	O
when	O
observing	O
find	O
heavy	O
workloads	O
.	O
</s>
<s>
Ultimately	O
the	O
resulting	O
performance	O
of	O
a	O
concurrent	B-Algorithm
hash	I-Algorithm
table	I-Algorithm
depends	O
on	O
a	O
variety	O
of	O
factors	O
based	O
upon	O
its	O
desired	O
application	O
.	O
</s>
<s>
When	O
choosing	O
the	O
implementation	O
,	O
it	O
is	O
important	O
to	O
determine	O
the	O
necessary	O
amount	O
of	O
generality	O
,	O
contention	B-General_Concept
handling	O
strategies	O
and	O
some	O
thoughts	O
on	O
whether	O
the	O
size	O
of	O
the	O
desired	O
table	O
can	O
be	O
determined	O
in	O
advance	O
or	O
a	O
growing	O
approach	O
must	O
be	O
used	O
instead	O
.	O
</s>
<s>
Since	O
Java	B-Language
1.5	O
,	O
concurrent	B-Operating_System
hash	B-Algorithm
maps	I-Algorithm
are	O
provided	O
based	O
upon	O
concurrent	B-Operating_System
map	I-Operating_System
interface	I-Operating_System
.	O
</s>
<s>
provides	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
for	O
C/C	O
++	O
allowing	O
concurrent	B-Operating_System
reads	O
and	O
writes	O
.	O
</s>
<s>
Threading	B-Application
Building	I-Application
Blocks	I-Application
provide	O
concurrent	B-Operating_System
unordered	O
maps	O
for	O
C++	B-Language
which	O
allow	O
concurrent	B-Operating_System
insertion	O
and	O
traversal	O
and	O
are	O
kept	O
in	O
a	O
similar	O
style	O
to	O
the	O
C++11	B-Language
std::unordered_map	O
interface	O
.	O
</s>
<s>
Included	O
within	O
are	O
the	O
concurrent	B-Operating_System
unordered	O
multimaps	O
,	O
which	O
allow	O
multiple	O
values	O
to	O
exist	O
for	O
the	O
same	O
key	O
in	O
a	O
concurrent	B-Operating_System
unordered	O
map	O
.	O
</s>
<s>
Additionally	O
,	O
concurrent	B-Operating_System
hash	B-Algorithm
maps	I-Algorithm
are	O
provided	O
which	O
build	O
upon	O
the	O
concurrent	B-Operating_System
unordered	O
map	O
and	O
further	O
allow	O
concurrent	B-Operating_System
erasure	O
and	O
contain	O
built-in	O
locking	B-Operating_System
.	O
</s>
<s>
growt	O
provides	O
concurrent	B-Operating_System
growing	O
hash	B-Algorithm
tables	I-Algorithm
for	O
C++	B-Language
on	O
the	O
basis	O
of	O
the	O
so-called	O
folklore	O
implementation	O
.	O
</s>
<s>
Based	O
on	O
this	O
non-growing	O
implementation	O
,	O
a	O
variety	O
of	O
different	O
growing	O
hash	B-Algorithm
tables	I-Algorithm
is	O
given	O
.	O
</s>
<s>
These	O
implementations	O
allow	O
for	O
concurrent	B-Operating_System
reads	O
,	O
inserts	O
,	O
updates	O
(	O
notably	O
updating	O
values	O
based	O
on	O
the	O
current	O
value	O
at	O
the	O
key	O
)	O
and	O
removals	O
(	O
based	O
upon	O
updating	O
using	O
tombstones	B-Language
)	O
.	O
</s>
<s>
Beyond	O
that	O
,	O
variants	O
on	O
the	O
basis	O
of	O
Intel	B-Operating_System
TSX	I-Operating_System
are	O
provided	O
.	O
</s>
<s>
folly	O
provides	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
for	O
C++14	B-Language
and	O
later	O
ensuring	O
wait-free	O
readers	O
and	O
lock-based	O
,	O
sharded	B-General_Concept
writers	O
.	O
</s>
<s>
As	O
stated	O
on	O
its	O
GitHub	O
page	O
,	O
this	O
library	O
provides	O
useful	O
functionality	O
for	O
Facebook	B-Application
.	I-Application
</s>
<s>
Junction	O
provides	O
several	O
implementations	O
of	O
concurrent	B-Algorithm
hash	I-Algorithm
tables	I-Algorithm
for	O
C++	B-Language
on	O
the	O
basis	O
of	O
atomic	B-General_Concept
operations	I-General_Concept
to	O
ensure	O
thread-safety	O
for	O
any	O
given	O
member	O
function	O
of	O
the	O
table	O
.	O
</s>
