Monday, February 13, 2006

Understanding SWAP (virtual memory)

Swap space is a portion of a hard disk drive (HDD) that is used for virtual memory.

Virtual memory is the use of space on a HDD to simulate additional main memory. Memory is used to hold portions of the operating system, programs and data that are currently in use or that are frequently used. Physically, main memory (also referred to as primary memory) consists of random access memory (RAM) chips that are combined into modules which, in turn, are inserted into slots on the motherboard (i.e., the main circuit board) on a computer. The times required to access different addresses (i.e., locations) in RAM are extremely short and nearly equal, in contrast to the longer and varying times required for accessing locations on the HDD and other storage devices.

In order to free up space in memory, an operating system with a virtual memory capability transfers data that is not immediately needed from memory to the HDD; when that data is needed again, it is copied back into memory. That is, when all of the RAM is being used (e.g., if there are many programs open simultaneously or if one very large program is in use), a computer with virtual memory enabled will swap data to the HDD and back to memory as needed, thus, in effect, increasing the total system memory.
It is generally recommended that for maximum system efficiency the swap space be twice the size of the main memory. This is true even for systems with large memory capacities, such a a gigabyte or more. Swap space is usually a dedicated partition (i.e., a logically independent section of a HDD) that is created during the installation of the operating system. Such a partition is also referred to as a swap partition. However, swap space can also be a special file.

Although it is generally preferable to use a swap partition rather than a file, sometimes it is not practical to add or expand a partition when the amount of RAM is being increased. In such case, a new swap file can be created with the mkswap command.

****** "ONE SWAP SPACE CAN WORK FOR MANY LINUX DISTRO ON SAME COMPUER" ****************

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home