If your system has insufficient main memory for all the information it needs to work with, it will move pages of information to your swap area or swap entire processes to your swap area. Pages that were most recently used are kept in main memory, and those not recently used will be the first moved out of main memory. System administrators spend a lot of time determining the right amount of swap space for their systems. Insufficient swap may prevent a system from starting additional processes, hang applications, or not permit additional users to get access to the system. Having sufficient swap prevents these problems from occurring. System administrators usually go about determining the right amount of swap by considering many important factors, including the following:
Swap is listed and manipulated on different UNIX variants with different commands. The following example shows listing the swap area on a Solaris system with swap -l : # swap -l swapfile dev swaplo blocks free /dev/dsk/c0t3d0s1 32,25 8 263080 209504 These values are all in 512 KByte blocks. In this case, the free blocks are 209504 , which is a significant amount of the overall swap allocated on the system. You can view the amount of swap being consumed on your HP-UX system with swapinfo . The following is an example output of swapinfo : # swapinfo Kb Kb Kb PCT START/ Kb TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME dev 49152 10532 38620 21% 0 - 1 /dev/vg00/lvol2 dev 868352 10888 759160 1% 0 - 1 /dev/vg00/lvol8 reserve - 532360 -532360 memory 816360 469784 346576 58% Following is a brief overview of what swapinfo gives you. In the previous example, the "TYPE" field indicated whether the swap was "dev" for device, "reserve" for paging space on reserve, or "memory." Memory is a way to allow programs to reserve more virtual memory than you have hard disk paging space setup for on your system. "Kb AVAIL" is the total swap space available in 1024-byte blocks. This includes both used and unused swap. "Kb USED" is the current number of 1024-byte blocks in use. "Kb FREE" is the difference between "Kb AVAIL" and "Kb USED." "PCT USED" is "Kb USED" divided by "Kb AVAIL." "START/LIMIT" is the block address of the start of the swap area. "Kb RESERVE" is "-" for device swap or the number of 1024-byte blocks for file system swap. "PRI" is the priority given to this swap area. "NAME" is the device name of the swap device. You can also issue the swapinfo command with a series of options. Here are some of the options you can include:
|