In computer operating systems that have their main memory divided into pages, paging (sometimes called swapping) is a transfer of pages between main memory and an auxiliary store, such as hard disk drive. A computer is a Machine that manipulates data according to a list of instructions. An operating system (commonly abbreviated OS and O/S) is the software component of a Computer system that is responsible for the management and coordination Computer data storage, often called storage or memory, refers to Computer components devices and recording media that retain digital In a context of Computer Virtual memory, a page, memory page, or virtual page is a fixed-length block of Main memory, that is contiguous A hard disk drive ( HDD) commonly referred to as a hard drive, hard disk, or fixed disk drive, is a Non-volatile storage device [1] Paging is an important part of virtual memory implementation in most contemporary general-purpose operating systems, allowing them to easily use disk storage for data that does not fit into physical RAM. Virtual memory is a Computer system technique which gives an application program the impression that it has contiguous working memory while in fact it may be physically Paging is usually implemented as a task built into the kernel of the operating system. A task is "an execution path through address space" In other words a set of program instructions that are loaded in memory. In Computer science, the kernel is the central component of most computer Operating systems (OS

## Overview

The main functions of paging are performed when a program tries to access pages that do not currently reside in RAM. This situation is known as a page fault. In Computer storage technology a page is a fixed-length block of memory that is used as a unit of transfer between Physical memory and external storage like a The Operating System must then take control and handle the page fault, in a manner invisible to the program. Therefore, the operating system must:

1. Determine the location of the data in auxiliary storage.
2. Obtain an empty page frame in RAM to use as a container for the data.
3. Load the requested data into the available page frame.
4. Return control to the program, transparently retrying the instruction that caused the page fault. In Computer science, an instruction is a single operation of a processor defined by an Instruction set architecture.

The need to reference memory at a particular address arises from two main sources:

• Processor trying to load and execute a program's instructions itself.
• Data being accessed by a program's instruction.

In step 2, when a page has to be loaded and all existing pages in RAM are currently in use, one of the existing pages must be swapped with the requested new page. The paging system must determine the page to swap by choosing one that is least likely to be needed within a short time. There are various page replacement algorithms that try to answer such issue. In a Computer Operating system that utilizes Paging for Virtual memory Memory management, page replacement algorithms decide which

Most operating systems use the least recently used (LRU) page replacement algorithm. For detailed algorithms specific to the cache between a CPU and RAM see CPU cache. The theory behind LRU is that the least recently used page is the most likely one not to be needed shortly; when a new page is needed, the least recently used page is discarded. This algorithm is most often correct but not always: e. g. a sequential process moves forward through memory and never again accesses the most recently used page.

If a page chosen to be swapped has been modified since loading (if page is dirty), it has to be written to auxiliary storage, otherwise it is simply discarded.

In addition to swapping in pages because they are necessary, in reaction to a page fault, there are several strategies for guessing what pages might be needed, and speculatively pre-loading them.

### Demand paging

Main article: Demand paging

Demand paging refuses to guess. In Computer Operating systems, demand paging is an application of Virtual memory. With demand paging, no pages are brought into RAM until necessary. In particular, with demand paging, a program usually begins execution with none of its pages pre-loaded in RAM. Pages are copied from the executable file into RAM the first time the executing code references them, usually in response to a page fault. In Computer storage technology a page is a fixed-length block of memory that is used as a unit of transfer between Physical memory and external storage like a During a particular run of a program, pages of the executable file that implement functionality not used on that particular run are never loaded.

Loader paging guesses that the entire program will be used. Many operating systems (including those with a relocating loader) load every page of a program into RAM before beginning to execute the program. In Computing, a loader is the part of an operating system that is responsible for loading programs from executables (i

### Anticipatory paging

Technique that preloads a process's nonresident pages that are likely to be referenced in the near future. Such strategies attempt to reduce the number of page faults a process experiences

### Swap prefetch

A few operating systems use anticipatory paging, also called swap prefetch. These operating systems periodically attempt to guess which pages will soon be needed, and start loading them into RAM. There are various heuristics in use, such as "if a program references one virtual address which causes a page fault, perhaps the next few pages' worth of virtual address space will soon be used" and "if one big program just finished execution, leaving lots of free RAM, perhaps the user will return to using some of the programs that were recently paged out".

### Precleaning

Unix operating systems periodically use sync to pre-clean all dirty pages. sync is a standard System call in the Unix operating system which commits to disk all data in the kernel Filesystem buffers, This makes starting a large new program run much faster, because it can be loaded into page frames that held clean pages that were dropped, rather than being loaded into page frames that were dirty and needed to be written back to disk before they were dropped.

## Thrashing

Most programs reach a steady state in their demand for memory locality both in terms of instructions fetched and data being accessed. In Computer science, thrash (verb is the term used to describe a degenerate situation on a computer where increasing resources are used to do a decreasing amount of work In Computer science, locality of reference, also known as the principle of locality, is the phenomenon of the same value or related storage locations This steady state is usually much less than the total memory required by the program. This steady state is sometimes referred to as the working set: the set of memory pages that are most frequently accessed. Peter Denning (1968 defines “the working set of information W(t \tau of a process at time t to be the collection of information referenced

Virtual memory systems work most efficiently when the ratio of the working set to the total number of pages that can be stored in RAM is low enough to minimize the number of page faults. A program that works with huge data structures will sometimes require a working set that is too large to be efficiently managed by the page system resulting in constant page faults that drastically slow down the system. This condition is referred to as thrashing: pages are swapped out and then accessed causing frequent faults. In Computer science, thrash (verb is the term used to describe a degenerate situation on a computer where increasing resources are used to do a decreasing amount of work

An interesting characteristic of thrashing is that as the working set grows, there is very little increase in the number of faults until the critical point (when faults go up dramatically and majority of system's processing power is spent on handling them).

An extreme example of this sort of situation occurred on the IBM System/360 Model 67 and IBM System/370 series mainframe computers, in which a particular instruction could consist of an execute instruction, which crosses a page boundary, that the instruction points to a move instruction, that itself also crosses a page boundary, targeting a move of data from a source that crosses a page boundary, to a target of data that also crosses a page boundary. System/360|History of CP/CMS|History of IBM The IBM System/360 Model 67 ( S/360-67) was an important IBM mainframe model in the late 1960s. The IBM System/370 (often S/370) was a model range of IBM mainframes announced on June 30, 1970 The total amount of pages thus being used by this particular instruction is eight, and all eight pages must be present in memory at the same time. If the operating system will allocate less than eight pages of actual memory in this example, when it attempts to swap out some part of the instruction or data to bring in the remainder, the instruction will again page fault, and it will thrash on every attempt to restart the failing instruction.

To decrease excessive paging, and thus possibly resolve thrashing problem, a user can do any of the following:

• Increase the amount of RAM in the computer (generally the best long-term solution).
• Decrease the number of programs being concurrently run on the computer.

The term thrashing is also used in contexts other than virtual memory systems, for example to describe cache issues in computing or silly window syndrome in networking. In Computer science, a cache (kæʃ like "cash") is a collection of data duplicating original Silly window syndrome is a problem in Computer networking caused by poorly-implemented TCP Flow control.

## Terminology differences - paging versus swapping

Historically, paging sometimes also referred simply to memory allocation scheme using fixed-length pages as opposed to variable-length segments, and without implicit suggestion that virtual memory technique is employed at all or that those pages are transferred to disk. In Computer science, dynamic memory allocation is the allocation of memory storage for use in a Computer program during the Runtime of that program In computing memory segmentation is one of the most common ways to achieve Memory protection; another common one is Paging. [2] [3] Such usage is rare today.

Some modern systems use the term swapping along with paging. Historically, swapping referred to moving from/to secondary storage a whole program at a time, in a scheme known as roll-in/roll-out. [4] [5] In 1960s, after the concept of virtual memory was introduced—in two variants, either using segments or pages—and swapping was applied to moving, respectively, either segments or pages, between disk and memory. The 1960s decade refers to the years from the beginning of 1960 to the end of 1969 Today with the virtual memory mostly based on pages, not segments, swapping became a fairly close synonym of paging, although with one difference.

In many popular systems, there is a concept known as page cache, of using the same single mechanism for both virtual memory and disk caching. In computing page cache, sometimes ambiguously called disk Cache, is a "transparent" buffer of disk-backed pages kept in Main memory (RAM by In Computer science, a cache (kæʃ like "cash") is a collection of data duplicating original A page may be then transferred to or from any ordinary disk file, not necessarily a dedicated space. In some of such systems, notably Unix-like including Linux, swapping only refers to virtual memory scope and paging to both. A Unix-like (sometimes shortened to *nix) Operating system is one that behaves in a manner similar to a Unix system while not necessarily conforming Linux (commonly pronounced ˈlɪnəks Page in is transferring a page from the disk to RAM. Page out is transferring a page from RAM to the disk. But swap in and out only refer to transferring pages between RAM and dedicated swap space or swap file, and not any other place on disk.

On the other hand, Microsoft systems from Windows NT line very rarely use the term swapping to differentiate from general paging, and call the dedicated secondary store just a page file. Microsoft Corporation is an American multinational Computer technology Corporation, which rose to dominate the Home computer Windows NT is a family of Operating systems produced by Microsoft, the first version of which was released in July 1993

## Paging in Windows 3. 0 line

Virtual memory has been a feature of Microsoft Windows since Windows 3.0 in 1990. Microsoft Windows is a series of Software Operating systems and Graphical user interfaces produced by Microsoft. Windows 30 is the third major release of Microsoft Windows, and came out on 22 May 1990 Microsoft introduced virtual memory in response to the failures of Windows 1.0 and Windows 2.0, attempting to slash resource requirements for the operating system. Windows 10 was a 16-bit graphical Operating environment released on 20 November 1985 Windows 20 was a 16-bit Microsoft Windows Graphical user interface -based Operating environment that superseded Windows 1

Confusion abounds about Microsoft's decision to refer to the swap file as "virtual memory". Novices unfamiliar with the concept accept this definition without question, and speak of adjusting Windows' virtual memory size. In fact every process has a fixed, unchangeable virtual memory size, usually 2 GiB. A gibibyte (a contraction of gi ga bi nary byte) is a unit of Information or Computer storage, abbreviated GiB. The user has only an option to change disk capacity dedicated to paging.

Windows 3. x creates a hidden file named 386SPART. A hidden directory or hidden file on a computer is a directory (folder or File which is not shown to the User by default PAR or WIN386. SWP for use as a swap file. It is generally found in the root directory, but it may appear elsewhere (typically in the WINDOWS directory). In computer File systems the root directory is the first or top-most directory in a hierarchy Its size depends on how much swap space the system has (a setting selected by the user under Control Panel → Enhanced under "Virtual Memory". The Control Panel is a part of the Microsoft Windows Graphical user interface which allows users to view and manipulate basic system settings and controls ) If the user moves or deletes this file, a blue screen will appear the next time Windows is started, with the error message "The permanent swap file is corrupt". The Blue Screen of Death (also known as a stop error, BSoD, bluescreen, or Blue Screen of Doom) is an Error screen displayed An error message is a message displayed when an unexpected condition occurs usually on a Computer or other device The user will be prompted to choose whether or not to delete the file (whether or not it exists).

Windows 95 uses a similar file, and the settings for it are located under Control Panel → System → Performance tab → Virtual Memory. Windows 95 is a consumer-oriented Graphical user interface -based Operating system. Windows automatically sets the size of the page file to start at 1. 5× the size of physical memory, and expand up to 3× physical memory if necessary. If a user runs memory-intensive applications on a system with low physical memory, it is preferable to manually set these sizes to a value higher than default.

## Paging in Windows NT line

In NT-based versions of Windows (such as Windows 2000 and Windows XP), the file used for paging is named pagefile. Windows 2000 (also referred to as Win2K) is a preemptive, interruptible graphical and business-oriented Operating system designed to work with Windows XP is a family of 32-bit and 64-bit Operating systems produced by Microsoft for use on Personal computers including home and sys. The default location of the page file is in the root directory of the partition where Windows is installed. Windows can be configured to use free space on any available drives for page files.

### Fragmentation of the page file

Occasionally, when the page file is gradually expanded, it can become heavily fragmented and cause performance problems. In computing file system fragmentation, sometimes called file system aging, is the inability of a File system to lay out related data sequentially (contiguously The common advice given to avoid this problem is to set a single "locked" page file size so that Windows will not resize it. However, the page file only expands when it has been filled, which, in its default configuration, is 150% the total amount of physical memory. [6] Thus the total demand for pagefile-backed virtual memory must exceed 250% of the computer's physical memory before the page file will expand.

Locking a page file's size can be problematic in the case that a Windows application requests more memory than the total size of physical memory and the page file. In this case, requests to allocate memory fail, which may cause the programs making the request (including system processes) to fail. Supporters of this view will note that the page file is rarely read or written in sequential order, so the performance advantage of having a completely sequential page file is minimal. However, it is generally agreed that a large page file will allow use of memory-heavy applications, and there is no penalty except that more disk space is used.

Defragmenting the page file is also occasionally recommended to improve performance when a Windows system is chronically using much more memory than its total physical memory. Although this can help slightly, performance concerns are much more effectively dealt with by adding more physical memory.

## Swapping in Linux

In Linux, as in most other Unix-like operating systems, it is common to use a whole partition of a hard disk for swapping. Linux (commonly pronounced ˈlɪnəks A Unix-like (sometimes shortened to *nix) Operating system is one that behaves in a manner similar to a Unix system while not necessarily conforming However, with the 2. 6 Linux kernel, swap files are just as fast[7][8] as swap partitions, although Red Hat recommends using a swap partition. [9] The administrative flexibility of swap files outweighs that of partitions; since modern high capacity hard drives can remap physical sectors, no partition is guaranteed to be contiguous.

Linux supports using a virtually unlimited number of swapping devices, each of which can be assigned a priority. When the operating system needs to swap pages out of physical memory, it uses the highest-priority device with free space. If multiple devices are assigned the same priority, they are used in a fashion similar to level 0 RAID arrangements. RAID — which stands for Redundant Array of Inexpensive Disks,or alternatively Redundant Array of Independent Disks (a less specific name and thus now the This provides improved performance as long as the devices can be accessed efficiently in parallel. Therefore, care should be taken assigning the priorities. For example, swaps located on the same physical disk should not be used in parallel, but in order ranging from the fastest to the slowest (i. e. : the fastest having the highest priority).

Recently, some experimental improvement to the 2. 6 Linux kernel have been made by Con Kolivas, published in his popular -ck patchset[10]. Linux is an operating system kernel used by a family of Unix-like Operating systems These are popularly termed Linux operating systems and Con Kolivas is an Australian anaesthetist, but he is known on the Internet for his programming work on the Linux kernel in his The improvement, called "swap prefetch", employs a mechanism of prefetching previously swapped pages back to physical memory even before they are actually needed, as long as the system is relatively idle (so as not to impair performance) and there is available physical memory to use. This applies to a situation when a "heavy" application has been temporarily used, causing other processes to swap out. After it is closed, both freeing large areas of memory and reducing disk load, prefetch of other processes starts, reducing their initial user response time. [11]

## Tuning paging performance

The backing store for a virtual memory operating system is typically many orders of magnitude slower than RAM. The magnitude of a mathematical object is its size a property by which it can be larger or smaller than other objects of the same kind in technical terms an Ordering Therefore it is desirable to reduce or eliminate swapping, where practical. Some operating systems offer settings to influence the kernel's decisions.

1. Linux offers the /proc/sys/vm/swappiness parameter, which changes the balance between swapping out runtime memory, as opposed to dropping pages from the system page cache.
2. Windows 2000, XP, and Vista offer the DisablePagingExecutive registry setting, which controls whether kernel-mode code and data can be eligible for paging out.

In AIX to improve performance you can use more than one device as paging space, since version AIX 4. 3 these paging space devices can be added or removed without rebooting the system.

## Tuning swap space size

In some older virtual memory operating systems, space in swap backing store is reserved when programs allocate memory for runtime data. OS vendors typically issue guidelines about how much swap space should be allocated. Between 1. 5 or 2 times the installed RAM is a typical number [12]. With a large amount of RAM, the disk space needed for the backing store can be very large. Newer versions of these operating systems attempt to solve this problem: for example, some HP-UX kernels offer a tunable swapmem_on that controls whether RAM can be used for memory reservations. HP-UX (Hewlett Packard UniX is Hewlett-Packard 's proprietary implementation of the Unix Operating system, based on System V (initially In systems with sufficient RAM, this significantly reduces the needed space allocation for the backing store.

## References

1. ^ Belzer, Jack; Holzman, Albert G. Computer data storage, often called storage or memory, refers to Computer components devices and recording media that retain digital Virtual memory is a Computer system technique which gives an application program the impression that it has contiguous working memory while in fact it may be physically In Computer Operating systems, demand paging is an application of Virtual memory. In computing page cache, sometimes ambiguously called disk Cache, is a "transparent" buffer of disk-backed pages kept in Main memory (RAM by In a Computer Operating system that utilizes Paging for Virtual memory Memory management, page replacement algorithms decide which In computing memory segmentation is one of the most common ways to achieve Memory protection; another common one is Paging. In a context of Computer Virtual memory, a page, memory page, or virtual page is a fixed-length block of Main memory, that is contiguous A page table is the data structure used by a Virtual memory system in a Computer Operating system to store the mapping between Virtual addresses In Computer science, dynamic memory allocation is the allocation of memory storage for use in a Computer program during the Runtime of that program & Kent, Allen, eds. (1981), “Virtual memory systems”, Encyclopedia of computer science and technology, vol. 14, CRC Press, pp. 32, ISBN 0824722140
2. ^ Deitel, Harvey M. (1983), An Introduction to Operating Systems, Addison-Wesley, pp. 181, 187, ISBN 0201144735
3. ^ Belzer, Jack; Holzman, Albert G. & Kent, Allen, eds. (1981), “Operating systems”, Encyclopedia of computer science and technology, vol. 11, CRC Press, pp. 433, ISBN 0824722612
4. ^ Belzer, Jack; Holzman, Albert G. & Kent, Allen, eds. (1981), “Operating systems”, Encyclopedia of computer science and technology, vol. 11, CRC Press, pp. 442, ISBN 0824722612
5. ^ Cragon, Harvey G. (1996), Memory Systems and Pipelined Processors, Jones and Bartlett Publishers, pp. 109, ISBN 0867204745
6. ^ How to determine the appropriate page file size for 64-bit versions of Windows Server 2003 or Windows XP (MSKB889654_. Knowledge Base. Microsoft (November 7, 2007). Events 1492 - The Ensisheim Meteorite the oldest Meteorite with a known date of impact strikes the Earth around noon in a Wheat Year 2007 ( MMVII) was a Common year starting on Monday of the Gregorian calendar in the 21st century. Retrieved on 2007-12-26. Year 2007 ( MMVII) was a Common year starting on Monday of the Gregorian calendar in the 21st century. Events 1481 - Battle of Westbrook - Holland defeats troops of Utrecht.
7. ^ LKML: "Jesper Juhl": Re: How to send a break? - dump from frozen 64bit linux
8. ^ LKML: Andrew Morton: Re: Swap partition vs swap file