Page replacement algorithm

page replacementpage replacement algorithmsLRUpagingthe clairvoyant algorithm
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated.wikipedia
58 Related Articles

Paging

swap spaceswap fileswap
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated. Page replacement happens when a requested page is not in memory (page fault) and a free page cannot be used to satisfy the allocation, either because there are none, or because the number of free pages is lower than some threshold.
The method the operating system uses to select the page frame to reuse, which is its page replacement algorithm, is important to efficiency.

Virtual memory

virtual storagememoryswap
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated.
The supervisor uses one of a variety of page replacement algorithms such as least recently used to determine which page to free.

Working set

process working setworking-set model
That mostly ended with the development of sophisticated LRU (least recently used) approximations and working set algorithms.
The working set isn't a page replacement algorithm, but page-replacement algorithms can be designed to only remove pages that aren't in the working set for a particular process.

Page fault

invalid page faultmemory exceptionminor page fault
Page replacement happens when a requested page is not in memory (page fault) and a free page cannot be used to satisfy the allocation, either because there are none, or because the number of free pages is lower than some threshold.
To reduce the page faults in the system, programmers must make use of an appropriate page replacement algorithm that suits the current requirements and maximizes the page hits.

Adaptive replacement cache

ARC
Clock-Pro keeps a circular list of information about recently referenced pages, including all M pages in memory as well as the most recent M pages that have been paged out. This extra information on paged-out pages, like the similar information maintained by ARC, helps it work better than LRU on large loops and one-time scans.
Adaptive Replacement Cache (ARC) is a page replacement algorithm with

LIRS caching algorithm

LIRS
A comparison of ARC with other algorithms (LRU, MQ, 2Q, LRU-2, LRFU, LIRS) can be found in Megiddo & Modha.
LIRS (Low Inter-reference Recency Set) is a page replacement algorithm with an improved performance over LRU (Least Recently Used) and many other newer replacement algorithms.

Online algorithm

onlineofflineonline algorithms
The page replacing problem is a typical online problem from the competitive analysis perspective in the sense that the optimal deterministic algorithm is known.
Page replacement algorithm

Bélády's anomaly

This algorithm experiences Bélády's anomaly.
This phenomenon is commonly experienced when using the first-in first-out (FIFO) page replacement algorithm.

Demand paging

demand-pageddemand-pagingdemand loading
Some systems use demand paging—waiting until a page is actually requested before loading it into RAM.
Memory management with page replacement algorithms becomes slightly more complex.

Dirty bit

dirty
The lack of hardware functionality is made up for by providing two page tables – the processor-native page tables, with neither referenced bits nor dirty bits, and software-maintained page tables with the required bits present.
Dirty bits are used by the CPU cache and in the page replacement algorithms of an operating system.

Computer

computerscomputer systemdigital computer
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated.

Operating system

operating systemsOScomputer operating system
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated.

Memory management

heapdynamic memory allocationmemory allocation
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated.

Page (computer memory)

pagepagesmemory page
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated.

Kernel (operating system)

kerneloperating system kernelkernels
Requirements for page replacement algorithms have changed due to differences in operating system kernel architectures.

Journaling file system

journalingjournaljournaled
For example, they can be locked, or can have write ordering requirements imposed by journaling.

Linux

GNU/LinuxLinLinux operating system
As a result, page replacement in modern kernels (Linux, FreeBSD, and Solaris) tends to work at the level of a general purpose kernel memory allocator, rather than at the higher level of a virtual memory subsystem.

FreeBSD

*BSDFreeBSD ProjectLinux emulation
As a result, page replacement in modern kernels (Linux, FreeBSD, and Solaris) tends to work at the level of a general purpose kernel memory allocator, rather than at the higher level of a virtual memory subsystem.

Solaris (operating system)

SolarisSun SolarisSolaris operating system
As a result, page replacement in modern kernels (Linux, FreeBSD, and Solaris) tends to work at the level of a general purpose kernel memory allocator, rather than at the higher level of a virtual memory subsystem.

Locality of reference

localitydata localitycache locality
Locality of reference of user software has weakened. This is mostly attributed to the spread of object-oriented programming techniques that favor large numbers of small functions, use of sophisticated data structures like trees and hash tables that tend to result in chaotic memory reference patterns, and the advent of garbage collection that drastically changed memory access behavior of applications.

Object-oriented programming

object-orientedobject orientedobject-oriented programming language
Locality of reference of user software has weakened. This is mostly attributed to the spread of object-oriented programming techniques that favor large numbers of small functions, use of sophisticated data structures like trees and hash tables that tend to result in chaotic memory reference patterns, and the advent of garbage collection that drastically changed memory access behavior of applications.

Tree (data structure)

treetree data structuretrees
Locality of reference of user software has weakened. This is mostly attributed to the spread of object-oriented programming techniques that favor large numbers of small functions, use of sophisticated data structures like trees and hash tables that tend to result in chaotic memory reference patterns, and the advent of garbage collection that drastically changed memory access behavior of applications.

Hash table

hash tableshashhashes
Locality of reference of user software has weakened. This is mostly attributed to the spread of object-oriented programming techniques that favor large numbers of small functions, use of sophisticated data structures like trees and hash tables that tend to result in chaotic memory reference patterns, and the advent of garbage collection that drastically changed memory access behavior of applications.

Garbage collection (computer science)

garbage collectiongarbage collectorgarbage-collected
Locality of reference of user software has weakened. This is mostly attributed to the spread of object-oriented programming techniques that favor large numbers of small functions, use of sophisticated data structures like trees and hash tables that tend to result in chaotic memory reference patterns, and the advent of garbage collection that drastically changed memory access behavior of applications.

Memory management (operating systems)

partitionspartitionmemory partition
When a process incurs a page fault, a local page replacement algorithm selects for replacement some page that belongs to that same process (or a group of processes sharing a memory partition).