HP-UX 11i v3 Memory Management Subsystem
21
When the age hand arrives at a pregion, it ages some constant fraction of pages before moving
tothe next
pregion (by default 1/16 of the pregion's total pages). The p_agescan tag enables
the age hand to move to the location within a
pregion where it left off during its previous pass,
while the
p_ageremain charts how many pages must be aged to fill the 1/16 quota before moving
on to the next
pregion.
How much to age and steal depends on several factors:
• frequency of vhand runs (by default eight times per second).
• available paging bandwidth (based on comparison with a global rate of pageouts completed
within an interval of time).
• how often the system falls to zero free memory.
• position of the paging threshold.
• number of pages already scheduled to be freed.
vhand is biased against threads that have nice priorities: the nicer a thread, the more likely vhand
will steal its pages.
There are ways that an application can prevent vhand from ejecting its pages out of memory onto the
swap space: the application can lock the pages in memory via the
mlock(2)or plock(2) calls, or
the application can be designated as a real-time process. These facilities should be used judiciously:
the net effect of locking memory is to reduce the amount of pageable memory, increasing contention
for that resource and possibly causing memory pressure.
Appendix 4 – Management of swap space
Swap space is an area on a high-speed storage device (almost always a disk drive), reserved for use
by the virtual memory subsystem for paging and deactivation of processes. At least one swap device
(primary swap) must be present on the system. You can add swap as needed (that is, dynamically)
while the system is running, without having to reboot the kernel.
The swapper reserves swap space at process creation time, but does not allocate swap space from
the disk until pages need to go out to disk. Reserving swap at process creation protects the swapper
from running out of swap space.
HP-UX uses both physical and pseudo-swap to enable efficient execution of programs.
Pseudo-Swap Space
System memory used for swap space is called pseudo-swap space. It allows users to execute
processes in memory without allocating physical swap. Typically, when the system executes a
process, swap space is reserved for the entire process, in case it must be paged out. According to
this model, to run one gigabyte of processes, the system would have to have one gigabyte of
configured swap space. Although this protects the system from running out of swap space, disk space
reserved for swap is under-utilized if minimal or no swapping occurs.
To avoid such waste of resources, HP-UX is configured to access up to
7
/
8
of system memory capacity
as pseudo-swap. This means that system memory serves two functions: as process-execution space
and as swap space. By using pseudo-swap space, a 2 GB memory system with 2 GB of swap can
run up to 3.75 GB of processes (2GB physical swap space + 1.75GB pseudo-swap). As before, if a
process attempts to grow or be created beyond this extended threshold, it will fail.
When using pseudo-swap for swap, the pages are locked; as the amount of pseudo-swap increases,
the amount of lockable memory decreases.