Thursday, July 8, 2010

Managing Semaphores Limits in Unix

Hello Guys,

We might have seen semaphores, siteminder (LLAWP) process issues while working on apache webserver, some time we will end up in restarting the server number of times but the application wont be working properly, while troubleshooting this issue, if you find out that we are having overloading semaphores and LLAWP process is behaving weird. And as a next process if you wish to clear out the semaphores, you may end up clearing out the semaphores of other webserver instance if any existing on the machine. If none you can safely clear the semaphores with the help of following commands

Give the details of existing semaphores
$ipcs –s

To remove the semaphores pass the semaphore id as an option to following command


There is one more thing you need to look into if this doesn't work or help is the limit your operating system enforce on creation of semaphores and shared memory segments.

To view the limits of these semaphores creating we have file called sem in the operating system kernal path as below.

#cat /proc/sys/kernel/sem
    250 512000 32 1024

These numbers shows :

SEMMSL - The maximum number of semaphores in a sempahore set
SEMMNS - The maximum number of sempahores in the system
SEMOPM - The maximum number of operations in a single semop call
SEMMNI - The maximum number of sempahore sets

This may happen that because of these limitations we are unable get the semaphores created for the server and the site requests are not serving properly.

so if you would like to increase the values, there may be 2 ways for this.

1. You can directly echo the values to the file.

#echo >/proc/sys/kernel/semmsl

2. Edit the Kernal parameters with sysctl command

#sysctl -w "kernel.sem=250 512000 32 1024"

Verify this with

#cat /proc/sys/kernel/sem


#sysctl -A
#grep kernel.sem

Any Comments ?

Shailesh Dyade

1 comment:

jake george said...

CA Siteminder Online Training, ONLINE TRAINING – IT SUPPORT – CORPORATE TRAINING The 21st Century Software Solutions of India offers one of the Largest conglomerations of Software Training, IT Support, Corporate Training institute in India - +919000444287 - +917386622889 - Visakhapatnam,Hyderabad CA Siteminder Online Training, CA Siteminder Training, CA Siteminder, CA Siteminder Online Training| CA Siteminder Training| CA Siteminder| If you’re serious about a career in IT, 21st Century would like to provide you a guidance don’t hesitate to organize a free demo session. For any further information regarding the courses once go through our website Visit: | Call Us +917386622889 - +919000444287 -