From: Dirk Grunwald <grunwald@foobar.cs.colorado.edu>
Subject: Re: mutex between processes?
Date: 1998/08/10 [thread overview]
Message-ID: <qxppve8bnqw.fsf@foobar.cs.colorado.edu> (raw)
In-Reply-To: 35CB2911.61856927@brighttiger.com
Jeff Denham <jdenham@brighttiger.com> writes:
> The __MB() (memory barrier) is *absolutely* necessary for the
> spinlock to work on an MP system. In Dirk's example, though, I'm
> pretty sure that the __MB() in the release() routine is in the wrong
> place -- it should be before the clearing of the lock, not
> after. This guarantees that the updates to the object being locked
> are seen by other processors before they see that the lock is clear,
> grab it, and see stale state in the object.
--
Yeah, actually the "may not be needed" comment is more because I'm not
certain about the semantics of the builtin locking routines. If they
already do WMB/MB, then it's not needed. You'd really need to take a
look at the assembly code produced in a little more detail.
This, frankly, is why Digital should have provided & established
spinlocks, rather than insisting everyone use pthread mutex locks,
which have a lot of extra overhead. Sometimes portability is much less
important than performance.
--
Dirk Grunwald Assoc. Prof, Univ. of Colorado at Boulder
next prev parent reply other threads:[~1998-08-10 4:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-08-04 4:00 mutex between processes? Aurel Balmosan
1998-08-05 4:00 ` Jeff Denham
1998-08-05 4:00 ` Dirk Grunwald
1998-08-07 4:00 ` Aurel Balmosan
1998-08-07 4:00 ` Jeff Denham
1998-08-07 4:00 ` Aurel Balmosan
1998-08-07 4:00 ` Monty Brandenberg
1998-08-09 4:00 ` Aurel Balmosan
1998-08-10 4:00 ` Dirk Grunwald [this message]
1998-08-10 4:00 ` Monty Brandenberg
1998-08-10 4:00 ` Dirk Grunwald
1998-08-10 4:00 ` Monty Brandenberg
1998-08-11 4:00 ` Aurel Balmosan
1998-08-11 4:00 ` Monty Brandenberg
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