*** Welcome to piglix ***

Page size


A page, memory page, or virtual page is a fixed-length contiguous block of virtual memory, described by a single entry in the page table. It is the smallest unit of data for memory management in a virtual memory operating system. Similarly, a page frame is the smallest fixed-length contiguous block of physical memory into which memory pages are mapped by the operating system.

A transfer of pages between main memory and an auxiliary store, such as a hard disk drive, is referred to as paging or swapping.

Page size is usually determined by processor architecture. Traditionally, pages in a system had uniform size, for example 4096 bytes. However, processor designs often allow two or more, sometimes simultaneous, page sizes due to the benefits and penalties. There are several points that can factor into choosing the best page size.

Most operating systems allow programs to discover the page size at runtime. This allows programs to use memory more efficiently by aligning allocations to this size and reducing overall internal fragmentation of pages.

Unix and POSIX-based systems may use the system function sysconf(), as illustrated in the following example written in the C programming language.

In many Unix systems the command line utility getconf can be used. For example, getconf PAGESIZE will return the page size in bytes.

Win32-based operating systems, such as those in the Windows 9x and Windows NT families, may use the system function GetSystemInfo() from kernel32.dll.

Huge page size depends on processor architecture, processor type, and operating (addressing) mode. The operating system selects one from the sizes supported by the architecture. Note that not all processors implement all defined Huge/Large page sizes.

Some instruction set architectures can support multiple page sizes, including pages significantly larger than the standard page size. Starting with the Pentium Pro, x86 processors support 4 MiB pages (called Page Size Extension) (2 MiB pages if using PAE) in addition to their standard 4 KiB pages; newer x86-64 processors, such as AMD's newer AMD64 processors and Intel's Westmere and later Xeon processors can use 1 GiB pages in long mode. IA-64 supports as many as eight different page sizes, from 4 KiB up to 256 MiB, and some other architectures have similar features. This support for huge pages (known as superpages in FreeBSD, and large pages in Microsoft Windows terminology) allows for "the best of both worlds", reducing the pressure on the TLB cache (sometimes increasing speed by as much as 15%, depending on the application and the allocation size) for large allocations while still keeping memory usage at a reasonable level for small allocations.


...
Wikipedia

...