Re: [9fans] _xinc vs ainc

2011-05-08 Thread erik quanstrom
On Sun May 8 02:01:57 EDT 2011, rminn...@gmail.com wrote: > The type signature reveals all: ainc returns a long, and xinc is void. > > You really can't test the value of the long * after you call xinc > because somebody else might have done an xinc after your xinc but > before you test the value.

Re: [9fans] _xinc vs ainc

2011-05-07 Thread ron minnich
The type signature reveals all: ainc returns a long, and xinc is void. You really can't test the value of the long * after you call xinc because somebody else might have done an xinc after your xinc but before you test the value. I think, among others, floren and I needed ainc for devtrace years

Re: [9fans] _xinc vs ainc

2011-05-07 Thread Venkatesh Srinivas
On Sat, May 7, 2011 at 9:24 PM, Bakul Shah wrote: > On Sat, 07 May 2011 20:25:25 EDT erik quanstrom   > wrote: >> > > the difference, and my main point is that the loop in ainc means >> > > that it is not a wait-free algorithm.  this is not only sub optimal, >> > > but also could lead to incorrec

Re: [9fans] _xinc vs ainc

2011-05-07 Thread Bakul Shah
On Sat, 07 May 2011 20:25:25 EDT erik quanstrom wrote: > > > the difference, and my main point is that the loop in ainc means > > > that it is not a wait-free algorithm. this is not only sub optimal, > > > but also could lead to incorrect behavior. > > > > I think a more likely possibility for

Re: [9fans] _xinc vs ainc

2011-05-07 Thread erik quanstrom
> > the difference, and my main point is that the loop in ainc means > > that it is not a wait-free algorithm. this is not only sub optimal, > > but also could lead to incorrect behavior. > > I think a more likely possibility for the change is to have a > *copy* of what was incremented. lock incl

Re: [9fans] _xinc vs ainc

2011-05-07 Thread Bakul Shah
On Sat, 07 May 2011 18:47:54 EDT erik quanstrom wrote: > > Just guessing. May be the new code allows more concurrency? If the > > value is not in the processor cache, will the old code block other > > processors for much longer? The new code forces caching with the first > > read so may be

Re: [9fans] _xinc vs ainc

2011-05-07 Thread erik quanstrom
> Just guessing. May be the new code allows more concurrency? If the > value is not in the processor cache, will the old code block other > processors for much longer? The new code forces caching with the first > read so may be high likelyhood cmpxchg will finish faster. I haven't > studied

Re: [9fans] _xinc vs ainc

2011-05-07 Thread Bakul Shah
On May 7, 2011, at 6:05 AM, erik quanstrom wrote: i'm confused by the recent change to the thread library. the old code was simply to do a locked incl. the new code does a locked exchange /within a loop/ until it's seen that nobody else has updated the value at the same time, thus insuring t