<s>
In	O
database	B-Application
systems	I-Application
,	O
atomicity	B-General_Concept
(	O
;	O
from	O
)	O
is	O
one	O
of	O
the	O
ACID	O
(	O
Atomicity	B-General_Concept
,	O
Consistency	B-General_Concept
,	O
Isolation	B-General_Concept
,	O
Durability	B-General_Concept
)	O
transaction	B-General_Concept
properties	O
.	O
</s>
<s>
An	O
atomic	B-General_Concept
transaction	I-General_Concept
is	O
an	O
indivisible	O
and	O
irreducible	O
series	O
of	O
database	O
operations	O
such	O
that	O
either	O
all	O
occurs	O
,	O
or	O
nothing	O
occurs	O
.	O
</s>
<s>
A	O
guarantee	O
of	O
atomicity	B-General_Concept
prevents	O
updates	O
to	O
the	O
database	O
occurring	O
only	O
partially	O
,	O
which	O
can	O
cause	O
greater	O
problems	O
than	O
rejecting	O
the	O
whole	O
series	O
outright	O
.	O
</s>
<s>
As	O
a	O
consequence	O
,	O
the	O
transaction	B-General_Concept
cannot	O
be	O
observed	O
to	O
be	O
in	O
progress	O
by	O
another	O
database	O
client	O
.	O
</s>
<s>
At	O
one	O
moment	O
in	O
time	O
,	O
it	O
has	O
not	O
yet	O
happened	O
,	O
and	O
at	O
the	O
next	O
it	O
has	O
already	O
occurred	O
in	O
whole	O
(	O
or	O
nothing	O
happened	O
if	O
the	O
transaction	B-General_Concept
was	O
cancelled	O
in	O
progress	O
)	O
.	O
</s>
<s>
An	O
example	O
of	O
an	O
atomic	B-General_Concept
transaction	I-General_Concept
is	O
a	O
monetary	O
transfer	O
from	O
bank	O
account	O
A	O
to	O
account	O
B	O
.	O
</s>
<s>
Performing	O
these	O
operations	O
in	O
an	O
atomic	B-General_Concept
transaction	I-General_Concept
ensures	O
that	O
the	O
database	O
remains	O
in	O
a	O
consistent	B-General_Concept
state	I-General_Concept
,	O
that	O
is	O
,	O
money	O
is	O
neither	O
lost	O
nor	O
created	O
if	O
either	O
of	O
those	O
two	O
operations	O
fails	O
.	O
</s>
<s>
The	O
same	O
term	O
is	O
also	O
used	O
in	O
the	O
definition	O
of	O
First	O
normal	O
form	O
in	O
database	B-Application
systems	I-Application
,	O
where	O
it	O
instead	O
refers	O
to	O
the	O
concept	O
that	O
the	O
values	O
for	O
fields	O
may	O
not	O
consist	O
of	O
multiple	O
smaller	O
value	O
to	O
be	O
decomposed	O
,	O
such	O
as	O
a	O
string	O
into	O
which	O
multiple	O
names	O
,	O
numbers	O
,	O
dates	O
,	O
or	O
other	O
types	O
may	O
be	O
packed	O
.	O
</s>
<s>
Atomicity	B-General_Concept
does	O
not	O
behave	O
completely	O
orthogonally	O
with	O
regard	O
to	O
the	O
other	O
ACID	O
properties	O
of	O
transactions	O
.	O
</s>
<s>
For	O
example	O
,	O
isolation	B-General_Concept
relies	O
on	O
atomicity	B-General_Concept
to	O
roll	O
back	O
the	O
enclosing	O
transaction	B-General_Concept
in	O
the	O
event	O
of	O
an	O
isolation	B-General_Concept
violation	O
such	O
as	O
a	O
deadlock	B-Operating_System
;	O
consistency	B-General_Concept
also	O
relies	O
on	O
atomicity	B-General_Concept
to	O
roll	O
back	O
the	O
enclosing	O
transaction	B-General_Concept
in	O
the	O
event	O
of	O
a	O
consistency	B-General_Concept
violation	O
by	O
an	O
illegal	O
transaction	B-General_Concept
.	O
</s>
<s>
As	O
a	O
result	O
of	O
this	O
,	O
a	O
failure	O
to	O
detect	O
a	O
violation	O
and	O
roll	O
back	O
the	O
enclosing	O
transaction	B-General_Concept
may	O
cause	O
an	O
isolation	B-General_Concept
or	O
consistency	B-General_Concept
failure	O
.	O
</s>
<s>
Typically	O
,	O
systems	O
implement	O
Atomicity	B-General_Concept
by	O
providing	O
some	O
mechanism	O
to	O
indicate	O
which	O
transactions	O
have	O
started	O
and	O
which	O
finished	O
;	O
or	O
by	O
keeping	O
a	O
copy	O
of	O
the	O
data	O
before	O
any	O
changes	O
occurred	O
(	O
read-copy-update	B-Operating_System
)	O
.	O
</s>
<s>
Several	O
filesystems	O
have	O
developed	O
methods	O
for	O
avoiding	O
the	O
need	O
to	O
keep	O
multiple	O
copies	O
of	O
data	O
,	O
using	O
journaling	O
(	O
see	O
journaling	B-Application
file	I-Application
system	I-Application
)	O
.	O
</s>
<s>
Databases	B-Application
usually	O
implement	O
this	O
using	O
some	O
form	O
of	O
logging/journaling	O
to	O
track	O
changes	O
.	O
</s>
<s>
Although	O
implementations	O
vary	O
depending	O
on	O
factors	O
such	O
as	O
concurrency	O
issues	O
,	O
the	O
principle	O
of	O
atomicity	B-General_Concept
–	O
i.e.	O
</s>
<s>
Ultimately	O
,	O
any	O
application-level	O
implementation	O
relies	O
on	O
operating-system	B-General_Concept
functionality	O
.	O
</s>
<s>
At	O
the	O
file-system	O
level	O
,	O
POSIX-compliant	O
systems	O
provide	O
system	B-Operating_System
calls	I-Operating_System
such	O
as	O
open(2 )	O
and	O
flock(2 )	O
that	O
allow	O
applications	O
to	O
atomically	O
open	O
or	O
lock	O
a	O
file	O
.	O
</s>
<s>
At	O
the	O
process	O
level	O
,	O
POSIX	B-Operating_System
Threads	I-Operating_System
provide	O
adequate	O
synchronization	O
primitives	O
.	O
</s>
<s>
The	O
hardware	O
level	O
requires	O
atomic	B-General_Concept
operations	I-General_Concept
such	O
as	O
Test-and-set	B-Operating_System
,	O
Fetch-and-add	B-Operating_System
,	O
Compare-and-swap	B-Operating_System
,	O
or	O
Load-Link/Store	B-Operating_System
-Conditional	I-Operating_System
,	O
together	O
with	O
memory	B-General_Concept
barriers	I-General_Concept
.	O
</s>
<s>
Portable	O
operating	B-General_Concept
systems	I-General_Concept
cannot	O
simply	O
block	O
interrupts	O
to	O
implement	O
synchronization	O
,	O
since	O
hardware	O
that	O
lacks	O
concurrent	O
execution	O
such	O
as	O
hyper-threading	B-Operating_System
or	O
multi-processing	B-Operating_System
is	O
now	O
extremely	O
rare	O
.	O
</s>
