The swap file ( english swap file or page file ) refers to a file or swap partition ( English swap partition ) a partition on a storage medium of a computer , the different operating systems as part of its memory management use to process a larger address space made available to than would actually be possible with the physical memory available .
The operating system of every computer manages a memory area in which the data that the computer currently needs is stored. This area is called RAM ( Random Access Memory ). In certain situations, depending on the size of the main memory, not all of this data can be found in the RAM, for example because particularly memory-intensive programs are used. In this case, the addressable system memory is expanded and this additional address space is redirected to a swap file.
However, some programs or operating systems such as Windows access the swap file even if there is still sufficient RAM. For example, under certain versions of Windows, the memory allocated to a program is redirected to the paging file when it is minimized by the user. This makes more memory available for the currently active programs.
For technical reasons, access to the additional memory of the swap file is much slower than direct access to the RAM. Therefore, depending on the speed of the mass storage medium used, there will be a loss of speed if larger amounts of data are read from the swap file or written to the swap file. The higher the transfer rate and, above all, the lower the access time of the mass storage medium, the lower the expected speed losses.
Depending on whether the memory management uses pure segmentation , pure paging in the context of virtual memory management or a combination of both, the swap file contains segments, memory pages or both. The main memory, the swap file and any mapped secondary memory pages (paging) together form the occupied part of the virtual memory .
The term swap file is mainly coined by the Windows operating system . This manages the swap file independently and adapts it dynamically to the requirements. If more memory space is required to run a process, the swap file becomes larger; if less storage space is required later, it is reduced. It is also possible to set the swap file to any fixed size (from 2 MB), which may lead to a performance gain. From the point of view of the applications, there is no distinction between the physical main memory and the swap file. The applications use the virtual memory completely transparently . Under Windows 2000, XP, Vista, 7 and 8 the swap file is called pagefile.sys . However, this name can be changed in the registry . It is also possible to deactivate the paging file, but this is only useful if the physical memory is never used up completely.
ReadyBoost is a technology introduced by Microsoft under Windows Vista that allows files (including the swap file) to be cached on a fast flash memory (e.g. a USB stick ) and thereby accelerated access.
Other operating systems, such as B. Linux , use similar memory management mechanisms, but instead of the swap file usually a dedicated (or dedicated ) partition , the swap partition (English swap partition or swap space ). This area can also be on its own mass storage device. The use of a partition instead of a swap file has the advantage that no fragmentation can occur and that any existing fragmentation of the remaining data when the area is created does not affect the swap. The fixed size of the partition and thus the available memory can be a disadvantage. Under Linux it is possible to add further swap partitions or to remove existing ones during operation. In addition, regular files can also be used for swapping, but the file size is also fixed here. The swap memory can also be used as a buffer during the idle state .
- SwapFs (English) - Driver for saving the Windows swap file on a Linux swap partition