<s>
Wear	B-Application
leveling	I-Application
(	O
also	O
written	O
as	O
wear	B-Application
levelling	I-Application
)	O
is	O
a	O
technique	O
for	O
prolonging	O
the	O
service	O
life	O
of	O
some	O
kinds	O
of	O
erasable	O
computer	B-General_Concept
storage	I-General_Concept
media	O
,	O
such	O
as	O
flash	B-Device
memory	I-Device
,	O
which	O
is	O
used	O
in	O
solid-state	B-Device
drives	I-Device
(	O
SSDs	B-Device
)	O
and	O
USB	O
flash	O
drives	O
,	O
and	O
phase-change	B-Device
memory	I-Device
.	O
</s>
<s>
There	O
are	O
several	O
wear	B-Application
leveling	I-Application
mechanisms	O
that	O
provide	O
varying	O
levels	O
of	O
longevity	O
enhancement	O
in	O
such	O
memory	O
systems	O
.	O
</s>
<s>
The	O
term	O
preemptive	B-Application
wear	I-Application
leveling	I-Application
(	O
PWL	O
)	O
has	O
been	O
used	O
by	O
Western	O
Digital	O
to	O
describe	O
their	O
preservation	O
technique	O
used	O
on	O
hard	B-Device
disk	I-Device
drives	I-Device
(	O
HDDs	O
)	O
designed	O
for	O
storing	O
audio	O
and	O
video	O
data	O
.	O
</s>
<s>
EEPROM	B-General_Concept
and	O
flash	B-Device
memory	I-Device
media	O
have	O
individually	O
erasable	O
segments	O
,	O
each	O
of	O
which	O
can	O
be	O
put	O
through	O
a	O
limited	O
number	O
of	O
erase	O
cycles	O
before	O
becoming	O
unreliable	O
.	O
</s>
<s>
This	O
is	O
usually	O
around	O
3,000	O
/5	O
,	O
000	O
cycles	O
but	O
many	O
flash	O
devices	O
have	O
one	O
block	O
with	O
a	O
specially	O
extended	O
life	O
of	O
100,000	O
+	O
cycles	O
that	O
can	O
be	O
used	O
by	O
the	O
Flash	B-Device
memory	I-Device
controller	I-Device
to	O
track	O
wear	O
and	O
movement	O
of	O
data	O
across	O
segments	O
.	O
</s>
<s>
Erasable	O
optical	B-Device
media	I-Device
such	O
as	O
CD-RW	O
and	O
DVD-RW	O
are	O
rated	O
at	O
up	O
to	O
1,000	O
cycles	O
(	O
100,000	O
cycles	O
for	O
DVD-RAM	O
media	O
)	O
.	O
</s>
<s>
Wear	B-Application
leveling	I-Application
attempts	O
to	O
work	O
around	O
these	O
limitations	O
by	O
arranging	O
data	O
so	O
that	O
erasures	O
and	O
re-writes	O
are	O
distributed	O
evenly	O
across	O
the	O
medium	O
.	O
</s>
<s>
In	O
flash	B-Device
memory	I-Device
,	O
a	O
single	O
block	O
on	O
the	O
chip	O
is	O
designed	O
for	O
longer	O
life	O
than	O
the	O
others	O
so	O
that	O
the	O
memory	O
controller	O
can	O
store	O
operational	O
data	O
with	O
less	O
chance	O
of	O
its	O
corruption	O
.	O
</s>
<s>
Conventional	O
file	B-Application
systems	I-Application
such	O
as	O
FAT	B-Application
,	O
UFS	B-Operating_System
,	O
HFS/HFS	O
+	O
,	O
EXT	B-Application
,	O
and	O
NTFS	B-Application
were	O
originally	O
designed	O
for	O
magnetic	O
disks	O
and	O
as	O
such	O
rewrite	O
many	O
of	O
their	O
data	O
structures	O
(	O
such	O
as	O
their	O
directories	O
)	O
repeatedly	O
to	O
the	O
same	O
area	O
.	O
</s>
<s>
When	O
these	O
systems	O
are	O
used	O
on	O
flash	B-Device
memory	I-Device
media	O
,	O
this	O
becomes	O
a	O
problem	O
.	O
</s>
<s>
The	O
problem	O
is	O
aggravated	O
by	O
the	O
fact	O
that	O
some	O
file	B-Application
systems	I-Application
track	O
last-access	O
times	O
,	O
which	O
can	O
lead	O
to	O
file	O
metadata	O
being	O
constantly	O
rewritten	O
in-place	O
.	O
</s>
<s>
There	O
are	O
three	O
basic	O
types	O
of	O
wear	B-Application
leveling	I-Application
mechanisms	O
used	O
in	O
flash	B-Device
memory	I-Device
storage	O
devices	O
:	O
</s>
<s>
A	O
flash	B-Device
memory	I-Device
storage	B-General_Concept
system	I-General_Concept
with	O
no	O
wear	B-Application
leveling	I-Application
will	O
not	O
last	O
very	O
long	O
if	O
data	O
is	O
written	O
to	O
the	O
flash	O
.	O
</s>
<s>
Without	O
wear	B-Application
leveling	I-Application
,	O
the	O
underlying	O
flash	B-Device
controller	I-Device
must	O
permanently	O
assign	O
the	O
logical	O
addresses	O
from	O
the	O
operating	B-General_Concept
system	I-General_Concept
(	O
OS	O
)	O
to	O
the	O
physical	O
addresses	O
of	O
the	O
flash	B-Device
memory	I-Device
.	O
</s>
<s>
The	O
first	O
type	O
of	O
wear	B-Application
leveling	I-Application
is	O
called	O
dynamic	B-Application
wear	I-Application
leveling	I-Application
and	O
it	O
uses	O
a	O
map	O
to	O
link	O
logical	O
block	O
addresses	O
(	O
LBAs	O
)	O
from	O
the	O
OS	O
to	O
the	O
physical	O
flash	B-Device
memory	I-Device
.	O
</s>
<s>
Each	O
time	O
a	O
block	O
of	O
data	O
is	O
re-written	O
to	O
the	O
flash	B-Device
memory	I-Device
,	O
it	O
is	O
written	O
to	O
a	O
new	O
location	O
.	O
</s>
<s>
However	O
,	O
flash	B-Device
memory	I-Device
blocks	O
that	O
never	O
get	O
replacement	O
data	O
would	O
sustain	O
no	O
additional	O
wear	O
,	O
thus	O
the	O
name	O
comes	O
only	O
from	O
the	O
dynamic	O
data	O
being	O
recycled	O
.	O
</s>
<s>
Such	O
a	O
device	O
may	O
last	O
longer	O
than	O
one	O
with	O
no	O
wear	B-Application
leveling	I-Application
,	O
but	O
there	O
are	O
blocks	O
still	O
remaining	O
as	O
active	O
even	O
though	O
the	O
device	O
is	O
no	O
longer	O
operable	O
.	O
</s>
<s>
The	O
other	O
type	O
of	O
wear	B-Application
leveling	I-Application
is	O
called	O
static	B-Application
wear	I-Application
leveling	I-Application
which	O
also	O
uses	O
a	O
map	O
to	O
link	O
the	O
LBA	O
to	O
physical	O
memory	O
addresses	O
.	O
</s>
<s>
Static	B-Application
wear	I-Application
leveling	I-Application
works	O
the	O
same	O
as	O
dynamic	B-Application
wear	I-Application
leveling	I-Application
except	O
the	O
static	O
blocks	O
that	O
do	O
not	O
change	O
are	O
periodically	O
moved	O
so	O
that	O
these	O
low	O
usage	O
cells	O
are	O
able	O
to	O
be	O
used	O
by	O
other	O
data	O
.	O
</s>
<s>
This	O
rotational	O
effect	O
enables	O
an	O
SSD	B-Device
to	O
continue	O
to	O
operate	O
until	O
most	O
of	O
the	O
blocks	O
are	O
near	O
their	O
end	O
of	O
life	O
.	O
</s>
<s>
Both	O
dynamic	O
and	O
static	B-Application
wear	I-Application
leveling	I-Application
are	O
implemented	O
at	O
the	O
local	O
level	O
.	O
</s>
<s>
The	O
number	O
of	O
defective	O
blocks	O
in	O
different	O
chips	O
within	O
a	O
NAND	O
flash	B-Device
memory	I-Device
varies	O
:	O
a	O
given	O
chip	O
could	O
have	O
all	O
its	O
data	O
blocks	O
worn	O
out	O
while	O
another	O
chip	O
in	O
the	O
same	O
device	O
could	O
have	O
all	O
its	O
blocks	O
still	O
active	O
.	O
</s>
<s>
Global	O
wear	B-Application
leveling	I-Application
addresses	O
this	O
problem	O
by	O
managing	O
all	O
blocks	O
from	O
all	O
chips	O
in	O
the	O
flash	B-Device
memory	I-Device
together	O
―	O
in	O
a	O
single	O
pool	O
.	O
</s>
<s>
The	O
following	O
table	O
compares	O
static	O
and	O
dynamic	B-Application
wear	I-Application
leveling	I-Application
:	O
</s>
<s>
A	O
checksum	O
or	O
error-correcting	B-Error_Name
code	O
can	O
be	O
kept	O
for	O
each	O
block	O
or	O
sector	O
in	O
order	O
to	O
detect	O
errors	O
or	O
correct	O
errors	O
.	O
</s>
<s>
Blocks	O
or	O
sectors	O
on	O
the	O
media	O
can	O
be	O
tracked	O
in	O
a	O
least	B-General_Concept
frequently	I-General_Concept
used	I-General_Concept
(	O
LFU	O
)	O
queue	O
.	O
</s>
<s>
The	O
data	O
structures	O
for	O
the	O
queue	O
itself	O
must	O
either	O
be	O
stored	O
off-device	O
or	O
in	O
such	O
a	O
way	O
that	O
the	O
space	O
it	O
uses	O
is	O
itself	O
wear-leveled	O
or	O
,	O
in	O
the	O
case	O
of	O
flash	B-Device
memory	I-Device
,	O
in	O
a	O
block	O
with	O
a	O
specially	O
extended	O
life	O
.	O
</s>
<s>
However	O
,	O
usual	O
cache	B-General_Concept
algorithms	I-General_Concept
are	O
designed	O
to	O
manage	O
the	O
data	O
flow	O
into	O
and	O
out	O
of	O
RAM-based	O
caches	O
,	O
making	O
them	O
not	O
directly	O
suitable	O
for	O
flash-based	B-Device
storage	O
devices	O
as	O
they	O
have	O
an	O
asymmetrical	O
nature	O
reads	O
are	O
usually	O
much	O
faster	O
than	O
writes	O
,	O
and	O
erase	O
operations	O
can	O
be	O
performed	O
only	O
one	O
"	O
block	O
"	O
at	O
a	O
time	O
.	O
</s>
<s>
On	O
Secure	B-Device
Digital	I-Device
cards	I-Device
and	O
USB	O
flash	O
drives	O
,	O
techniques	O
are	O
implemented	O
in	O
hardware	O
by	O
a	O
built-in	O
microcontroller	B-Architecture
.	O
</s>
<s>
On	O
such	O
devices	O
,	O
wear	B-Application
leveling	I-Application
is	O
transparent	B-Operating_System
,	O
and	O
conventional	O
file	B-Application
system	I-Application
such	O
as	O
FAT	B-Application
can	O
be	O
used	O
on	O
them	O
as-is	O
.	O
</s>
<s>
Wear	B-Application
leveling	I-Application
can	O
also	O
be	O
implemented	O
in	O
software	O
by	O
special-purpose	O
file	B-Application
systems	I-Application
such	O
as	O
JFFS2	B-Application
and	O
YAFFS	B-Application
on	O
flash	B-Device
media	I-Device
or	O
UDF	O
on	O
optical	B-Device
media	I-Device
.	O
</s>
<s>
All	O
three	O
are	O
log-structured	B-Application
file	I-Application
systems	I-Application
in	O
that	O
they	O
treat	O
their	O
media	O
as	O
circular	O
logs	O
and	O
write	O
to	O
them	O
in	O
sequential	O
passes	O
.	O
</s>
<s>
File	B-Application
systems	I-Application
which	O
implement	O
copy-on-write	B-Language
strategies	O
,	O
such	O
as	O
ZFS	B-Application
,	O
also	O
implement	O
a	O
form	O
of	O
wear	B-Application
leveling	I-Application
.	O
</s>
