From: Dirk Grunwald <grunwald@foobar.cs.colorado.edu>
Subject: Re: mutex between processes?
Date: 1998/08/10 [thread overview]
Message-ID: <qxpogtsbggh.fsf@foobar.cs.colorado.edu> (raw)
In-Reply-To: 35CF6191.3BB020B5@ne.mediaone.net
Monty Brandenberg <mcbinc.MAPS.SPAM@ne.mediaone.net> writes:
>
> 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
---
Look, if I'm just incrementing a variable (the problem being described
by the person in question) there's no reason to even *hint* at the
possibility of a context switch forced by the thread library during
that incremenet.
E.g., if I'm going
pthread_mutex_lock(foo);
counter++;
pthread_mutex_unlock(foo);
it will take more time to get into/out of the O/S than to simply way.
Many performance oriented programmers would know this and exercise
proper judgement about when to use a spinlock.
However, without representative & provided "spinlock" code, even
expert programmers will screw up the WB's, MB's and the like needed
for correctness.
We shouldn't assume all programmers don't know how to write concurrent code.
--
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
1998-08-10 4:00 ` Monty Brandenberg
1998-08-10 4:00 ` Dirk Grunwald [this message]
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