Understanding HPUX's swap zone and pseudo swap Zone

Source: Internet
Author: User

Understanding the pseudo-exchange, first of all we have to understand the concept of the exchange zone and the exchange mechanism of HP-UX!

In the swap zone, when the system's physical memory is insufficient, the OS is used to temporarily store some data in the physical memory to free up more physical memory space!

HP-UX swap mechanism: each time the system starts a process, it will reserve a certain amount of space in the SWAp area (equivalent to the size of the process using physical memory), in case of insufficient memory, there is enough swap area coming
But not necessarily used. However, after the swap zone is reserved, no matter whether it is actually used or not, it cannot be reserved (used) by other processes unless the process is released after running. For example, liquor
If you have booked a seat in the store, you cannot accept the reservation unless you call to cancel the reservation. Of course, even if the guests make a reservation, they will definitely eat it.

What is different from the reserved seats in the SWAp area is that the reserved seats are usually used by the guests, but they are not used after the reserved seats in the SWAp area. This mechanism may cause a problem: if the memory is large, it may lead to a waste of memory! Why?

If the physical memory of the system is 8 GB, the size of the SWAp zone is 1-2 times that of the memory, which is 8-16 GB! However, the general situation is that a large memory is purchased to avoid Memory
Exchange is not enough. In this case, the exchange zone rarely has the opportunity to exchange real data. Some customers set the swap zone to 4 GB or less (this is entirely possible; it saves storage space )! Consequence
Yes. As new processes continue to start, when the swap zone is reserved, the system will not be able to start new processes. In this case, the physical memory may be 3g or more free, but nothing can be done!

In order to solve this contradiction, HP-UX introduces the concept of "pseudo-swap zone! That is, when the system enables pseudo-swap, the system will default to the total number of swap areas = 75% of the physical memory + the total number of other SWAP Areas
Number. This 75% pseudo-swap zone does not actually exist (spoofing): It is not in the memory, not in the hard disk or any file system. That is to say, when the real swap zone is used up and a new process needs to be started, tell the system
I still have a lot of swap areas. Who should I start ......

Whether to enable pseudo-swap. You can set this parameter by using the System Kernel Parameter swapmem_on. 1 indicates enabling, and 0 indicates not enabling.

Generally, the size of the actual swap area is greater than or equal to the size of the physical memory. If this parameter is enabled, false swap is recommended.

However, note that some applicationsProgram(Very few), performance may decrease when pseudo-swap is enabled!

 

Method for adding a swap area:

The default swap zone is specified when the operating system is installed. It is a continuous space and cannot be expanded.
Generally, all newly added swaps are device swap spaces, which are rarely used in the file system.

1.
If you use the last MB of the c2t1d0 disk as the swap space and use the remaining part with the file system.
Newfs-R 100/dev/rdsk/c2t1d0
Swapon-E/dev/DSK/c2t1d0
Add in/etc/fstab
/Dev/DSK/c2t1d0. Swap defaults 0 0

2.
Use the entire disk, such as c2t1d0
Swapon/dev/DSK/c2t1d0
Add in/etc/fstab
/Dev/DSK/c2t1d0. Swap defaults 0 0

3.
Use logical volume
Lvcreate-l size-c y-R n/dev/vgname
Swapon/dev/vgname/lvname
Add in/etc/fstab
/Dev/vgname/lvname. Swap defaults 0 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.