Chapter 22. Memory and Swap Space Management


Chapter Syllabus

22.1 System Memory and Swap Space

22.2 Types of Swap Space

22.3Creating Swap Space

22.4 Monitoring Swap Space

22.5 Swap Space Priorities and Performance

Every system has some physical memory installed in it. The physical memory is used to hold programs and data loaded from disk drives and to perform operations on the data by using the loaded programs. The CPU can execute only those programs that are loaded into the physical memory. In a multitasking system, usually many programs are running simultaneously . There may also be many users logged in at one time and performing data operations. In a typical system, the amount of physical memory installed is not sufficient to hold all programs and data. This is where the concept of virtual memory comes in, where a systems uses space on secondary storage media (usually disk) to hold some of the programs and data being used by the CPU.

The part of the disk used for temporary data storage is called swap space. Although there are many processes running on a system in a given time slice, strictly speaking only one process is being executed by a CPU. In case the physical memory is constrained, the system may swap out some of the programs loaded into the physical memory to the swap area, creating space for the running process. When the time slice for this process expires , the code and data related to this process may be swapped out, and another process may start using the same physical memory.

HP-UX uses a sophisticated memory management system that takes care of the memory requirements of all processes. Depending on certain criteria, it decides which process should stay in the main memory and which should be swapped out. This system always ensures that some space is available in the main memory to create new processes. The amount of swap space needed may be different for different installations depending on how much physical memory is installed and what types of applications are running. The swapper and vhand daemons are used for swap space management. The swap space may be of different types depending on which disk device is used for it and whether it is available at boot time. A swap area that is available at the boot time is a primary swap area, and it is usually present on the disk being used as the boot device. You may also use one or more secondary swap areas depending on your needs.

Management of swap areas can be done through the use of command-line utilities as well as using SAM. Both of these methods are quite simple. To activate swap areas at the system startup, entries of the swap space are put in the /etc/fstab file.

Use of swap space is based on a priority system. Every swap space is assigned a priority that is a number from 0 to 10. The number 0 is the highest priority swap space. If two swap areas have the same priority, these are used in a round robin fashion, thus dividing the load among different disk drives.

The application vendor usually specifies the amount of swap space needed for different applications. However, you should monitor the swap space usage from time to time to check its actual usage and increase it if necessary.


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman © 2008-2017.
If you may any questions please contact us: