From: aoki@faerie.CS.Berkeley.EDU (Paul M. Aoki)
Subject: Re: TEST and SET/Spin lock for Alpha/Unix?
Date: 1995/11/18 [thread overview]
Message-ID: <48jpti$pkl@agate.berkeley.edu> (raw)
In-Reply-To: 48imk7$j65@nntp.atlanta.com
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
parent reply other threads:[~1995-11-18 5:00 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <48imk7$j65@nntp.atlanta.com>]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox