1833883 Members
1530 Online
110063 Solutions
New Discussion

Re: Semaphores

 
SOLVED
Go to solution
Robin King
Frequent Advisor

Semaphores

I have recieved a request for the creation of two semaphores for the use of a couple of Sybase DBs.

Can any one shed any light on how to do this, as it's a new field for me.

I've had a look at the man pages for "sem_open", but get the feeling I'm barking up the wrong tree.

Thanks

R
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Semaphores

Hi Robin,

No you not barking up the wrong tree but I suspect that your DBA's are. I don't know about
Sybase but other databases I've worked with (Oracle, Informix, etc.) create and manage their own semaphores and in any case have to work out a mechanism by which the cooperating processes agree on a 'key'. Your role is normally restricted to enabling semaphores (they are by default) and perhaps setting some
semaphore related kernel paramters (semxxx).
But 'setting up some semaphores' is a bit too vague to code. You will also be called upon occasionally to remove some sema4's using ipcrm.

A good place to start is by man'ing ipcs, ipcrm, and you've obviously already man'ed semop(2), semctl(2), et. al.

Regards, Clay

If it ain't broke, I can fix that.
Rita C Workman
Honored Contributor

Re: Semaphores

To go along with Clay's post.
You define how many semaphores are available in your kernel parms. See this post for some help on calculating your semaphore values:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x10ca6af52b04d5118fef0090279cd0f9,00.html
You can do a SEARCH for semaphores to get more..

Now for your 'dubious DBA's'. I don't use Sybase, but if it's anything along the line of Oracle...you would define your processing needs in an "init.ora" file. There you define the size of shared memory, number of processes you want to use (this is the value you use for calc of kernel parms..), etc. Sybase may have something similar to this.
Another overlooked semaphore parm are the msgxxx parms...these define message queues if you are doing anything along this sort of configuration.

Hope this helps,
Rita
Robin King
Frequent Advisor

Re: Semaphores

Thanks people! I have spoken to my 'dubious DBA' and passed your comments.

Apparently it is not specific to a Sybase database, but to Open Server, a Sybase product.

I do actually have a semaphore to remove so I'll do some reading into ipcrm.

Thanks

R