* msem_lock?
@ 1996-03-22 5:00 Duke Robillard
1996-03-23 5:00 ` msem_lock? Jens-Uwe Mager
0 siblings, 1 reply; 2+ messages in thread
From: Duke Robillard @ 1996-03-22 5:00 UTC (permalink / raw)
I've just come across msem_lock() and company in AIX (IBM's UNIX,
for those not in comp.unix.aix). They are apparently some kind
of fast semaphore, implemented by setting/testing a value in shared
memory (either mmap or shmget shared memory).
I've never seen these before--does anyone know where they came
from? The doc page mentions OSF's references, and the .h file
has references to Mach and BSD. They're in the same .h as mmap()
(mman.h),
Does anyone know how they work? Like, does msem_lock() spin if
the value is set already, or does it go to sleep (maybe using
msleep()/mwakeup())?
Thanks in advance.
--
Duke Robillard, duke@iscp.bellcore.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: msem_lock?
1996-03-22 5:00 msem_lock? Duke Robillard
@ 1996-03-23 5:00 ` Jens-Uwe Mager
0 siblings, 0 replies; 2+ messages in thread
From: Jens-Uwe Mager @ 1996-03-23 5:00 UTC (permalink / raw)
In article <DUKE.96Mar22130112@annwn.iscp.bellcore.com>,
duke@annwn.iscp.bellcore.com (Duke Robillard) wrote:
> I've just come across msem_lock() and company in AIX (IBM's UNIX,
> for those not in comp.unix.aix). They are apparently some kind
> of fast semaphore, implemented by setting/testing a value in shared
> memory (either mmap or shmget shared memory).
>
> I've never seen these before--does anyone know where they came
> from? The doc page mentions OSF's references, and the .h file
> has references to Mach and BSD. They're in the same .h as mmap()
> (mman.h),
These are from the OSF AES. They are also in HP-UX and I really would like
to have them everywhere.
> Does anyone know how they work? Like, does msem_lock() spin if
> the value is set already, or does it go to sleep (maybe using
> msleep()/mwakeup())?
The msem_lock call will attempt to lock the semaphore atomically using an
atomic processor instruction and if the lock is not free it will use the
call msleep to suspend the process in the kernel. Msleep will atomically
set the wanted flag before actually sleeping. The msem_unlock call will
unlock the semaphore and check the wanted flag. If the wanted flag is set,
it will call mwakeup to wake up all processes waiting for the semaphore
and to reset the wanted flag.
I did an implementation for BSDI/OS that should port over easily to other
386 based BSD implementations that use the MACH vm system. If you are
interested in it, drop me a message.
______________________________________________________________________________
Jens-Uwe Mager jum@anubis.han.de
30177 Hannover jum@helios.de
Brahmsstr. 3 Tel.: +49 511 660238
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-03-23 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-03-22 5:00 msem_lock? Duke Robillard
1996-03-23 5:00 ` msem_lock? Jens-Uwe Mager
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox