Modify the shmmax value in Linux

Source: Internet
Author: User
Because the maximum size of shared memory needs to be modified, shmmax is stored in/proc/sys/kernel/shmmax in Fedora8. There are two ways to modify the shmmax value. The first type is temporary modification. The operation is very simple. In bashshell, click the following command: # echo "0x40000000" & gt; /proc/sys/kernel/shmmax0x40000000 indicates the maximum size of the shared memory to be modified.

Because the maximum size of shared memory needs to be modified, shmmax is stored in/proc/sys/kernel/shmmax in Fedora 8. There are two ways to modify the shmmax value.

The first is temporary modification. The operation is very simple. In bash shell, click the following command:

# Echo "0x40000000">/proc/sys/kernel/shmmax

0x40000000 indicates the maximum size of the shared memory to be modified, which is 1 GB.

Then you can check the shmmax value in vi to find that the shmmax value has been modified. However, you will find that after the restart, the value will be changed to the original default value of 32 MB.

The second is Permanent modification. Modify/etc/sysctl. conf to make the change permanent. Add the following line to the file. This change takes effect after the system restarts. kernel. shmmax = 0x40000000.

Several parsing operations are included:

Ipcs is used to view information about the shared memory.

Ipcrm is used to eliminate shared memory segments in the system.

I used the system v operation to increase the shared memory, and then shmdt to call the shared memory. When all running processes dt the shared memory, I found that the shared memory still exists, the most important thing is that when I start another process to read data, all the previously written data is in. That is to say, the physical memory does not eliminate the shared memory after all referenced processes are completed. You can view the information of the shared memory segment through ipcs. Therefore, ipcrm-m must be used to remove it.

In another test, when 1 GB of shared memory is allocated, but it is still not allocated in the actual physical memory, it is actually allocated when you use it for the first time.

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.