<s>
In	O
computer	B-General_Concept
science	I-General_Concept
and	O
engineering	O
,	O
transactional	B-Operating_System
memory	I-Operating_System
attempts	O
to	O
simplify	O
concurrent	B-Architecture
programming	I-Architecture
by	O
allowing	O
a	O
group	O
of	O
load	O
and	O
store	O
instructions	O
to	O
execute	O
in	O
an	O
atomic	B-General_Concept
way	O
.	O
</s>
<s>
It	O
is	O
a	O
concurrency	B-Operating_System
control	I-Operating_System
mechanism	O
analogous	O
to	O
database	B-General_Concept
transactions	I-General_Concept
for	O
controlling	O
access	O
to	O
shared	B-Operating_System
memory	I-Operating_System
in	O
concurrent	B-Architecture
computing	I-Architecture
.	O
</s>
<s>
Transactional	B-Operating_System
memory	I-Operating_System
systems	O
provide	O
high-level	O
abstraction	O
as	O
an	O
alternative	O
to	O
low-level	O
thread	O
synchronization	O
.	O
</s>
<s>
This	O
abstraction	O
allows	O
for	O
coordination	O
between	O
concurrent	O
reads	O
and	O
writes	O
of	O
shared	B-Operating_System
data	I-Operating_System
in	O
parallel	O
systems	O
.	O
</s>
<s>
In	O
concurrent	B-Architecture
programming	I-Architecture
,	O
synchronization	O
is	O
required	O
when	O
parallel	O
threads	O
attempt	O
to	O
access	O
a	O
shared	O
resource	O
.	O
</s>
<s>
Low-level	O
thread	O
synchronization	O
constructs	O
such	O
as	O
locks	O
are	O
pessimistic	O
and	O
prohibit	O
threads	O
that	O
are	O
outside	O
a	O
critical	B-Operating_System
section	I-Operating_System
from	O
making	O
any	O
changes	O
.	O
</s>
<s>
Transactional	B-Operating_System
memory	I-Operating_System
provides	O
optimistic	B-Operating_System
concurrency	I-Operating_System
control	I-Operating_System
by	O
allowing	O
threads	O
to	O
run	O
in	O
parallel	O
with	O
minimal	O
interference	O
.	O
</s>
<s>
The	O
goal	O
of	O
transactional	B-Operating_System
memory	I-Operating_System
systems	O
is	O
to	O
transparently	O
support	O
regions	O
of	O
code	O
marked	O
as	O
transactions	O
by	O
enforcing	O
atomicity	B-General_Concept
,	O
consistency	B-General_Concept
and	O
isolation	B-General_Concept
.	O
</s>
<s>
Since	O
the	O
programmer	O
is	O
not	O
responsible	O
for	O
explicitly	O
identifying	O
locks	O
or	O
the	O
order	O
in	O
which	O
they	O
are	O
acquired	O
,	O
programs	O
that	O
utilize	O
transactional	B-Operating_System
memory	I-Operating_System
cannot	O
produce	O
a	O
deadlock	B-Operating_System
.	O
</s>
<s>
With	O
these	O
constructs	O
in	O
place	O
,	O
transactional	B-Operating_System
memory	I-Operating_System
provides	O
a	O
high-level	O
programming	O
abstraction	O
by	O
allowing	O
programmers	O
to	O
enclose	O
their	O
methods	O
within	O
transactional	O
blocks	O
.	O
</s>
<s>
Correct	O
implementations	O
ensure	O
that	O
data	O
cannot	O
be	O
shared	O
between	O
threads	O
without	O
going	O
through	O
a	O
transaction	O
and	O
produce	O
a	O
serializable	B-Operating_System
outcome	O
.	O
</s>
<s>
In	O
the	O
code	O
,	O
the	O
block	O
defined	O
by	O
"	O
transaction	O
"	O
is	O
guaranteed	O
atomicity	B-General_Concept
,	O
consistency	B-General_Concept
and	O
isolation	B-General_Concept
by	O
the	O
underlying	O
transactional	B-Operating_System
memory	I-Operating_System
implementation	O
and	O
is	O
transparent	O
to	O
the	O
programmer	O
.	O
</s>
<s>
Note	O
that	O
concurrency	B-Architecture
related	O
bugs	O
are	O
still	O
possible	O
in	O
programs	O
that	O
use	O
a	O
large	O
number	O
of	O
transactions	O
,	O
especially	O
in	O
software	O
implementations	O
where	O
the	O
library	O
provided	O
by	O
the	O
language	O
is	O
unable	O
to	O
enforce	O
correct	O
use	O
.	O
</s>
<s>
Transactional	B-Operating_System
memory	I-Operating_System
is	O
limited	O
in	O
that	O
it	O
requires	O
a	O
shared-memory	B-Operating_System
abstraction	O
.	O
</s>
<s>
Although	O
transactional	B-Operating_System
memory	I-Operating_System
programs	O
cannot	O
produce	O
a	O
deadlock	B-Operating_System
,	O
programs	O
may	O
still	O
suffer	O
from	O
a	O
livelock	O
or	O
resource	B-Operating_System
starvation	I-Operating_System
.	O
</s>
<s>
The	O
abstraction	O
of	O
atomicity	B-General_Concept
in	O
transactional	B-Operating_System
memory	I-Operating_System
requires	O
a	O
hardware	O
mechanism	O
to	O
detect	O
conflicts	O
and	O
undo	O
any	O
changes	O
made	O
to	O
shared	B-Operating_System
data	I-Operating_System
.	O
</s>
<s>
Hardware	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
systems	O
may	O
comprise	O
modifications	O
in	O
processors	O
,	O
cache	O
and	O
bus	O
protocol	O
to	O
support	O
transactions	O
.	O
</s>
<s>
Large	O
buffers	O
are	O
used	O
to	O
store	O
speculative	O
values	O
while	O
avoiding	O
write	O
propagation	O
through	O
the	O
underlying	O
cache	B-General_Concept
coherence	I-General_Concept
protocol	O
.	O
</s>
<s>
If	O
a	O
serializability	B-Operating_System
conflict	O
is	O
detected	O
from	O
a	O
parallel	O
transaction	O
,	O
then	O
the	O
speculative	O
values	O
are	O
discarded	O
.	O
</s>
<s>
When	O
caches	O
are	O
used	O
,	O
the	O
system	O
may	O
introduce	O
the	O
risk	O
of	O
false	B-General_Concept
conflicts	I-General_Concept
due	O
to	O
the	O
use	O
of	O
cache	O
line	O
granularity	O
.	O
</s>
<s>
Load-link/store	B-Operating_System
-conditional	I-Operating_System
(	O
LL/SC	B-Operating_System
)	O
offered	O
by	O
many	O
RISC	B-Architecture
processors	I-Architecture
can	O
be	O
viewed	O
as	O
the	O
most	O
basic	O
transactional	B-Operating_System
memory	I-Operating_System
support	O
;	O
however	O
,	O
LL/SC	B-Operating_System
usually	O
operates	O
on	O
data	O
that	O
is	O
the	O
size	O
of	O
a	O
native	O
machine	O
word	O
,	O
so	O
only	O
single-word	O
transactions	O
are	O
supported	O
.	O
</s>
<s>
Although	O
hardware	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
provides	O
maximal	O
performance	O
compared	O
to	O
software	O
alternatives	O
,	O
limited	O
use	O
has	O
been	O
seen	O
at	O
this	O
time	O
.	O
</s>
<s>
Software	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
provides	O
transactional	B-Operating_System
memory	I-Operating_System
semantics	O
in	O
a	O
software	O
runtime	B-Library
library	I-Library
or	O
the	O
programming	O
language	O
,	O
and	O
requires	O
minimal	O
hardware	O
support	O
(	O
typically	O
an	O
atomic	B-General_Concept
compare	B-Operating_System
and	I-Operating_System
swap	I-Operating_System
operation	O
,	O
or	O
equivalent	O
)	O
.	O
</s>
<s>
Hardware	B-General_Concept
acceleration	I-General_Concept
can	O
reduce	O
some	O
of	O
the	O
overheads	O
associated	O
with	O
software	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
.	O
</s>
<s>
Owing	O
to	O
the	O
more	O
limited	O
nature	O
of	O
hardware	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
(	O
in	O
current	O
implementations	O
)	O
,	O
software	O
using	O
it	O
may	O
require	O
fairly	O
extensive	O
tuning	O
to	O
fully	O
benefit	O
from	O
it	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
dynamic	O
memory	O
allocator	O
may	O
have	O
a	O
significant	O
influence	O
on	O
performance	O
and	O
likewise	O
structure	O
padding	O
may	O
affect	O
performance	O
(	O
owing	O
to	O
cache	O
alignment	O
and	O
false	B-General_Concept
sharing	I-General_Concept
issues	O
)	O
;	O
in	O
the	O
context	O
of	O
a	O
virtual	O
machine	O
,	O
various	O
background	O
threads	O
may	O
cause	O
unexpected	O
transaction	O
aborts	O
.	O
</s>
<s>
One	O
of	O
the	O
earliest	O
implementations	O
of	O
transactional	B-Operating_System
memory	I-Operating_System
was	O
the	O
gated	O
store	O
buffer	O
used	O
in	O
Transmeta	O
's	O
Crusoe	B-General_Concept
and	O
Efficeon	B-General_Concept
processors	O
.	O
</s>
<s>
However	O
,	O
this	O
was	O
only	O
used	O
to	O
facilitate	O
speculative	O
optimizations	O
for	O
binary	O
translation	O
,	O
rather	O
than	O
any	O
form	O
of	O
speculative	B-Operating_System
multithreading	I-Operating_System
,	O
or	O
exposing	O
it	O
directly	O
to	O
programmers	O
.	O
</s>
<s>
Azul	O
Systems	O
also	O
implemented	O
hardware	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
to	O
accelerate	O
their	O
Java	B-Language
appliances	O
,	O
but	O
this	O
was	O
similarly	O
hidden	O
from	O
outsiders	O
.	O
</s>
<s>
Sun	O
Microsystems	O
implemented	O
hardware	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
and	O
a	O
limited	O
form	O
of	O
speculative	B-Operating_System
multithreading	I-Operating_System
in	O
its	O
high-end	O
Rock	B-Device
processor	I-Device
.	O
</s>
<s>
This	O
implementation	O
proved	O
that	O
it	O
could	O
be	O
used	O
for	O
lock	O
elision	O
and	O
more	O
complex	O
hybrid	O
transactional	B-Operating_System
memory	I-Operating_System
systems	O
,	O
where	O
transactions	O
are	O
handled	O
with	O
a	O
combination	O
of	O
hardware	O
and	O
software	O
.	O
</s>
<s>
The	O
Rock	B-Device
processor	I-Device
was	O
canceled	O
in	O
2009	O
,	O
just	O
before	O
the	O
acquisition	O
by	O
Oracle	B-Application
;	O
while	O
the	O
actual	O
products	O
were	O
never	O
released	O
,	O
a	O
number	O
of	O
prototype	O
systems	O
were	O
available	O
to	O
researchers	O
.	O
</s>
<s>
In	O
2009	O
,	O
AMD	O
proposed	O
the	O
Advanced	B-Operating_System
Synchronization	I-Operating_System
Facility	I-Operating_System
(	O
ASF	O
)	O
,	O
a	O
set	O
of	O
x86	B-Operating_System
extensions	O
that	O
provide	O
a	O
very	O
limited	O
form	O
of	O
hardware	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
support	O
.	O
</s>
<s>
The	O
goal	O
was	O
to	O
provide	O
hardware	O
primitives	O
that	O
could	O
be	O
used	O
for	O
higher-level	O
synchronization	O
,	O
such	O
as	O
software	B-Operating_System
transactional	I-Operating_System
memory	I-Operating_System
or	O
lock-free	O
algorithms	O
.	O
</s>
<s>
More	O
recently	O
,	O
IBM	O
announced	O
in	O
2011	O
that	O
Blue	B-General_Concept
Gene/Q	I-General_Concept
had	O
hardware	O
support	O
for	O
both	O
transactional	B-Operating_System
memory	I-Operating_System
and	O
speculative	B-Operating_System
multithreading	I-Operating_System
.	O
</s>
<s>
The	O
transactional	B-Operating_System
memory	I-Operating_System
could	O
be	O
configured	O
in	O
two	O
modes	O
;	O
the	O
first	O
is	O
an	O
unordered	O
and	O
single-version	O
mode	O
,	O
where	O
a	O
write	O
from	O
one	O
transaction	O
causes	O
a	O
conflict	O
with	O
any	O
transactions	O
reading	O
the	O
same	O
memory	O
address	O
.	O
</s>
<s>
The	O
second	O
mode	O
is	O
for	O
speculative	B-Operating_System
multithreading	I-Operating_System
,	O
providing	O
an	O
ordered	O
,	O
multi-versioned	O
transactional	B-Operating_System
memory	I-Operating_System
.	O
</s>
<s>
Intel	O
's	O
Transactional	B-Operating_System
Synchronization	I-Operating_System
Extensions	I-Operating_System
(	O
TSX	O
)	O
is	O
available	O
in	O
some	O
of	O
the	O
Skylake	B-Architecture
processors	O
.	O
</s>
<s>
It	O
was	O
earlier	O
implemented	O
in	O
Haswell	B-Device
and	O
Broadwell	B-General_Concept
processors	O
as	O
well	O
,	O
but	O
the	O
implementations	O
turned	O
out	O
both	O
times	O
to	O
be	O
defective	O
and	O
support	O
for	O
TSX	O
was	O
disabled	O
.	O
</s>
<s>
The	O
TSX	O
specification	O
describes	O
the	O
transactional	B-Operating_System
memory	I-Operating_System
API	O
for	O
use	O
by	O
software	O
developers	O
,	O
but	O
withholds	O
details	O
on	O
technical	O
implementation	O
.	O
</s>
<s>
ARM	B-Architecture
architecture	I-Architecture
has	O
a	O
similar	O
extension	O
.	O
</s>
<s>
As	O
of	O
GCC	B-Application
4.7	O
,	O
an	O
experimental	O
library	O
for	O
transactional	B-Operating_System
memory	I-Operating_System
is	O
available	O
which	O
utilizes	O
a	O
hybrid	O
implementation	O
.	O
</s>
<s>
The	O
PyPy	B-Language
variant	O
of	O
Python	O
also	O
introduces	O
transactional	B-Operating_System
memory	I-Operating_System
to	O
the	O
language	O
.	O
</s>
