HOME

TheInfoList




In
computer A computer is a machine that can be programmed to Execution (computing), carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer program, programs. These ...

computer
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
s, memory paging is a
memory management Memory management is a form of resource management In organizational studies, resource management is the efficient and effective development of an organization's resources when they are needed. Such resources may include the financial resource ...
scheme by which a computer stores and retrieves data from
secondary storage A spindle of DVD-RW's. Computer data storage is a technology consisting of computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perfor ...
for use in
main memory Computer data storage is a technology consisting of computer components and Data storage device, recording media that are used to retain digital data (computing), data. It is a core function and fundamental component of computers. The cent ...
. In this scheme, the operating system retrieves data from secondary storage in same-size blocks called ''
pages Page most commonly refers to: * Page (paper) A page is one side of a leaf A leaf (plural leaves) is the principal lateral appendage of the vascular plant plant stem, stem, usually borne above ground and specialized for photosynthesis. T ...
''. Paging is an important part of
virtual memory In computing, virtual memory, or virtual storage is a Memory management (operating systems), memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "cre ...

virtual memory
implementations in modern operating systems, using secondary storage to let programs exceed the size of available physical memory. For simplicity, main memory is called "RAM" (an acronym of
random-access memory Random-access memory (RAM; ) is a form of computer memory In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic proces ...
) and secondary storage is called "disk" (a shorthand for
hard disk drive A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device On a reel-to-reel tape recorder (Sony TC-630), the recorder is data storage equipment and the magnetic tape is a data stora ...

hard disk drive
,
drum memory Drum memory was a magnetic data storage device On a reel-to-reel tape recorder (Sony TC-630), the recorder is data storage equipment and the magnetic tape is a data storage medium. Data Data (; ) are individual facts, statistics, ...
or
solid-state drive A solid-state drive (SSD) is a solid-state storage Solid-state storage (SSS) is a type of non-volatile computer storage that stores and retrieves digital information Digital usually refers to something using digits, particularly binary di ...
, etc.), but as with many aspects of computing, the concepts are independent of the technology used.


History

Ferranti Ferranti or Ferranti International plc was a UK electrical engineering and equipment firm that operated for over a century from 1885 until it went bankrupt in 1993. The company was once a constituent of the FTSE 100 Index. The firm was known f ...

Ferranti
introduced paging on the
Atlas Blaeu's world map, originally prepared by Joan Blaeu for his ''Atlas Maior">Joan_Blaeu.html" ;"title="world map, originally prepared by Joan Blaeu">world map, originally prepared by Joan Blaeu for his ''Atlas Maior'', published in the first b ...
, but the first mass-market memory pages were concepts in computer architecture, regardless of whether a page moved between RAM and disk. For example, on the
PDP-8 The PDP-8 is a 12-bit Possibly the best-known 12-bit CPU is the PDP-8 The PDP-8 is a 12-bit Possibly the best-known 12-bit CPU is the PDP-8 and its relatives, such as the Intersil 6100 microprocessor produced in various incarnations from Augu ...

PDP-8
, 7 of the instruction bits comprised a memory address that selected one of 128 (2) words. This zone of memory was called a ''page''. This use of the term is now rare. In the 1960s, swapping was an early virtual memory technique. An entire program would be "swapped out" (or "rolled out") from RAM to disk, and another one would be ''swapped in'' (or ''rolled in''). A swapped-out program would be current but its execution would be suspended while its RAM was in use by another program. A program might include multiple overlays that occupy the same memory at different times. Overlays are not a method of paging RAM to disk but merely of minimizing the program's RAM use. Subsequent architectures used
memory segmentation Memory segmentation is an operating system An operating system (OS) is system software that manages computer hardware, computer software, software resources, and provides common daemon (computing), services for computer programs. Time-sharing ...
, and individual program segments became the units exchanged between disk and RAM. A segment was the program's entire code segment or data segment, or sometimes other large data structures. These segments had to be
contiguous Contiguity or contiguous may refer to: *Contiguous data storage, in computer science *Contiguity (probability theory) *Contiguity (psychology) *Contiguous distribution of species, in biogeography *Geographic contiguity of territorial land *Contiguo ...
when resident in RAM, requiring additional computation and movement to remedy fragmentation. The invention of the
page table A page table is the data structure Image:Hash table 3 1 1 0 1 0 0 SP.svg, 315px, A data structure known as a hash table. In computer science, a data structure is a data organization, management, and storage format that enables efficient access ...
let the processor operate on arbitrary pages anywhere in RAM as a seemingly contiguous
logical address In computing, a logical address is the address at which an item (Computer data storage, memory cell, storage element, network host) appears to reside from the perspective of an executing application program. A logical address may be different f ...
space. These pages became the units exchanged between disk and RAM.


