Home

swapin

Swapin is the process by which a memory page that has been moved to secondary storage is loaded back into main memory. It is the counterpart to swapout. In systems that use virtual memory, pages may be written to swap space to free RAM for active processes, and later swapped back in when they are accessed again. Swapin occurs when a page fault references a swapped-out page, prompting the operating system to recover it from storage.

When swapin happens, the operating system locates the page within the swap area, allocates a free physical

Swapin is slower than regular RAM access because it requires disk I/O. High levels of swap activity

In modern operating systems, swapin is an integral part of memory management, interacting with swapout, page

See also: swapout, page fault, swap cache, swappiness, zram.

frame,
and
reads
the
page
from
disk
into
memory.
The
page
table
entry
for
that
page
is
updated
to
mark
it
present,
and
the
process’s
TLB
and
caches
are
updated
accordingly.
If
a
swap
cache
is
used,
the
system
may
reuse
a
cached
copy
to
accelerate
subsequent
accesses.
The
exact
timing
and
performance
of
swapin
depend
on
memory
pressure,
disk
speed,
and
I/O
scheduling.
can
lead
to
thrashing,
where
the
system
spends
most
of
its
time
swapping
pages
in
and
out
rather
than
doing
productive
work.
Tuning
parameters
such
as
swappiness,
I/O
scheduler
choices,
and
the
use
of
alternative
swap
devices
(for
example,
compressed
RAM-based
swap)
influence
swapin
performance.
faults,
and
the
page
cache.
Its
efficiency
affects
overall
responsiveness
under
memory
pressure,
particularly
on
systems
with
limited
physical
memory
or
slow
storage.