Re: race on multi-processor solaris
From: Jonathan Adams (jonathan-ggl_at_ofb.net)
Date: 12/08/03
- Next message: Casper H.S. Dik: "Re: Diagnosing an impossible traceback"
- Previous message: Michael Laajanen: "Re: Mozilla ThunderBird 0.4 for Solaris/SPARC is out!"
- In reply to: David Schwartz: "Re: race on multi-processor solaris"
- Next in thread: David Schwartz: "Re: race on multi-processor solaris"
- Reply: David Schwartz: "Re: race on multi-processor solaris"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 8 Dec 2003 02:08:30 -0800
"David Schwartz" <davids@webmaster.com> wrote:
> "Logan Shaw" <lshaw-usenet@austin.rr.com> wrote in message
> news:GLYyb.72566$Ek.30545@twister.austin.rr.com...
> > Also, since this discussion is cross-posted to comp.unix.solaris,
> > doesn't Solaris have an adaptive mutex implementation? If I understand
> > correctly, this means that on a two CPU Solaris machine, the version
> > with locks will also have the loser thread spinning and waiting for
> > the resource to come free. If it doesn't within a period of time,
> > only then will the thread be put to sleep. So, the version with
> > locks will suffer some of the same CPU wastage as the lock free version.
There is a difference -- adaptive mutexes spin with non-atomic operations,
lock-free algorithms spin with atomic ops. The bus traffic is much lighter
with the non-atomic operations.
> Not if the adaptive mutexes adapt correctly. Sufficient contention
> should cause the mutex to adapt and block. Once the mutex blocks once, the
> thread that can run without contention will use up a full timeslice. The big
> loss only happens when both threads continue blundering through the
> contention for all or most of their timesilces.
Solaris' adaptive mutexes spin (reading the mutex using non-atomic ops)
as long as the thread holding the lock is running on a CPU. There are a few
reasons for this:
1. critical sections should be short, so you shouldn't be spinning
for very long.
2. context switches are expensive, compared to lock aquisition.
3. it simplifies the interactions with the thread unlocking the mutex.
If the owner goes to sleep, any waiters will stop spinning and block.
- jonathan
- Next message: Casper H.S. Dik: "Re: Diagnosing an impossible traceback"
- Previous message: Michael Laajanen: "Re: Mozilla ThunderBird 0.4 for Solaris/SPARC is out!"
- In reply to: David Schwartz: "Re: race on multi-processor solaris"
- Next in thread: David Schwartz: "Re: race on multi-processor solaris"
- Reply: David Schwartz: "Re: race on multi-processor solaris"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|