<s>
A	O
page	O
,	O
memory	B-General_Concept
page	I-General_Concept
,	O
or	O
virtual	B-General_Concept
page	I-General_Concept
is	O
a	O
fixed-length	O
contiguous	O
block	O
of	O
virtual	B-Architecture
memory	I-Architecture
,	O
described	O
by	O
a	O
single	O
entry	O
in	O
the	O
page	B-General_Concept
table	I-General_Concept
.	O
</s>
<s>
It	O
is	O
the	O
smallest	O
unit	O
of	O
data	O
for	O
memory	O
management	O
in	O
a	O
virtual	B-Architecture
memory	I-Architecture
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
Similarly	O
,	O
a	O
page	B-General_Concept
frame	I-General_Concept
is	O
the	O
smallest	O
fixed-length	O
contiguous	O
block	O
of	O
physical	O
memory	O
into	O
which	O
memory	B-General_Concept
pages	I-General_Concept
are	O
mapped	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
A	O
transfer	O
of	O
pages	O
between	O
main	O
memory	O
and	O
an	O
auxiliary	O
store	O
,	O
such	O
as	O
a	O
hard	B-Device
disk	I-Device
drive	I-Device
,	O
is	O
referred	O
to	O
as	O
paging	B-Architecture
or	O
swapping	O
.	O
</s>
<s>
This	O
listing	O
of	O
the	O
words	O
per	O
page	O
of	O
the	O
book	O
is	O
analogous	O
to	O
a	O
page	B-General_Concept
table	I-General_Concept
of	O
a	O
computer	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
Page	B-General_Concept
size	I-General_Concept
is	O
usually	O
determined	O
by	O
the	O
processor	O
architecture	O
.	O
</s>
<s>
Traditionally	O
,	O
pages	O
in	O
a	O
system	O
had	O
uniform	O
size	O
,	O
such	O
as	O
4,096	O
bytes	B-Application
.	O
</s>
<s>
However	O
,	O
processor	O
designs	O
often	O
allow	O
two	O
or	O
more	O
,	O
sometimes	O
simultaneous	O
,	O
page	B-General_Concept
sizes	I-General_Concept
due	O
to	O
its	O
benefits	O
.	O
</s>
<s>
There	O
are	O
several	O
points	O
that	O
can	O
factor	O
into	O
choosing	O
the	O
best	O
page	B-General_Concept
size	I-General_Concept
.	O
</s>
<s>
A	O
system	O
with	O
a	O
smaller	O
page	B-General_Concept
size	I-General_Concept
uses	O
more	O
pages	O
,	O
requiring	O
a	O
page	B-General_Concept
table	I-General_Concept
that	O
occupies	O
more	O
space	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
a	O
232	O
virtual	O
address	O
space	O
is	O
mapped	O
to	O
4KiB	O
(	O
212	O
bytes	B-Application
)	O
pages	O
,	O
the	O
number	O
of	O
virtual	B-General_Concept
pages	I-General_Concept
is	O
220	O
=	O
(	O
232/	O
212	O
)	O
.	O
</s>
<s>
However	O
,	O
if	O
the	O
page	B-General_Concept
size	I-General_Concept
is	O
increased	O
to	O
32KiB	O
(	O
215	O
bytes	B-Application
)	O
,	O
only	O
217	O
pages	O
are	O
required	O
.	O
</s>
<s>
A	O
multi-level	O
paging	B-Architecture
algorithm	O
can	O
decrease	O
the	O
memory	O
cost	O
of	O
allocating	O
a	O
large	O
page	B-General_Concept
table	I-General_Concept
for	O
each	O
process	O
by	O
further	O
dividing	O
the	O
page	B-General_Concept
table	I-General_Concept
up	O
into	O
smaller	O
tables	O
,	O
effectively	O
paging	B-Architecture
the	O
page	B-General_Concept
table	I-General_Concept
.	O
</s>
<s>
Since	O
every	O
access	O
to	O
memory	O
must	O
be	O
mapped	O
from	O
virtual	O
to	O
physical	O
address	O
,	O
reading	O
the	O
page	B-General_Concept
table	I-General_Concept
every	O
time	O
can	O
be	O
quite	O
costly	O
.	O
</s>
<s>
Therefore	O
,	O
a	O
very	O
fast	O
kind	O
of	O
cache	O
,	O
the	O
translation	B-Architecture
lookaside	I-Architecture
buffer	I-Architecture
(	O
TLB	O
)	O
,	O
is	O
often	O
used	O
.	O
</s>
<s>
The	O
TLB	O
is	O
of	O
limited	O
size	O
,	O
and	O
when	O
it	O
cannot	O
satisfy	O
a	O
given	O
request	O
(	O
a	O
TLB	O
miss	O
)	O
the	O
page	B-General_Concept
tables	I-General_Concept
must	O
be	O
searched	O
manually	O
(	O
either	O
in	O
hardware	O
or	O
software	O
,	O
depending	O
on	O
the	O
architecture	O
)	O
for	O
the	O
correct	O
mapping	O
.	O
</s>
<s>
Larger	O
page	B-General_Concept
sizes	I-General_Concept
mean	O
that	O
a	O
TLB	B-Architecture
cache	I-Architecture
of	O
the	O
same	O
size	O
can	O
keep	O
track	O
of	O
larger	O
amounts	O
of	O
memory	O
,	O
which	O
avoids	O
the	O
costly	O
TLB	O
misses	O
.	O
</s>
<s>
Larger	O
page	B-General_Concept
sizes	I-General_Concept
lead	O
to	O
a	O
large	O
amount	O
of	O
wasted	O
memory	O
,	O
as	O
more	O
potentially	O
unused	O
portions	O
of	O
memory	O
are	O
loaded	O
into	O
the	O
main	O
memory	O
.	O
</s>
<s>
Smaller	O
page	B-General_Concept
sizes	I-General_Concept
ensure	O
a	O
closer	O
match	O
to	O
the	O
actual	O
amount	O
of	O
memory	O
required	O
in	O
an	O
allocation	O
.	O
</s>
<s>
As	O
an	O
example	O
,	O
assume	O
the	O
page	B-General_Concept
size	I-General_Concept
is	O
1024KiB	O
.	O
</s>
<s>
Most	O
operating	B-General_Concept
systems	I-General_Concept
allow	O
programs	O
to	O
discover	O
the	O
page	B-General_Concept
size	I-General_Concept
at	B-Library
runtime	I-Library
.	O
</s>
<s>
Unix	B-Application
and	O
POSIX-based	O
systems	O
may	O
use	O
the	O
system	O
function	O
sysconf( )	O
,	O
as	O
illustrated	O
in	O
the	O
following	O
example	O
written	O
in	O
the	B-Language
C	I-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
In	O
many	O
Unix	B-Application
systems	I-Application
,	O
the	O
command-line	O
utility	O
getconf	O
can	O
be	O
used	O
.	O
</s>
<s>
For	O
example	O
,	O
getconf	O
PAGESIZE	O
will	O
return	O
the	O
page	B-General_Concept
size	I-General_Concept
in	O
bytes	B-Application
.	O
</s>
<s>
Win32-based	O
operating	B-General_Concept
systems	I-General_Concept
,	O
such	O
as	O
those	O
in	O
the	O
Windows	O
9x	O
and	O
Windows	B-Device
NT	I-Device
families	I-Device
,	O
may	O
use	O
the	O
system	O
function	O
GetSystemInfo( )	O
from	O
kernel32.dll	O
.	O
</s>
<s>
Some	O
instruction	B-General_Concept
set	I-General_Concept
architectures	I-General_Concept
can	O
support	O
multiple	O
page	B-General_Concept
sizes	I-General_Concept
,	O
including	O
pages	O
significantly	O
larger	O
than	O
the	O
standard	O
page	B-General_Concept
size	I-General_Concept
.	O
</s>
<s>
The	O
available	O
page	B-General_Concept
sizes	I-General_Concept
depend	O
on	O
the	O
instruction	B-General_Concept
set	I-General_Concept
architecture	I-General_Concept
,	O
processor	O
type	O
,	O
and	O
operating	O
(	O
addressing	O
)	O
mode	O
.	O
</s>
<s>
The	O
operating	B-General_Concept
system	I-General_Concept
selects	O
one	O
or	O
more	O
sizes	O
from	O
the	O
sizes	O
supported	O
by	O
the	O
architecture	O
.	O
</s>
<s>
Note	O
that	O
not	O
all	O
processors	O
implement	O
all	O
defined	O
larger	O
page	B-General_Concept
sizes	I-General_Concept
.	O
</s>
<s>
This	O
support	O
for	O
larger	O
pages	O
(	O
known	O
as	O
"	O
huge	O
pages	O
"	O
in	O
Linux	B-Application
,	O
"	O
superpages	O
"	O
in	O
FreeBSD	B-Operating_System
,	O
and	O
"	O
large	O
pages	O
"	O
in	O
Microsoft	B-Application
Windows	I-Application
and	O
IBM	B-Application
AIX	I-Application
terminology	O
)	O
allows	O
for	O
"	O
the	O
best	O
of	O
both	O
worlds	O
"	O
,	O
reducing	O
the	O
pressure	O
on	O
the	O
TLB	B-Architecture
cache	I-Architecture
(	O
sometimes	O
increasing	O
speed	O
by	O
as	O
much	O
as	O
15%	O
)	O
for	O
large	O
allocations	O
while	O
still	O
keeping	O
memory	O
usage	O
at	O
a	O
reasonable	O
level	O
for	O
small	O
allocations	O
.	O
</s>
<s>
+	O
Page	B-General_Concept
sizes	I-General_Concept
among	O
architectures	O
Architecture	O
Smallest	O
page	B-General_Concept
size	I-General_Concept
Larger	O
page	B-General_Concept
sizes	I-General_Concept
32-bit	O
x86	B-Operating_System
4	O
KiB	O
4	O
MiB	O
in	O
PSE	B-General_Concept
mode	I-General_Concept
,	O
2	O
MiB	O
in	O
PAE	B-General_Concept
mode	O
x86-64	B-Device
4	O
KiB	O
2	O
MiB	O
,	O
1	O
GiB	O
(	O
only	O
when	O
the	O
CPU	O
has	O
PDPE1GB	O
flag	O
)	O
IA-64	B-General_Concept
(	O
Itanium	B-General_Concept
)	O
4	O
KiB	O
8	O
KiB	O
,	O
64	O
KiB	O
,	O
256	O
KiB	O
,	O
1	O
MiB	O
,	O
4	O
MiB	O
,	O
16	O
MiB	O
,	O
256	O
MiB	O
Power	B-Architecture
ISA	I-Architecture
4	O
KiB	O
64	O
KiB	O
,	O
16	O
MiB	O
,	O
16	O
GiB	O
SPARC	B-Architecture
v8	I-Architecture
with	O
SPARC	B-Architecture
Reference	O
MMU	O
4	O
KiB	O
256	O
KiB	O
,	O
16	O
MiB	O
UltraSPARC	O
Architecture	O
2007	O
8	O
KiB	O
64	O
KiB	O
,	O
512	O
KiB	O
(	O
optional	O
)	O
,	O
4	O
MiB	O
,	O
32	O
MiB	O
(	O
optional	O
)	O
,	O
256	O
MiB	O
(	O
optional	O
)	O
,	O
2	O
GiB	O
(	O
optional	O
)	O
,	O
16	O
GiB	O
(	O
optional	O
)	O
ARMv7	O
4	O
KiB	O
64	O
KiB	O
,	O
1	O
MiB	O
(	O
"	O
section	O
"	O
)	O
,	O
16	O
MiB	O
(	O
"	O
supersection	O
"	O
)	O
(	O
defined	O
by	O
a	O
particular	O
implementation	O
)	O
AArch64	B-Architecture
4	O
KiB	O
,	O
16	O
KiB	O
,	O
64	O
KiB	O
2	O
MiB	O
,	O
32	O
MiB	O
,	O
512	O
MiB	O
,	O
1	O
GiBRISCV324	O
KiB4	O
MiB	O
(	O
"	O
megapage	O
"	O
)	O
RISCV644	O
KiB2	O
MiB	O
(	O
"	O
megapage	O
"	O
)	O
,	O
1	O
GiB	O
(	O
"	O
gigapage	O
"	O
)	O
,	O
512	O
GiB	O
(	O
"	O
terapage	O
"	O
,	O
only	O
for	O
CPUs	O
with	O
43-bit	O
address	O
space	O
or	O
more	O
)	O
,	O
256	O
TiB	O
(	O
"	O
petapage	O
"	O
,	O
only	O
for	O
CPUs	O
with	O
57-bit	O
address	O
space	O
or	O
more	O
)	O
,	O
</s>
<s>
Starting	O
with	O
the	O
Pentium	B-Device
Pro	I-Device
,	O
and	O
the	O
AMD	B-Architecture
Athlon	I-Architecture
,	O
x86	B-Operating_System
processors	O
support	O
4MiB	O
pages	O
(	O
called	O
Page	B-General_Concept
Size	I-General_Concept
Extension	I-General_Concept
)	O
(	O
2MiB	O
pages	O
if	O
using	O
PAE	B-General_Concept
)	O
in	O
addition	O
to	O
their	O
standard	O
4KiB	O
pages	O
;	O
newer	O
x86-64	B-Device
processors	O
,	O
such	O
as	O
AMD	O
's	O
newer	O
AMD64	B-Device
processors	O
and	O
Intel	O
's	O
Westmere	B-Device
and	O
later	O
Xeon	B-Device
processors	O
can	O
use	O
1GiB	O
pages	O
in	O
long	B-Application
mode	I-Application
.	O
</s>
<s>
IA-64	B-General_Concept
supports	O
as	O
many	O
as	O
eight	O
different	O
page	B-General_Concept
sizes	I-General_Concept
,	O
from	O
4KiB	O
up	O
to	O
256MiB	O
,	O
and	O
some	O
other	O
architectures	O
have	O
similar	O
features	O
.	O
</s>
<s>
Larger	O
pages	O
,	O
despite	O
being	O
available	O
in	O
the	O
processors	O
used	O
in	O
most	O
contemporary	O
personal	B-Device
computers	I-Device
,	O
are	O
not	O
in	O
common	O
use	O
except	O
in	O
large-scale	O
applications	O
,	O
the	O
applications	O
typically	O
found	O
in	O
large	O
servers	O
and	O
in	O
computational	B-Architecture
clusters	I-Architecture
,	O
and	O
in	O
the	O
operating	B-General_Concept
system	I-General_Concept
itself	O
.	O
</s>
<s>
Commonly	O
,	O
their	O
use	O
requires	O
elevated	O
privileges	O
,	O
cooperation	O
from	O
the	O
application	O
making	O
the	O
large	O
allocation	O
(	O
usually	O
setting	O
a	O
flag	O
to	O
ask	O
the	O
operating	B-General_Concept
system	I-General_Concept
for	O
huge	O
pages	O
)	O
,	O
or	O
manual	O
administrator	O
configuration	O
;	O
operating	B-General_Concept
systems	I-General_Concept
commonly	O
,	O
sometimes	O
by	O
design	O
,	O
cannot	O
page	O
them	O
out	O
to	O
disk	O
.	O
</s>
<s>
However	O
,	O
SGI	B-Operating_System
IRIX	I-Operating_System
has	O
general-purpose	O
support	O
for	O
multiple	O
page	B-General_Concept
sizes	I-General_Concept
.	O
</s>
<s>
Each	O
individual	O
process	O
can	O
provide	O
hints	O
and	O
the	O
operating	B-General_Concept
system	I-General_Concept
will	O
automatically	O
use	O
the	O
largest	O
page	B-General_Concept
size	I-General_Concept
possible	O
for	O
a	O
given	O
region	O
of	O
address	O
space	O
.	O
</s>
<s>
Later	O
work	O
proposed	O
transparent	O
operating	B-General_Concept
system	I-General_Concept
support	O
for	O
using	O
a	O
mix	O
of	O
page	B-General_Concept
sizes	I-General_Concept
for	O
unmodified	O
applications	O
through	O
preemptible	O
reservations	O
,	O
opportunistic	O
promotions	O
,	O
speculative	O
demotions	O
,	O
and	O
fragmentation	O
control	O
.	O
</s>
<s>
Linux	B-Application
has	O
supported	O
huge	O
pages	O
on	O
several	O
architectures	O
since	O
the	O
2.6	O
series	O
via	O
the	O
hugetlbfs	O
filesystem	B-Application
and	O
without	O
hugetlbfs	O
since	O
2.6.38	O
.	O
</s>
<s>
Windows	B-Application
Server	I-Application
2003	I-Application
(	O
SP1	O
and	O
newer	O
)	O
,	O
Windows	B-Application
Vista	I-Application
and	O
Windows	B-Device
Server	I-Device
2008	I-Device
support	O
huge	O
pages	O
under	O
the	O
name	O
of	O
large	O
pages	O
.	O
</s>
<s>
Windows	B-Application
2000	I-Application
and	O
Windows	B-Application
XP	I-Application
support	O
large	O
pages	O
internally	O
,	O
but	O
do	O
not	O
expose	O
them	O
to	O
applications	O
.	O
</s>
<s>
Beginning	O
with	O
version	O
9	O
,	O
Solaris	B-Application
supports	O
large	O
pages	O
on	O
SPARC	B-Architecture
and	O
x86	B-Operating_System
.	O
</s>
<s>
FreeBSD	B-Operating_System
7.2-RELEASE	O
features	O
superpages	O
.	O
</s>
<s>
Note	O
that	O
until	O
recently	O
in	O
Linux	B-Application
,	O
applications	O
needed	O
to	O
be	O
modified	O
in	O
order	O
to	O
use	O
huge	O
pages	O
.	O
</s>
<s>
On	O
Linux	B-Application
kernels	O
supporting	O
transparent	O
huge	O
pages	O
,	O
as	O
well	O
as	O
FreeBSD	B-Operating_System
and	O
Solaris	B-Application
,	O
applications	O
take	O
advantage	O
of	O
huge	O
pages	O
automatically	O
,	O
without	O
the	O
need	O
for	O
modification	O
.	O
</s>
