System Administration Guide, Volume I

About Swap Space

This section provides a conceptual overview of swap space and briefly discusses the differences between the SunOS 4.0/4.1 and the SunOS 5.7 swap requirements. If you are already familiar with the SunOS 5.7 swap mechanism, proceed to the section called "Planning for Swap Space".

It is important for administrators to understand the features of the SunOS 5.7 swap mechanism in determining:

Swap Space and Virtual Memory

The SunOS 5.7 system software uses some disk slices for temporary storage rather than for file systems. These slices are called swap slices. Swap slices are used as virtual memory storage areas when the system does not have enough physical memory to handle current processes.

The SunOS 5.7 virtual memory system maps physical copies of files on disk to virtual addresses in memory. Physical memory pages which contain the data for these mappings can be backed by regular files in the file system, or by swap space. If the memory is backed by swap space it is referred to as anonymous memory because the user doesn't know the names of the files backing the memory.

SunOS 4.0/4.1 anonymous memory pages are mapped using randomly assigned names from the system's swap space pool. These memory pages are used for:

The limitations of the SunOS 4.0/4.1 anonymous memory implementation are:

The SunOS 5.7 software environment introduces the concept of virtual swap space, a layer between anonymous memory pages and the physical storage (or disk-backed swap space) that actually back these pages. A system's virtual swap space is equal to the sum of all its physical (disk-backed) swap space plus a portion of the currently available physical memory.

Virtual swap space has these advantages:

Swap Space and the TMPFS File System

The TMPFS file system is activated automatically in the SunOS 5.7 environment by an entry in the /etc/vfstab file. The TMPFS file system stores files and their associated information in memory (in the /tmp directory) rather than on disk, which speeds access to those files. This results in a major performance enhancement for applications such as compilers and DBMS products that use /tmp heavily.

The TMPFS file system allocates space in the /tmp directory from the system's swap resources. This means that as you use up space in /tmp, you are also using up swap space. So if your applications use /tmp heavily and you do not monitor swap space usage, your system could run out of swap space.

Use the following if you want to use TMPFS but your swap resources are limited: