From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <20110508012440.923D3B827@mail.bitblocks.com> References: <30A0D4B5-1AAB-4D95-9B9F-FD09CB796E6D@bitblocks.com> <20110507231019.298C0B827@mail.bitblocks.com> <5d4e995cc83155be2adfaf18a9f44f68@ladd.quanstro.net> <20110508012440.923D3B827@mail.bitblocks.com> From: Venkatesh Srinivas Date: Sat, 7 May 2011 22:44:34 -0400 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] _xinc vs ainc Topicbox-Message-UUID: e0f21c2c-ead6-11e9-9d60-3106f5b1d025 On Sat, May 7, 2011 at 9:24 PM, Bakul Shah wrote: > On Sat, 07 May 2011 20:25:25 EDT erik quanstrom = =C2=A0wrote: >> > > the difference, and my main point is that the loop in ainc means >> > > that it is not a wait-free algorithm. =C2=A0this is not only sub opt= imal, >> > > 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 0(ax) won't tell you >> > what the value was when it was incremented. >> >> you can read the code. =C2=A0that value is not used by the thread librar= y. > > If you want to use the value being atomically incremented, > there is no more efficient way on x86. May not be used now but > may be it can be used to make some synchronization primitive > more efficient? XADD -- vs