LinuxHelps.com

A blog for Linux Lovers.

3
Mar 2009
Semaphore
Posted in Linux Helps by sibu at 2:33 pm |

Semaphore

When you stop all service, the semaphore and shared memory segments have to be removed. If not, you will be able to them using ‘ipcs’ command.

We can remove the segment ID using ‘ipcrm’ command.

#ipcs -a

#ipcrm -s < sem id>

To increase the semaphore values.

# /sbin/sysctl -a | grep sem => To display the Sem values.

# /sbin/sysctl -w kernel.sem=250

Add new value in /etc/sysctl.conf file inorder for the change to persist across system reboots.

# sysctl -f => to save values

You should periodically clean up the shared memory you have allocated using the command ipcrm. A fast way to remove every bit of shared memory you have priviledges for is

ipcs -m | awk ‘{print $2}’ | xargs -n1 ipcrm -m

OR

for i in `ipcs -s | grep nobody | awk '{print $2}'`; do ipcrm -s $i; done



You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply