Re: race on multi-processor solaris
From: Joe Seigh (jseigh_01_at_xemaps.com)
Date: 12/08/03
- Next message: Joerg Schilling: "Sun Studio 8 C-compiler problem"
- Previous message: Proud Gay Male Anthony Mandic: "Re: Complaints against "The Reverend Terence Fformby-Smythe""
- 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: Mon, 08 Dec 2003 21:51:36 GMT
David Schwartz wrote:
>
> "Joe Seigh" <jseigh_01@xemaps.com> wrote in message
> news:3FD471B4.AB06C349@xemaps.com...
>
> > > This is especially bad on the P4. All read-modify-write operations
> > > write, even if they don't have to (like a compare and swap where the
> compare
> > > fails). So if you have 8 CPUs and 7 of them fail to make forward
> progress,
> > > each of the 7 failures requires ugly FSB traffic to unshare and dirty
> the
> > > memory just to write the same value back!
>
> > Except that the instant the cpu holding the lock releases it, all the
> other
> > processors more or less simultaneously attempt to acquire it.
>
> Once per CPU per timeslice. Then the conflicting thread is descheduled
> and doesn't get another chance to cause contention until all other threads
> have run.
>
...
> I'm not sure whether we're talking about lock-free versus spinlocks or
> lock-free versus regular locks. The fundamental benefit of locks is that
> contention is avoided by descheduling contending threads. The fundamantal
> benefit of lock-free algorithms is that threads are not descheduled when
> they contend, they simply run slower.
Spin locks primarily. A suspend type lock effectively slows things down
so the contention level is lower. Though I guess that is one way of dealing
with contention, slow down. If you have adaptive mutexes then they'll behave
more like spin locks if the locks are held for relatively shore durations.
>
> You can really only prefer a lock-free algorithm if you have good reason
> to believe that there won't be any other thread that can run more
> effectively if the thread accessing the collection were descheduled. Though
> the argument may be different on CPUs like Opteron where the FSB scales with
> the number of CPUs.
>
> For many applications, the most important case is where only one thread
> is accessing the collection and other threads would like to do other things.
> In this case, lock-free is a big loser because it requires more atomic
> operations than locks do. (Again, consider adding 12 items to 12 queues.)
>
You keep picking an absurd and unrealistic example to make your case.
Joe Seigh
- Next message: Joerg Schilling: "Sun Studio 8 C-compiler problem"
- Previous message: Proud Gay Male Anthony Mandic: "Re: Complaints against "The Reverend Terence Fformby-Smythe""
- 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
|
|