Dynamically Modifying the Configurable IPC Parameters

team bbl


Beginning with the 2.4 kernel, Linux supports the dynamic modification of most of the IPC parameters through either the /proc file system interface or with the sysctl facility. The following sections discuss how to dynamically modify IPC parameters with /proc and sysctl.

Using /proc

The /proc file system contains several files that store the current IPC limit setting. You can check the limits by opening these files and modifying the limits by editing the files. The following files related to IPC resources are located in the /proc/sys/kernel directory:

 -rw-r--r--    1 root     root        0 Jul  2 15:12 msgmax -rw-r--r--    1 root     root        0 Jul  2 15:12 msgmnb -rw-r--r--    1 root     root        0 Jul  2 15:12 msgmni -rw-r--r--    1 root     root        0 Jul  2 15:12 sem -rw-r--r--    1 root     root        0 Jul  2 15:12 shmall -rw-r--r--    1 root     root        0 Jul  2 15:12 shmmax -rw-r--r--    1 root     root        0 Jul  2 15:12 shmmni 

The file sem includes all the semaphore kernel parameters (semmsl, semmns, semopm, and semmni). The other files are straightforwardthe filename tells what parameter the file stores.

The following example increases the maximum number of message queues by issuing an echo command as root:

 # echo 1024 > /proc/sys/kernel/msgmni 

Alternatively, you can open the file /proc/sys/kernel/msgmni and edit the value from there.

Using sysctl

Another way to check and modify kernel parameters at runtime is with the sysctl command. The sysctl command is an interface for changing the values of kernel parameters given the kernel parameter name and the new value. For example, to increase the maximum number of message queues to 1024, issue the following sysctl command as root:

 # sysctl -w kernel..msgmni= 1024 

You can also check the current limit with the sysctl command:

 # sysctl kernel.sem kernel.sem = 250  32000 32    128 

Note that for semaphores, the kernel defines one general kernel parameter named kernel.sem for all four parameters. The four limits are listed in the order of semmsl, semmns, semopm, and semmni. To modify one of the limits, provide the new value for the vector. For example, to increase the maximum number of semaphore operations per semop() system call from 32 to 128, issue the following:

 # sysctl -w kernel.sem="250   32000 128   128" 

    team bbl



    Performance Tuning for Linux Servers
    Performance Tuning for Linux Servers
    ISBN: 0137136285
    EAN: 2147483647
    Year: 2006
    Pages: 254

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net