• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Change Kernel Semaphore Limits in CentOS/RHEL

By admin

The post explains how kernel semaphore limits can be changed in a CentOS/RHEL server.

Kernel Parameters to set semaphore limits

The kernel parameters to set the semaphore limits are:

kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
SEMMSL - max semaphores per array
SEMMNS - max semaphores system wide
SEMOPM - max ops per semop call
SEMMNI - max number of arrays

Changing Semaphore Limits

If a limit needs to be changed there should be taken in to account that (max number of arrays)*(max semaphores per array) >= (max semaphores system-wide). No need to have more semaphores system-wide if limited by the amount of a possible number of arrays with max semaphores per it.

For example:

# sysctl -a| grep kernel.sem
kernel.sem = 250 32000 32 128

For this example, we need to increase max semaphores per array limit from 128 to 192. The max semaphores system-wide can be also increased to 48000 ( 250*192 = 48000 >= 32000) or kept as 32000. In this scenario, it is kept at 32000.

To set kernel parameter dynamically i.e. without the need for server reboot.

# sysctl -w kernel.sem="250 32000 32 192"
kernel.sem = 250 32000 32 192

If all is fine with the system as expected, modify kernel parameter by adding it to the /etc/sysctl.conf file to ensure the value persist after server reboot.

# cat /etc/sysctl.conf | grep kernel.sem
kernel.sem = 250 32000 32 192

If you choose to set it directly in the file without using the sysctl -w, you’ll need to reload the file:

# sysctl -p

You can verify limits currently set by:

# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 192
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

A semaphore is like a counter used to control access to shared resources by multiple processes. It is often used as a locking mechanism to prevent processes from accessing a particular resource while another process is performing operations on it. Semaphore value can be incremented or decremented until maximum set by variable SEMVMX, “semaphore max value”.

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : Unable To Start The Samba Service
  2. CentOS / RHEL 7 : How to set udev rules for ASM on multipath disks
  3. How to Configure Persistent Names for Tape Devices in CentOS/RHEL
  4. CentOS / RHE 7 : How to Prevent Users from Using the Last 10 Passwords
  5. CentOS / RHEL 7 : Configuring an NFS server and NFS client
  6. Manual Changes Made To /etc/hosts Or /etc/sysconfig/network-scripts/ifcfg-* Are Lost
  7. MySQL Fails to Start Using systemctl On systemd Linux Distributions
  8. CentOS / RHEL 7 : Unable to start/enable iptables
  9. How to use shell expansions for generating shell tokens under Linux
  10. How Files/Directories in /tmp gets Removed Automatically in CentOS/RHEL 5,6

You May Also Like

Primary Sidebar

Recent Posts

  • What are different Oracle Database Vault Roles
  • Unable to export realm protected table using data pump
  • Beginners Guide to Oracle Database Vault
  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary