Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Memory paging
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Implementations== ===Ferranti Atlas=== The first computer to support paging was the supercomputer [[Atlas Computer (Manchester)|Atlas]],<ref>{{cite book |last1 = Sumner |first1 = F. H. |last2 = Haley |first2 = G. |last3 = Chenh |first3 = E. C. Y. |title = Information Processing 1962 |series = IFIP Congress Proceedings |chapter = The Central Control Unit of the 'Atlas' Computer |volume = Proceedings of IFIP Congress 62 |year = 1962 | publisher = Spartan }}</ref><ref>{{cite web |url= http://www.computer50.org/kgill/atlas/atlas.html |title= The Atlas |publisher = Department of Computer Science |location = University of Manchester |url-status = dead |archive-url = https://web.archive.org/web/20120728105352/http://www.computer50.org/kgill/atlas/atlas.html |archive-date = 2012-07-28 }}</ref><ref>{{cite web |url = http://www.chilton-computing.org.uk/acl/technology/atlas/p005.htm |title = Atlas Architecture |work = Atlas Computer |publisher = Atlas Computer Laboratory |location = Chilton |url-status = live |archive-url = https://web.archive.org/web/20121210142240/http://www.chilton-computing.org.uk/acl/technology/atlas/p005.htm |archive-date = 2012-12-10 }}</ref> jointly developed by [[Ferranti]], the [[University of Manchester]] and [[Plessey]] in 1963. The machine had an associative ([[Content-addressable memory|content-addressable]]) memory with one entry for each 512 word page. The Supervisor<ref>{{cite book |last1 = Kilburn |first1 = T. |last2 = Payne |first2 = R. B. |last3 = Howarth |first3 = D. J. |title = Computers - Key to Total Systems Control |series = Conferences Proceedings |pages = 279β294 |chapter = The Atlas Supervisor |chapter-url = http://www.chilton-computing.org.uk/acl/technology/atlas/p019.htm |volume = 20, Proceedings of the Eastern Joint Computer Conference Washington, D.C. |date = December 1961 |publisher = Macmillan |url-status = live |archive-url = https://web.archive.org/web/20091231062425/http://www.chilton-computing.org.uk/acl/technology/atlas/p019.htm |archive-date = 2009-12-31 }} </ref> handled non-equivalence interruptions{{efn|A non-equivalence interruption occurs when the high order bits of an address do not match any entry in the associative memory.}} and managed the transfer of pages between core and drum in order to provide a one-level store<ref>{{cite journal |last1 = Kilburn |first1 = T. |last2 = Edwards |first2 = D. B. G. |last3 = Lanigan |first3 = M. J. |last4 = Sumner |first4 = F. H. |date = April 1962 |title = One-Level Storage System |journal = IRE Transactions on Electronic Computers |issue = 2 |pages = 223β235 |publisher = Institute of Radio Engineers |doi = 10.1109/TEC.1962.5219356 }}</ref> to programs. ===Microsoft Windows=== ====Windows 3.x and Windows 9x==== Paging has been a feature of [[Microsoft Windows]] since [[Windows 3.0]] in 1990. Windows 3.x creates a [[hidden file]] named <code>386SPART.PAR</code> or <code>WIN386.SWP</code> for use as a swap file. It is generally found in the [[root directory]], but it may appear elsewhere (typically in the WINDOWS directory). Its size depends on how much swap space the system has (a setting selected by the user under [[Windows Control Panel|Control Panel]] β Enhanced under "Virtual Memory"). If the user moves or deletes this file, a [[Blue Screen of Death|blue screen]] will appear the next time Windows is started, with the [[error message]] "The permanent swap file is corrupt". The user will be prompted to choose whether or not to delete the file (even if it does not exist). [[Windows 95]], [[Windows 98]] and [[Windows Me]] use a similar file, and the settings for it are located under Control Panel β System β Performance tab β Virtual Memory. 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. ===={{Anchor|PAGEFILE-SYS}}Windows NT==== The file used for paging in the [[Windows NT]] family is <code>pagefile.sys</code>. 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. It is required, however, for the boot partition (i.e., the drive containing the Windows directory) to have a page file on it if the system is configured to write either kernel or full memory dumps after a [[Blue Screen of Death]]. Windows uses the paging file as temporary storage for the memory dump. When the system is rebooted, Windows copies the memory dump from the page file to a separate file and frees the space that was used in the page file.<ref>{{cite web|last=Tsigkogiannis|first=Ilias|date=December 11, 2006|title=Crash Dump Analysis|url=https://docs.microsoft.com/en-us/archive/blogs/iliast/crash-dump-analysis|url-status=live|archive-url=https://web.archive.org/web/20081007215138/http://blogs.msdn.com/iliast/archive/2006/12/11/crash-dump-analysis.aspx|archive-date=October 7, 2008|access-date=2008-07-22|work=driver writing !{{=}} bus driving|publisher=[[Microsoft]]}}</ref> ====Fragmentation==== {{update|section|date=July 2014}} In the default configuration of Windows, the page file is allowed to expand beyond its initial allocation when necessary. If this happens gradually, it can become heavily [[file system fragmentation|fragmented]] which can potentially cause performance problems.<ref>{{cite web |url = https://technet.microsoft.com/en-us/sysinternals/bb897426 |title = Windows Sysinternals PageDefrag |work = Sysinternals |publisher = [[Microsoft]] |date = November 1, 2006 |access-date = 2010-12-20 |url-status = live |archive-url = https://web.archive.org/web/20101225112753/http://technet.microsoft.com/en-us/sysinternals/bb897426 |archive-date = December 25, 2010 }}</ref> The common advice given to avoid this is to set a single "locked" page file size so that Windows will not expand it. However, the page file only expands when it has been filled, which, in its default configuration, is 150% of the total amount of physical memory.<ref>{{cite web |title = Page File Information |url = https://oingo.kpt.co.id/IT/en/107-2/page-file_12799_oingo-kpt.html |website = Oingo KPT |access-date = 14 December 2024 }}</ref> Thus the total demand for page file-backed virtual memory must exceed 250% of the computer's physical memory before the page file will expand. The fragmentation of the page file that occurs when it expands is temporary. As soon as the expanded regions are no longer in use (at the next reboot, if not sooner) the additional disk space allocations are freed and the page file is back to its original state. Locking a page file size can be problematic if a Windows application requests more memory than the total size of physical memory and the page file, leading to failed requests to allocate memory that may cause applications and system processes to fail. Also, 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, a large page file generally allows the use of memory-heavy applications, with no penalties besides using more disk space. While a fragmented page file may not be an issue by itself, fragmentation of a variable size page file will over time create several fragmented blocks on the drive, causing other files to become fragmented. For this reason, a fixed-size contiguous page file is better, providing that the size allocated is large enough to accommodate the needs of all applications. The required disk space may be easily allocated on systems with more recent specifications (i.e. a system with 3 GB of memory having a 6 GB fixed-size page file on a 750 GB disk drive, or a system with 6 GB of memory and a 16 GB fixed-size page file and 2 TB of disk space). In both examples, the system uses about 0.8% of the disk space with the page file pre-extended to its maximum. [[Defragment]]ing 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.<ref>{{cite web |title = What Does Defragging Do? |url = https://www.hp.com/us-en/shop/tech-takes/what-does-defragging-do |website = HP Tech Takes |publisher = Hewlett-Packard |access-date = 14 December 2024 }}</ref> This view ignores the fact that, aside from the temporary results of expansion, the page file does not become fragmented over time. In general, performance concerns related to page file access are much more effectively dealt with by adding more physical memory. ===Unix and Unix-like systems=== [[Unix]] systems, and other [[Unix-like]] operating systems, use the term "swap" to describe the act of substituting disk space for RAM when physical RAM is full.<ref>{{Cite web|date=27 March 2020|first=David|last=Both|title=An introduction to swap space on Linux systems|url=https://opensource.com/article/18/9/swap-space-linux-systems|access-date=2021-12-08|website=Opensource.com|language=en}}</ref> In some of those systems, it is common to dedicate an entire partition of a hard disk to swapping. These partitions are called ''swap partitions''. Many systems have an entire hard drive dedicated to swapping, separate from the data drive(s), containing only a swap partition. A hard drive dedicated to swapping is called a "swap drive" or a "scratch drive" or a "[[scratch disk]]". Some of those systems only support swapping to a swap partition; others also support swapping to files. ===={{Anchor|LINUX}}Linux==== {{See also|zswap|zram}} The Linux kernel supports a virtually unlimited number of swap backends (devices or files), and also supports assignment of backend priorities. When the kernel swaps pages out of physical memory, it uses the highest-priority backend with available free space. If multiple swap backends are assigned the same priority, they are used in a [[Round-robin scheduling|round-robin]] fashion (which is somewhat similar to [[RAID 0]] storage layouts), providing improved performance as long as the underlying devices can be efficiently accessed in parallel.<ref>{{cite web |url = http://linux.die.net/man/2/swapon |title = swapon(2) β Linux man page |access-date = 2014-09-08 |website = Linux.Die.net |url-status = live |archive-url = https://web.archive.org/web/20140228161303/http://linux.die.net/man/2/swapon |archive-date = 2014-02-28 }}</ref> =====Swap files and partitions===== From the end-user perspective, swap files in versions 2.6.x and later of the Linux kernel are virtually as fast as swap partitions; the limitation is that swap files should be contiguously allocated on their underlying file systems. To increase performance of swap files, the kernel keeps a map of where they are placed on underlying devices and accesses them directly, thus bypassing the cache and avoiding filesystem overhead.<ref>{{cite web |url=https://lkml.org/lkml/2006/5/29/3 |title="Jesper Juhl": Re: How to send a break? - dump from frozen 64bit linux |publisher=LKML |date=2006-05-29 |access-date=2010-10-28 |url-status=live |archive-url=https://web.archive.org/web/20101124235412/http://lkml.org/lkml/2006/5/29/3 |archive-date=2010-11-24 }}</ref><ref>{{cite web |url=https://lkml.org/lkml/2005/7/7/326 |title=Andrew Morton: Re: Swap partition vs swap file |publisher=LKML |access-date=2010-10-28 |url-status=live |archive-url=https://web.archive.org/web/20101124235448/http://lkml.org/lkml/2005/7/7/326 |archive-date=2010-11-24 }}</ref> When residing on HDDs, which are rotational magnetic media devices, one benefit of using swap partitions is the ability to place them on contiguous HDD areas that provide higher data throughput or faster seek time. However, the administrative flexibility of swap files can outweigh certain advantages of swap partitions. For example, a swap file can be placed on any mounted file system, can be set to any desired size, and can be added or changed as needed. Swap partitions are not as flexible; they cannot be enlarged without using partitioning or [[Logical volume management|volume management]] tools, which introduce various complexities and potential downtimes. =====Swappiness===== ''Swappiness'' is a [[Linux kernel]] parameter that controls the relative weight given to [[Virtual memory#Address space swapping|swapping out]] of [[Memory footprint|runtime memory]], as opposed to dropping [[Page (computer memory)|pages]] from the system [[page cache]], whenever a memory allocation request cannot be met from free memory. Swappiness can be set to a value from 0 to 200.<ref>{{cite web|url=https://www.kernel.org/doc/html/latest/admin-guide/sysctl/vm.html#swappiness|title=The Linux Kernel Documentation for /proc/sys/vm/}}</ref> A low value causes the kernel to prefer to evict pages from the page cache while a higher value causes the kernel to prefer to swap out "cold" memory pages. The [[Default (computer science)|default value]] is <code>60</code>; setting it higher can cause high latency if cold pages need to be swapped back in (when interacting with a program that had been idle for example), while setting it lower (even 0) may cause high latency when files that had been evicted from the cache need to be read again, but will make interactive programs more responsive as they will be less likely to need to swap back cold pages. Swapping can also slow down [[Hard disk drive|HDDs]] further because it involves a lot of random writes, while [[Solid-state drive|SSDs]] do not have this problem. Certainly the default values work well in most workloads, but desktops and interactive systems for any expected task may want to lower the setting while batch processing and less interactive systems may want to increase it.<ref name="kerneltrap">{{cite web |url=http://kerneltrap.org/node/3000 |title=Linux: Tuning Swappiness |first=Jeremy |last=Andrews |date=2004-04-29 |work=kerneltrap.org |archive-url=https://web.archive.org/web/20130524085654/http://kerneltrap.org/node/3000 |archive-date=2013-05-24 |url-status=dead |access-date=2018-01-03}} </ref> =====Swap death===== When the system memory is highly insufficient for the current tasks and a large portion of memory activity goes through a slow swap, the system can become practically unable to execute any task, even if the CPU is idle. When every process is waiting on the swap, the system is considered to be in ''swap death''.<ref>{{cite web |url=http://lkml.iu.edu/hypermail//linux/kernel/9805.2/0707.html |title=swap death (as in 2.1.91) and page tables |author=Rik van Riel |date=1998-05-20 |url-status=live |archive-url=https://web.archive.org/web/20171229195527/http://lkml.iu.edu/hypermail//linux/kernel/9805.2/0707.html |archive-date=2017-12-29 }}</ref><ref>{{cite book|author=Kyle Rankin|title=DevOps Troubleshooting: Linux Server Best Practices|url=https://books.google.com/books?id=icPyQDU3xD4C&pg=PT159|year=2012|publisher=Addison-Wesley|isbn=978-0-13-303550-6|page=159|url-status=live|archive-url=https://web.archive.org/web/20171229195527/https://books.google.com/books?id=icPyQDU3xD4C&pg=PT159|archive-date=2017-12-29}}</ref> Swap death can happen due to incorrectly configured [[memory overcommitment]].<ref>{{cite web|url=https://www.win.tue.nl/%7Eaeb/linux/lk/lk-9.html|author=Andries Brouwer|title=The Linux kernel: Memory|url-status=live|archive-url=https://web.archive.org/web/20170813052950/http://www.win.tue.nl/~aeb/linux/lk/lk-9.html|archive-date=2017-08-13}}</ref><ref>{{cite web|url=https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/s-memory-captun.html|title=Capacity Tuning|author=Red Hat|url-status=live|archive-url=https://web.archive.org/web/20170723214620/https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/s-memory-captun.html|archive-date=2017-07-23}}</ref><ref>{{cite web|url=https://iainvlinux.wordpress.com/2014/02/16/memory-overcommit-settings/|title=Memory overcommit settings|date=16 February 2014|url-status=live|archive-url=https://web.archive.org/web/20170531182419/https://iainvlinux.wordpress.com/2014/02/16/memory-overcommit-settings/|archive-date=2017-05-31}}</ref> The original description of the "swapping to death" problem relates to the [[X Window System protocols and architecture#Clientβserver model and network transparency|X server]]. If code or data used by the X server to respond to a keystroke is not in main memory, then if the user enters a keystroke, the server will take one or more page faults, requiring those pages to read from swap before the keystroke can be processed, slowing the response to it. If those pages do not remain in memory, they will have to be faulted in again to handle the next keystroke, making the system practically unresponsive even if it's actually executing other tasks normally.<ref>{{cite web|url=http://tech-insider.org/linux/research/1993/0210.html|title=swapping to death|date=1993-02-10|author=Peter MacDonald|url-status=live|archive-url=https://web.archive.org/web/20170328080649/http://tech-insider.org/linux/research/1993/0210.html|archive-date=2017-03-28}}</ref> ====macOS==== [[macOS]] uses multiple swap files. The default (and Apple-recommended) installation places them on the root partition, though it is possible to place them instead on a separate partition or device.<ref>{{cite web |url = https://arstechnica.com/reviews/os/macosx-10-1.ars/7 |title = Mac OS X 10.1 |author = John Siracusa |publisher = Ars Technica |date = October 15, 2001 |access-date = 2008-07-23 |url-status = live |archive-url = https://web.archive.org/web/20080905095622/http://arstechnica.com/reviews/os/macosx-10-1.ars/7 |archive-date = September 5, 2008 }}</ref> ===AmigaOS 4=== [[AmigaOS 4.0]] introduced a new system for allocating RAM and defragmenting physical memory. It still uses flat shared address space that cannot be defragmented. It is based on [[slab allocation]] and paging memory that allows swapping. Paging was implemented in [[AmigaOS 4.1]]. It can lock up the system if all physical memory is used up.<ref>{{cite web |url = http://forum.hyperion-entertainment.biz/viewtopic.php?f=14&t=755#p9346 |title = Re: Swap issue also on Update 4 ? |author = AmigaOS Core Developer |publisher = Hyperion Entertainment |date = 2011-01-08 |access-date = 2011-01-08 |url-status = live |archive-url = https://web.archive.org/web/20130412080355/http://forum.hyperion-entertainment.biz/viewtopic.php?f=14&t=755#p9346 |archive-date = 2013-04-12 }}</ref> Swap memory could be activated and deactivated, allowing the user to choose to use only physical RAM.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)