* Re: TEST and SET/Spin lock for Alpha/Unix?
[not found] <48imk7$j65@nntp.atlanta.com>
@ 1995-11-18 5:00 ` Paul M. Aoki
0 siblings, 0 replies; only message in thread
From: Paul M. Aoki @ 1995-11-18 5:00 UTC (permalink / raw)
curts@compgen.com (Curt Smith) writes:
| Anybody have the small bit of assembly it takes for a test and
| set / spin lock in user space??
you might try using msem_lock(3). it tries to use the LDL_L/STL_C
load-linked/store-conditional instructions to obtain a semaphore
from user mode before calling __msleep to sleep on the semaphore.
(if you use the MSEM_IF_NOWAIT flag, it returns immediately with
an error instead of sleeping.) furthermore, it gets the
multiprocessor memory consistency protocol (i.e., use of the MB
memory barrier instruction -- see the alpha architecture manual)
right.
caveat 1: i have no idea how clustering affects all of this. i've
only ever used standalone DS3000s and Sables.
caveat 2: before osf/1 3.0 (the first multiprocessor version), the
msem_* routines *didn't* use the MB instruction. hence, statically
linking against pre-3.0 libraries is iffy if you are going to run
the binaries on a multiprocessor. however, things are fine >= 3.0.
--
Paul M. Aoki | University of California at Berkeley
aoki@CS.Berkeley.EDU | Dept. of EECS, Computer Science Division (#1776)
| Berkeley, CA 94720-1776
^ permalink raw reply [flat|nested] only message in thread