Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Monty Brandenberg <mcbinc.MAPS.SPAM@ne.mediaone.net>
To: Dirk Grunwald <grunwald@foobar.cs.colorado.edu>
Subject: Re: mutex between processes?
Date: 1998/08/10	[thread overview]
Message-ID: <35CF6191.3BB020B5@ne.mediaone.net> (raw)
In-Reply-To: qxppve8bnqw.fsf@foobar.cs.colorado.edu

Dirk Grunwald wrote:
> 
> 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.

For user-mode code?  I'll have to mildly-to-strongly disagree with that.
Having one or more threads eating their entire scheduling quantum in
a spin while starving the lock holder isn't generally a path to performance
or responsiveness.  One place where you can see this in action is on
the BeOS and documented in the last two newsletters which should be
available publicly.  Here, the OS supplies an improved version of
semaphores called benaphores which avoids syscalls in the absence of
contention.  The two recent newsletters document what happens with
naive coding which results in high ping-pong rates between threads and
the case of a third thread that can consume a scheduling quantum.  The
situation with a user-mode spinlock is actually worse.  A correct-but-
naive multithreaded application that used spinlocks would have higher
latencies and lower throughput than a correct-but-naive version that
used syscall-based mutex and semaphore services.  One result would be a
continuous stream of newsgroup threads claiming Digital Unix SMP sucks.

I'll disagree with myself with some conditions:  supplying spinlock code
to usermode, with suitable warnings and tutorials, could provide a better
path for some applications.  It would also allow programmers to avoid
having to invent this themselves should they insist on going down this
route.  This would encapsulate the platform requirements for correct SMP
communication which most programmers aren't going to code correctly.

Question to research:  do the TIS services support user-mode spinlocks?

m

-- 
Monty Brandenberg, Software Consultant                    MCB, Inc.
mcbinc@ne.mediaone.net.MAPS.SPAM                          P.O. Box 426188
mcbinc@world.std.com.MAPS.SPAM                            Cambridge, MA  02142
617.864.6907



  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
1998-08-10  4:00           ` Monty Brandenberg [this message]
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