Page faults

When a process tries to reference a page not currently present in RAM, the processor treats this invalid memory reference as a
page fault In computing, a page fault (sometimes called PF or hard fault) is an exception that the memory management unit MMU could be used with the Motorola 68010 The Motorola MC68010 processor is a 16/32-bit microprocessor A microprocessor is a ...
and transfers control from the program to the operating system. The operating system must: # Determine the location of the data on disk. # Obtain an empty
page frame 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 pa ...
in RAM to use as a container for the data. # Load the requested data into the available page frame. # Update the
page table A page table is the data structure Image:Hash table 3 1 1 0 1 0 0 SP.svg, 315px, A data structure known as a hash table. In computer science, a data structure is a data organization, management, and storage format that enables efficient access ...
to refer to the new page frame. # Return control to the program, transparently retrying the instruction that caused the page fault. When all page frames are in use, the operating system must select a page frame to reuse for the page the program now needs. If the evicted page frame was dynamically allocated by a program to hold data, or if a program modified it since it was read into RAM (in other words, if it has become "dirty"), it must be written out to disk before being freed. If a program later references the evicted page, another page fault occurs and the page must be read back into RAM. The method the operating system uses to select the page frame to reuse, which is its
page replacement algorithm In a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer program, programs. These progr ...

page replacement algorithm
, is important to efficiency. The operating system predicts the page frame least likely to be needed soon, often through the
least recently used In computing, cache algorithms (also frequently called cache replacement algorithms or cache replacement policies) are Optimization (computer science), optimizing instructions, or algorithms, that a computer program or a hardware-maintained struc ...
(LRU) algorithm or an algorithm based on the program's
working set Working set is a concept in computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer scien ...
. To further increase responsiveness, paging systems may predict which pages will be needed soon, preemptively loading them into RAM before a program references them.


Page replacement techniques

; Demand paging : When pure demand paging is used, pages are loaded only when they are referenced. A program from a memory mapped file begins execution with none of its pages in RAM. As the program commits page faults, the operating system copies the needed pages from a file, e.g.,
memory-mapped file A memory-mapped file is a segment of virtual memory that has been assigned a direct byte-for-byte correlation with some portion of a file or file-like resource. This resource is typically a file that is physically present on disk, but can also b ...
, paging file, or a swap partition containing the page data into RAM. ; Anticipatory paging : This technique, sometimes also called ''swap prefetch,'' predicts which pages will be referenced soon, to minimize future page faults. For example, after reading a page to service a page fault, the operating system may also read the next few pages even though they are not yet needed (a prediction using
locality of reference In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
). If a program ends, the operating system may delay freeing its pages, in case the user runs the same program again. ; Free page queue, stealing, and reclamation : The free page queue is a list of page frames that are available for assignment. Preventing this queue from being empty minimizes the computing necessary to service a page fault. Some operating systems periodically look for pages that have not been recently referenced and then free the page frame and add it to the free page queue, a process known as "page stealing". Some operating systems support ''page reclamation''; if a program commits a page fault by referencing a page that was stolen, the operating system detects this and restores the page frame without having to read the contents back into RAM. ; Pre-cleaning : The operating system may periodically pre-clean dirty pages: write modified pages back to disk even though they might be further modified. This minimizes the amount of cleaning needed to obtain new page frames at the moment a new program starts or a new data file is opened, and improves responsiveness. (Unix operating systems periodically use sync to pre-clean all dirty pages; Windows operating systems use "modified page writer" threads.)


Thrashing

