<s>
In	O
computer	B-General_Concept
storage	I-General_Concept
,	O
disk	B-Device
buffer	I-Device
(	O
often	O
ambiguously	O
called	O
disk	O
cache	O
or	O
cache	O
buffer	B-General_Concept
)	O
is	O
the	O
embedded	O
memory	O
in	O
a	O
hard	B-Device
disk	I-Device
drive	I-Device
(	O
HDD	O
)	O
or	O
solid	B-Device
state	I-Device
drive	I-Device
(	O
SSD	B-Device
)	O
acting	O
as	O
a	O
buffer	B-General_Concept
between	O
the	O
rest	O
of	O
the	O
computer	O
and	O
the	O
physical	O
hard	B-Device
disk	I-Device
platter	I-Device
or	O
flash	B-Device
memory	I-Device
that	O
is	O
used	O
for	O
storage	O
.	O
</s>
<s>
Modern	O
hard	B-Device
disk	I-Device
drives	I-Device
come	O
with	O
8	O
to	O
256MiB	O
of	O
such	O
memory	O
,	O
and	O
solid-state	B-Device
drives	I-Device
come	O
with	O
up	O
to	O
4GB	O
of	O
cache	O
memory	O
.	O
</s>
<s>
Since	O
the	O
late	O
1980s	O
,	O
nearly	O
all	O
disks	O
sold	O
have	O
embedded	O
microcontrollers	B-Architecture
and	O
either	O
an	O
ATA	B-Protocol
,	O
Serial	O
ATA	B-Protocol
,	O
SCSI	B-Architecture
,	O
or	O
Fibre	B-Architecture
Channel	I-Architecture
interface	O
.	O
</s>
<s>
The	O
drive	O
circuitry	O
usually	O
has	O
a	O
small	O
amount	O
of	O
memory	O
,	O
used	O
to	O
store	O
the	O
data	O
going	O
to	O
and	O
coming	O
from	O
the	O
disk	B-Device
platters	I-Device
.	O
</s>
<s>
The	O
disk	B-Device
buffer	I-Device
is	O
physically	O
distinct	O
from	O
and	O
is	O
used	O
differently	O
from	O
the	O
page	B-General_Concept
cache	I-General_Concept
typically	O
kept	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
in	O
the	O
computer	O
's	O
main	O
memory	O
.	O
</s>
<s>
The	O
disk	B-Device
buffer	I-Device
is	O
controlled	O
by	O
the	O
microcontroller	B-Architecture
in	O
the	O
hard	B-Device
disk	I-Device
drive	I-Device
,	O
and	O
the	O
page	B-General_Concept
cache	I-General_Concept
is	O
controlled	O
by	O
the	O
computer	O
to	O
which	O
that	O
disk	O
is	O
attached	O
.	O
</s>
<s>
The	O
disk	B-Device
buffer	I-Device
is	O
usually	O
quite	O
small	O
,	O
ranging	O
between	O
8	O
MB	O
to	O
4	O
GB	O
,	O
and	O
the	O
page	B-General_Concept
cache	I-General_Concept
is	O
generally	O
all	O
unused	O
main	O
memory	O
.	O
</s>
<s>
While	O
data	O
in	O
the	O
page	B-General_Concept
cache	I-General_Concept
is	O
reused	O
multiple	O
times	O
,	O
the	O
data	O
in	O
the	O
disk	B-Device
buffer	I-Device
is	O
rarely	O
reused	O
.	O
</s>
<s>
In	O
this	O
sense	O
,	O
the	O
terms	O
disk	O
cache	O
and	O
cache	O
buffer	B-General_Concept
are	O
misnomers	O
;	O
the	O
embedded	O
controller	O
's	O
memory	O
is	O
more	O
appropriately	O
called	O
disk	B-Device
buffer	I-Device
.	O
</s>
<s>
Note	O
that	O
disk	B-Device
array	I-Device
controllers	I-Device
,	O
as	O
opposed	O
to	O
disk	B-General_Concept
controllers	I-General_Concept
,	O
usually	O
have	O
normal	O
cache	O
memory	O
of	O
around	O
0.58GiB	O
.	O
</s>
<s>
When	O
a	O
disk	O
's	O
controller	O
executes	O
a	O
physical	O
read	O
,	O
the	O
actuator	O
moves	O
the	O
read/write	B-Device
head	I-Device
to	O
(	O
or	O
near	O
to	O
)	O
the	O
correct	O
cylinder	O
.	O
</s>
<s>
The	O
data	O
read	O
ahead	O
of	O
request	O
during	O
this	O
wait	O
is	O
unrequested	O
but	O
free	O
,	O
so	O
typically	O
saved	O
in	O
the	O
disk	B-Device
buffer	I-Device
in	O
case	O
it	O
is	O
requested	O
later	O
.	O
</s>
<s>
The	O
speed	O
of	O
the	O
disk	O
's	O
I/O	B-General_Concept
interface	I-General_Concept
to	O
the	O
computer	O
almost	O
never	O
matches	O
the	O
speed	O
at	O
which	O
the	O
bits	O
are	O
transferred	O
to	O
and	O
from	O
the	O
hard	B-Device
disk	I-Device
platter	I-Device
.	O
</s>
<s>
The	O
disk	B-Device
buffer	I-Device
is	O
used	O
so	O
that	O
both	O
the	O
I/O	B-General_Concept
interface	I-General_Concept
and	O
the	O
disk	B-Device
read/write	I-Device
head	I-Device
can	O
operate	O
at	O
full	O
speed	O
.	O
</s>
<s>
The	O
disk	O
's	O
embedded	O
microcontroller	B-Architecture
may	O
signal	O
the	O
main	O
computer	O
that	O
a	O
disk	O
write	O
is	O
complete	O
immediately	O
after	O
receiving	O
the	O
write	O
data	O
,	O
before	O
the	O
data	O
is	O
actually	O
written	O
to	O
the	O
platter	O
.	O
</s>
<s>
This	O
can	O
be	O
somewhat	O
dangerous	O
,	O
because	O
if	O
power	O
is	O
lost	O
before	O
the	O
data	O
is	O
permanently	O
fixed	O
in	O
the	O
magnetic	O
media	O
,	O
the	O
data	O
will	O
be	O
lost	O
from	O
the	O
disk	B-Device
buffer	I-Device
,	O
and	O
the	O
file	O
system	O
on	O
the	O
disk	O
may	O
be	O
left	O
in	O
an	O
inconsistent	O
state	O
.	O
</s>
<s>
Consistency	O
can	O
be	O
maintained	O
,	O
however	O
,	O
by	O
using	O
a	O
battery-backed	O
memory	O
system	O
for	O
caching	O
data	O
,	O
although	O
this	O
is	O
typically	O
only	O
found	O
in	O
high-end	O
RAID	B-Device
controllers	I-Device
.	O
</s>
<s>
Another	O
option	O
is	O
to	O
send	O
data	O
to	O
disk	O
in	O
a	O
carefully	O
managed	O
order	O
and	O
to	O
issue	O
"	O
cache	O
flush	O
"	O
commands	O
in	O
the	O
right	O
places	O
,	O
which	O
is	O
usually	O
referred	O
to	O
as	O
the	O
implementation	O
of	O
write	B-General_Concept
barriers	I-General_Concept
.	O
</s>
<s>
Newer	O
SATA	O
and	O
most	O
SCSI	B-Architecture
disks	O
can	O
accept	O
multiple	O
commands	O
while	O
any	O
one	O
command	O
is	O
in	O
operation	O
through	O
"	O
command	O
queuing	O
"	O
(	O
see	O
NCQ	O
and	O
TCQ	O
)	O
.	O
</s>
<s>
In	O
case	O
of	O
a	O
read/write	O
FPDMA	O
command	O
with	O
Force	O
Unit	O
Access	O
(	O
FUA	O
)	O
bit	O
set	O
to	O
0	O
and	O
enabled	O
write	O
buffering	O
,	O
an	O
operating	B-General_Concept
system	I-General_Concept
may	O
see	O
the	O
write	O
operation	O
finished	O
before	O
the	O
data	O
is	O
physically	O
written	O
to	O
the	O
media	O
.	O
</s>
<s>
Data	O
that	O
was	O
accepted	O
in	O
write	O
cache	O
of	O
a	O
disk	O
device	O
will	O
be	O
eventually	O
written	O
to	O
disk	B-Device
platters	I-Device
,	O
provided	O
that	O
no	O
starvation	B-Operating_System
condition	I-Operating_System
occurs	O
as	O
a	O
result	O
of	O
firmware	O
flaw	O
,	O
and	O
that	O
disk	O
power	O
supply	O
is	O
not	O
interrupted	O
before	O
cached	O
writes	O
are	O
forced	O
to	O
disk	B-Device
platters	I-Device
.	O
</s>
<s>
In	O
order	O
to	O
control	O
write	O
cache	O
,	O
ATA	B-Protocol
specification	O
included	O
FLUSH	O
CACHE	O
(	O
E7h	O
)	O
and	O
FLUSH	O
CACHE	O
EXT	O
(	O
EAh	O
)	O
commands	O
.	O
</s>
<s>
These	O
commands	O
cause	O
the	O
disk	O
to	O
complete	O
writing	O
data	O
from	O
its	O
cache	O
,	O
and	O
disk	O
will	O
return	O
good	O
status	O
after	O
data	O
in	O
the	O
write	O
cache	O
is	O
written	O
to	O
disk	O
media	O
,	O
and	O
on	O
flash	B-Device
media	I-Device
these	O
commands	O
will	O
also	O
save	O
FTL	O
mapping	O
table	O
immediately	O
.	O
</s>
<s>
Mandatory	O
cache	O
flushing	O
is	O
used	O
in	O
Linux	B-Operating_System
for	O
implementation	O
of	O
write	B-General_Concept
barriers	I-General_Concept
in	O
some	O
filesystems	O
(	O
for	O
example	O
,	O
ext4	B-Application
)	O
,	O
together	O
with	O
Force	O
Unit	O
Access	O
write	O
command	O
for	O
journal	B-Application
commit	O
blocks	O
.	O
</s>
<s>
Force	O
Unit	O
Access	O
(	O
FUA	O
)	O
is	O
an	O
I/O	B-General_Concept
write	O
command	O
option	O
that	O
forces	O
written	O
data	O
all	O
the	O
way	O
to	O
stable	O
storage	O
.	O
</s>
<s>
FUA	O
appeared	O
in	O
the	O
SCSI	B-Architecture
command	O
set	O
,	O
and	O
was	O
later	O
adopted	O
by	O
SATA	O
with	O
NCQ	O
.	O
</s>
<s>
FUA	O
is	O
more	O
fine-grained	O
as	O
it	O
allows	O
a	O
single	O
write	O
operation	O
to	O
be	O
forced	O
to	O
stable	O
media	O
and	O
thus	O
has	O
smaller	O
overall	O
performance	O
impact	O
when	O
compared	O
to	O
commands	O
that	O
flush	O
the	O
entire	O
disk	O
cache	O
,	O
such	O
as	O
the	O
ATA	B-Protocol
FLUSH	O
CACHE	O
family	O
of	O
commands	O
.	O
</s>
<s>
Windows	O
(	O
Vista	O
and	O
up	O
)	O
supports	O
FUA	O
as	O
part	O
of	O
Transactional	O
NTFS	O
,	O
but	O
only	O
for	O
SCSI	B-Architecture
or	O
Fibre	B-Architecture
Channel	I-Architecture
disks	O
where	O
support	O
for	O
FUA	O
is	O
common	O
.	O
</s>
<s>
It	O
is	O
not	O
known	O
whether	O
a	O
SATA	O
drive	O
that	O
supports	O
FUA	O
write	O
commands	O
will	O
actually	O
honor	O
the	O
command	O
and	O
write	O
data	O
to	O
disk	B-Device
platters	I-Device
as	O
instructed	O
;	O
thus	O
,	O
Windows	O
8	O
and	O
Windows	O
Server	O
2012	O
instead	O
send	O
commands	O
to	O
flush	O
the	O
disk	O
write	O
cache	O
after	O
certain	O
write	O
operations	O
.	O
</s>
<s>
Although	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
gained	O
support	O
for	O
NCQ	O
around	O
2007	O
,	O
SATA	O
FUA	O
remains	O
disabled	O
by	O
default	O
because	O
of	O
regressions	O
that	O
were	O
found	O
in	O
2012	O
when	O
the	O
kernel	B-Operating_System
's	O
support	O
for	O
FUA	O
was	O
tested	O
.	O
</s>
<s>
The	O
Linux	B-Operating_System
kernel	I-Operating_System
supports	O
FUA	O
at	O
the	O
block	O
layer	O
level	O
.	O
</s>
