1850215 Members
3203 Online
104050 Solutions
New Discussion

Semaphores

 
SOLVED
Go to solution
Global Server Operation
Frequent Advisor

Semaphores

I have an N4000 server running 11i. Databse is Progress.

Question:
Is there a way to find out how many semaphores an id is using?

Is there a limit or max value for semaphores a system can have? All replies are appreciated.
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: Semaphores

The ipcs -s command will show semaphores in use. There are several semaphore related kernel parameters:
semmap
semmni
semmns
semmnu
semmsl

and possibly others. I think semmni is the one you're interested in.


Pete

Pete
RAC_1
Honored Contributor

Re: Semaphores

ipcs -s -->semaphores
ipcs -q -->message queue
ipcs -m -->shared memory
There is no substitute to HARDWORK
Global Server Operation
Frequent Advisor

Re: Semaphores

I looked at the ipcs -s command. Is there a max limit on these parameters?
Pete Randall
Outstanding Contributor
Solution

Re: Semaphores

I took another look, the system wide limit on semaphores is controlled by the semmns kernel parameter. Run "kmtune |grep semmns" and you'll see what your limit is now.


Pete

Pete
Marco Santerre
Honored Contributor

Re: Semaphores

The kernel parms already mentionned by Pete are the ones tha tdetermine the limits on the semaphores.

semaem -> Max Value for Adjust on Exit Semaphore
semmap -> Max number of semaphore map entries
semmni -> Number of semaphore identifiers
semmns -> Max Number of semaphores
semmnu -> Number of semaphores undo structures
semmsl -> Max number of semaphores per ID
semume -> Semaphore Undo Entries per process
semvmx -> Semaphore max value

Cooperation is doing with a smile what you have to do anyhow.
A. Clay Stephenson
Acclaimed Contributor

Re: Semaphores

When asked like that the answer is no; however, ipcs -sa will give you the number in the NSEMS columns that the shmid was created with via the semget() system call. The problem is that I could create a shmid with perhaps 64 semaphores but only use 1. There is no way to know how many are actually being "used". Even looking at the values of the semaphores is no real answer because it is up to the programmer as to the meaning of a given value.


The values that are of concern to you are:
semmni - maximum # of system-wide shmid's
semmns - maximum # of system-wide sema4's
semmsl - maximum # of sema4's associated with any single shmid.

If you are having problems with sema4's, you should capture the exit status ,${?}, (hopefully, the programmer was a disciplined individual and return errno as the exit status) and then compare that value to the possible errno values in the semget, semctl, and semop man pages.
If it ain't broke, I can fix that.