After completing initialization, most programs operate on a small number of code and data pages compared to the total memory the program requires. The pages most frequently accessed are called the
working set Working set is a concept in computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer scien ...
. When the working set is a small percentage of the system's total number of pages, virtual memory systems work most efficiently and an insignificant amount of computing is spent resolving page faults. As the working set grows, resolving page faults remains manageable until the growth reaches a critical point. Then faults go up dramatically and the time spent resolving them overwhelms time spent on the computing the program was written to do. This condition is referred to as thrashing. Thrashing occurs on a program that works with huge data structures, as its large working set causes continual page faults that drastically slow down the system. Satisfying page faults may require freeing pages that will soon have to be re-read from disk. "Thrashing" is also used in contexts other than virtual memory systems; for example, to describe
cache Cache, caching, or caché may refer to: Places * Cache (Aosta) Cache is a frazione of the city of Aosta, in the Aosta Valley region of Italy. Frazioni of Aosta Valley Aosta {{Aosta-geo-stub ..., a frazione in Italy * Cache Creek (disambig ...
issues in computing or
silly window syndrome Silly may refer to: Places * Silly, Belgium, a town * Silly Department, a department or commune of Sissili Province in southern Burkina Faso Music * Silly (band), an East German rock group from the 1970s * The Sillies, an American punk rock ...
in networking. A worst case might occur on
VAX VAX is a series of computers featuring a 32-bit 32-bit microcomputers are computers in which 32-bit microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrate ...
processors. A single MOVL crossing a page boundary could have a source operand using a displacement deferred addressing mode, where the longword containing the operand address crosses a page boundary, and a destination operand using a displacement deferred addressing mode, where the longword containing the operand address crosses a page boundary, and the source and destination could both cross page boundaries. This single instruction references ten pages; if not all are in RAM, each will cause a page fault. As each fault occurs the operating system needs to go through the extensive memory management routines perhaps causing multiple I/Os which might including writing other process pages to disk and reading pages of the active process from disk. If the operating system could not allocate ten pages to this program, then remedying the page fault would discard another page the instruction needs, and any restart of the instruction would fault again. To decrease excessive paging and resolve thrashing problems, a user can increase the number of pages available per program, either by running fewer programs concurrently or increasing the amount of RAM in the computer.


Sharing

In multi-programming or in a
multi-user Multi-user software is software, computer software that allows access by multiple User (computing), users of a computer. Time-sharing systems are multi-user systems. Most batch processing systems for mainframe computers may also be considered "mul ...
environment, many users may execute the same program, written so that its code and data are in separate pages. To minimize RAM use, all users share a single copy of the program. Each process's
page table A page table is the data structure Image:Hash table 3 1 1 0 1 0 0 SP.svg, 315px, A data structure known as a hash table. In computer science, a data structure is a data organization, management, and storage format that enables efficient access ...
is set up so that the pages that address code point to the single shared copy, while the pages that address data point to different physical pages for each process. Different programs might also use the same libraries. To save space, only one copy of the shared library is loaded into physical memory. Programs which use the same library have virtual addresses that map to the same pages (which contain the library's code and data). When programs want to modify the library's code, they use
copy-on-write Copy-on-write (COW), sometimes referred to as implicit sharing or shadowing, is a resource-management technique used in computer programming Computer programming is the process of designing and building an executable computer program to accomp ...
, so memory is only allocated when needed. Shared memory is an efficient way of communication between programs. Programs can share pages in memory, and then write and read to exchange data.


Implementations


Ferranti Atlas

The first computer to support paging was the supercomputer
Atlas Blaeu's world map, originally prepared by Joan Blaeu for his ''Atlas Maior">Joan_Blaeu.html" ;"title="world map, originally prepared by Joan Blaeu">world map, originally prepared by Joan Blaeu for his ''Atlas Maior'', published in the first b ...
, jointly developed by
Ferranti Ferranti or Ferranti International plc was a UK electrical engineering and equipment firm that operated for over a century from 1885 until it went bankrupt in 1993. The company was once a constituent of the FTSE 100 Index. The firm was known f ...

Ferranti
, the
University of Manchester , mottoeng = Knowledge, Wisdom, Humanity , established = 2004 – University of Manchester Predecessor institutions: 1956 – UMIST (as university college; university 1994) 1904 – Victoria University of Manchester 1880 – Victoria Univer ...

University of Manchester
and
Plessey The Plessey Company plc was a British electronics, defence and telecommunications company. It originated in 1917, growing and diversifying into electronics. It expanded after the Second World War World War II or the Second World Wa ...
in 1963. The machine had an associative ( content-addressable) memory with one entry for each 512 word page. The Supervisor handled non-equivalence interruptions and managed the transfer of pages between core and drum in order to provide a one-level store to programs.


Microsoft Windows


Windows 3.x and Windows 9x

Paging has been a feature of
Microsoft Windows Microsoft Windows, commonly referred to as Windows, is a group of several proprietary {{Short pages monitor