Virtual Memory - Paging or Swapping


A transfer of pages between main memory (RAM) and an secondary storage such as hard disk drive, is referred to as paging or swapping.

It's the ability to use the disk to extend the amount of RAM available.

When an operating system or executive uses paging, the paging mechanism is transparent to an application program. All that the application sees is a linear address space.

The linear address space can only be paged when using:


  • In virtual memory management. Over time, the operating system may “swap out” some of a process’ resident memory, according to a least-recently-used algorithm, to make room for other code or data. Thus, a process’ resident memory size may fluctuate independently of its virtual memory size. In a properly sized host there is enough physical memory, and thus swapping is disabled and should not be observed.
  • Paging refers to writing portions, termed pages, of a process'memory to disk.
  • Swapping, strictly speaking, refers to writing the entire process, not just part, to disk.

In Linux, true swapping is exceedingly rare, therefore the terms paging and swapping often are used interchangeably.

Using swap space is not inherently bad. Rather, it's intense paging activity that's problematic. For instance, if your most-memory-intensive application is idle, it's fine for portions of it to be set aside when another large job is active. Memory pages belonging to an idle application are better set aside so the kernel can use physical memory for disk buffering.

Swap usage is a result of paging due to possible memory leaks or a high number of concurrent tasks.


IA-32 architecture’s paging mechanism

In addition, IA-32 architecture’s paging mechanism includes extensions that support:

  • Physical Address Extensions (PAE) to address physical address space greater than 4 GBytes.
  • Page Size Extensions (PSE) to map linear address to physical address in 4-MBytes pages.


Paging disabled is also known as direct mapping.

Each linear address has a one-to-one correspondence with a physical address. Linear addresses are sent out on the processor’s address lines without translation.


linear address space is divided into pages which are mapped to virtual memory.

The pages of virtual memory are then mapped as needed into physical memory.



When pages are returned to physical memory, the event is called a page-in. See Virtual Memory - Page-In


When pages are written to disk, the event is called a page-out. See Virtual Memory - Page Out


A page fault occurs when the kernel needs a page, finds it doesn't exist in physical memory because it has been paged-out, and re-reads it in from disk.

See Memory - Page Fault Exception

How to calculate the Swap Space ?

You need hard disk drives with sufficient space for swap. You can calculate the required swap space as follows:

  • For SAP application server instance, twice the main memory structure (2 x RAM) with a maximum of 20 GB
  • For the oracle database instance, you need:
    • Recommended: 3*RAM + 500 MB, at least 20 GB
    • Minimum: 2*RAM

You can display and – if required – modify the existing swap space: Linux - Swap / Paging

Powered by ComboStrap