9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] _xinc vs ainc
Date: Sat,  7 May 2011 18:24:40 -0700	[thread overview]
Message-ID: <20110508012440.923D3B827@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Sat, 07 May 2011 20:25:25 EDT." <5d4e995cc83155be2adfaf18a9f44f68@ladd.quanstro.net>

On Sat, 07 May 2011 20:25:25 EDT erik quanstrom <quanstro@quanstro.net>  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 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.  that value is not used by the thread library.

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?

> if your program depends on time-bounded behavior from
> the thread library, you could have trouble with a non-wait-free
> algorithm like this.

Yes, but I think associating time-bounded behavior with any
shared memory access is iffy.  You always have this
possibility on processors that provide nothing stronger than
LL/SC (load-linked/stored-conditional).



  reply	other threads:[~2011-05-08  1:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-07 13:05 erik quanstrom
2011-05-07 19:33 ` Bakul Shah
2011-05-07 22:47   ` erik quanstrom
2011-05-07 23:10     ` Bakul Shah
2011-05-08  0:25       ` erik quanstrom
2011-05-08  1:24         ` Bakul Shah [this message]
2011-05-08  2:44           ` Venkatesh Srinivas
2011-05-08  6:00 ` ron minnich
2011-05-08 13:14   ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110508012440.923D3B827@mail.bitblocks.com \
    --to=bakul@bitblocks.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).