To replace pages or segments of data in memory. Swapping is a useful technique that enables a computer to execute programs and manipulate data files larger than main memory. The operating system copies as much data as possible into main memory, and leaves the rest on the disk. When the operating system needs data from the disk, it exchanges a portion of data (called a page or segment ) in main memory with a portion of data on the disk.
DOS does not perform swapping, but most other operating systems, including OS/2, Windows, and UNIX, do.
Swapping is often called paging or Virtual memory.
(1) Windows example
Virtual memory has been a feature of Microsoft Windows since Windows 3.1 in 1991. 386SPART.PAR (or WIN386.SWP on Windows 3.11 and Windows for Workgroups) is a hidden file created by Windows 3.x for use as a virtual memory 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 virtual memory the system has set up under Control Panel - Enhanced under "Virtual Memory." If a user moves or deletes this file, Windows will BSoD (Blue Screen of Death) the next time it is started with "The permanent swap file is corrupt" and will ask the user if they want to delete the file (It asks whether or not the file exists).
Windows 95 uses a similar file, except it is named WIN386.SWP, and the controls for it are located under Control Panel - System - Performance tab - Virtual Memory. Windows automatically sets the page file to be 1.5 x physical memory. This page file is located at C:\pagefile.sys on all NT - based versions of Windows (including Windows 2000 and Windows XP). If you run memory intensive applications on a low physical memory system it is preferable to manually set the size to a value higher than default. Additionally, fixing the size of the swap file will prevent it from being dynamically resized by Windows. This resizing causes the swap file to become fragmented, resulting in reduced performance. This page file cannot be defragmented with Windows' built-in defragmenting tools, such as ntfsdefrag.
(2) Virtual Memory in Linux
In Linux operating system, it is possible to use a whole partition of the HDD for virtual memory. Though it is still possible to use a file for swapping, it is recommended to use a separate partition, because this excludes chances of fragmentation, which reduces the performance of swapping. A swap area is created using the command mkswap filename/device, and may be turned on and off using the commands swapon and swapoff, respectively, accompanied by the name of the swap file or the swap partition.
In order to additionally increase performance of swapping, it is advisable to put the swap partition at the beginning of the HDD, because the transfer speed there is somewhat higher than at the end of the disk.
There were also some successful attempts to use the memory located on the videocard for swapping, as modern videocards often have 128 or even 256 megabytes of RAM.
EaseUS Data Recovery Wizard Free Edition, compatible with Windows 2000/XP/2003/Vista/2008/Windows 7, can recover lost files due to deletion, format, raw partition, virus attack, system crash etc. from SWAP Drive, external hard drive, hardware RAID, hard drive, USB drive, SD card, memory card, etc.
Copyright © 2005-2013 CHENGDU Yiwo® Tech Development Co., Ltd. ALL RIGHTS RESERVED.