| United States-English |
|
|
|
![]() |
HP-UX System Administration Tasks: HP 9000 > Chapter 6 Managing Swap Space and
Dump Areas What is Swap Space? |
|
Physical memory is a finite resource on a computer system. Only so many processes can fit in physical memory at any one time, though many more may actually be ready to run or execute. Swapping and paging algorithms allow processes or portions of processes to move between physical memory and a mass storage device. This frees up space in physical memory. Swap space is an area on disk that temporarily holds a process memory image. When physical memory demand is sufficiently low, process memory images are brought back into physical memory from the swap area on disk. Having sufficient swap space enables the system to keep some physical memory free at all times. This type of memory management is often referred to as virtual memory and allows the total number of processes to exceed physical memory. Virtual memory enables the execution of a process within physical memory only as needed. Prior to the 10.0 release, processes not currently needed were "swapped out". When a process is swapped, all the units associated with the process (called pages) are sent to disk storage in one single transfer. This can cause the computer to spend quite a lot of time performing I/O transfers instead of running applications. Beginning with 10.0, this mechanism has been replaced by a deactivation mechanism whereby a process is taken off the run queue and its pages are moved to disk storage over time by the pager instead of all in one single transfer. When a process is not being executed, memory becomes more readily available for use by other processes. You should note that although processes are no longer swapped, we will continue to refer to this storage as swap space. This is because the term is currently widely used and its definition well understood by users. This chapter explains how to manage your system's swap space, including determining how much and what type of swap space the system needs, and how to add or remove swap space as the system's needs change. There are three types of swap space: device swap, file system swap, and pseudo-swap space. Each is used differently by the system and has its own advantages and disadvantages. Swap space is initially allocated when you configure your disks. Device swap space occupies a logical volume or partition, which is typically reserved expressly for swapping purposes. This space may also be configured as a dump area (see "Setting Up Dump Areas" later in this chapter). Device swap can only be used locally; device swap cannot be accessed remotely by clients using NFS. Device swap space is quickly accessed because the operating system can get to the logical volume or partition directly to perform large I/Os. You can additionally use available space in a file system for swap space. Setting up such file system swap space allows for extra swap if there is occasional need for more than the allocated device swap space. It is used only when device swap space is insufficient. When your system needs extra swap space, file system swap allows you to use existing file system space rather than reserving an entire dedicated logical volume or partition. However, because file system swap requires the system to perform a greater amount of processing and is usually slower than device swap, it should not be used as a permanent replacement for a sufficient amount of device swap space. The file system used for swap can be either a local or a remote file system. Cluster clients can use remote file system swap for their swap needs. (See Chapter 11, "Setting Up and Administering an HP-UX NFS Diskless Cluster" for information on cluster clients.) Swapping to a remote file system is slower than swapping to a local file system and is not encouraged if local device swap or local file system swap is available. Pseudo-swap space allows for the use of system memory as a third type of swap space. That is, HP-UX swap space can also consist of up to seven-eighths (87.5%) of system memory capacity. For example, a computer with one GB of system memory and one GB of device and file system swap, can run up to 1.87 GB of processes. If any process attempts to grow or be created beyond this extended threshold, the process will fail. When using pseudo-swap, since more processes can be created, the system load increases, causing more paging and deactivation activity. By default, pseudo-swap space is configured to be available. If you do not wish to make use of it, you will need to re-set the tunable system parameter, swapmem_on, to 0 ("off"). (To modify a configurable parameter, see "Making Adjustments to Your System" in Chapter 1.) Your system must have at least one device swap area available when it boots. This area is known as the primary swap area. (Primary swap is not mandatory if pseudo-swap is enabled, however, it is strongly recommended.) Primary swap, by default, is located on the same disk as the root file system. By default, the system's kernel configuration file /stand/system contains the configuration information for primary swap. Other swap may be used in addition to primary swap. Such swap is referred to as secondary swap. If you are using device swap as secondary swap, allocate such secondary swap to reside on a disk other than the root disk for better performance. File system swap is always secondary swap. |
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||