Operating System - OpenVMS
1829115 Members
14143 Online
109986 Solutions
New Discussion

Support for POSIX semaphores?

 
SOLVED
Go to solution
Mark Fletcher_4
New Member

Support for POSIX semaphores?

Is there any add-on functionality for POSIX semaphores for OpenVMS?

Thanks.

11 REPLIES 11
Mark Fletcher_4
New Member

Re: Support for POSIX semaphores?

Oops, I meant UNIX System V-style semaphore system calls (semget, semop, semctl). Are these available or obtainable?

Thanks.
Wim Van den Wyngaert
Honored Contributor

Re: Support for POSIX semaphores?

Kris Clippeleyr
Honored Contributor
Solution

Re: Support for POSIX semaphores?

Mark,
AFAIK, and I checked the info on the latest version of the CRTL, there is no support for POSIX style semaphores.
The closest you can get, is writing your own routines based on VMS mutexes (mutual exclusion semaphores). There are (undocumented) routines that allow for manipulation of semaphores
( SCH$LOCKR(_QUAD), SCH$LOCKW(_QUAD), SCH$LOCKWNOWAIT(_QUAD), SCH$UNLOCK(_QUAD) )

Hope this helps,
Kris (aka Qkcl)

I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Ian Miller.
Honored Contributor

Re: Support for POSIX semaphores?

You would be better using locks ($ENQ etc) that the undocumented routines that may change whenever HP want to.
____________________
Purely Personal Opinion
Mark Fletcher_4
New Member

Re: Support for POSIX semaphores?

Thank you for your help. $ENQ sounds like the best bet.

Mark

Re: Support for POSIX semaphores?

Perhaps the best solution has already been discussed but I wonder if pthread condition variables might not be another, perhaps more portable solution. If synchronization between processes (vs threads) is desired then aren't shared mutexes and condition variables available with the latest pthreads implementation for OpenVMS?

Of course the problem with this solution is that there isn't a portable solution for shared memory that I know of. I guess on VMS you'd have to use global sections.

Caveat: I haven't actually tried using shared pthread mutexes and conditions in a global section on VMS.
Galen Tackett
Valued Contributor

Re: Support for POSIX semaphores?

The Rolling Roadmap has something about semaphores where it talks about GNV and VMS V8.3. Go to http://h71000.www7.hp.com/openvms/roadmap/openvms_roadmaps.htm and download the "PDF W/Speaker Notes." If you search it for "semaphores" you'll find this text in between two bullets about GNV on page 15:

"Semaphores are similar to VMS locking and is used to coordinating or synchronizing activities in which multiple processes compete for the same operating system resources."

The chart accompanying that text includes "Semaphores" in the OpenVMS V8.3 box, which is shown elsewhere in the presentation as projected for H1 2006.
Galen Tackett
Valued Contributor

Re: Support for POSIX semaphores?

Oops. I forgot to state:

Mark, I don't know if the usage of Semaphores in the roadmap corresponds with the System V functionality you're looking for. And it certainly isn't of any immediate help to you...
Mark Fletcher_4
New Member

Re: Support for POSIX semaphores?

Correct me if I am wrong, but the $ENQ and $DEQ system calls do not appear to provide "counting" functionality, as in counting semaphores.
Ian Miller.
Honored Contributor

Re: Support for POSIX semaphores?

Mark, parhaps you can explain the counting function then someone may be able to suggest how to do it.
____________________
Purely Personal Opinion
Mark Fletcher_4
New Member

Re: Support for POSIX semaphores?

Counting semaphores are/were provided by PPL routines:

PPL$CREATE_SEMAPHORE Creates and initializes a semaphore with a
waiting queue
PPL$DECREMENT_SEMAPHORE Waits for the semaphore to have a value
greater than zero and then decrements the
semaphore
PPL$INCREMENT_SEMAPHORE Increments the value of a semaphore by 1

but these do not seem to work in 7.2-3. I can't get a valid semaphore ID back from PPL$CREATE_SEMAPHORE.