comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christoph.grein@eurocopter.com>
Subject: Re: About task-safeness
Date: Thu, 3 Feb 2011 03:22:53 -0800 (PST)
Date: 2011-02-03T03:22:53-08:00	[thread overview]
Message-ID: <cea7ddd8-03fa-4e0b-b04c-b88c6fcf0b1a@8g2000prb.googlegroups.com> (raw)
In-Reply-To: 4d4a8c88$0$6773$9b4e6d93@newsspool3.arcor-online.net

On 3 Feb., 12:07, Georg Bauhaus <rm.dash-bauh...@futureapps.de> wrote:
> > Randy, could you be more explicit about your suggested use of Atomic? As I
> > understand it, even if a counter variable N is Atomic, two tasks concurrently
> > executing an assignment of the form
>
> >    N := N + 1;
>
> > can interleave their actions so that N is increased by only 1, not by 2 as
> > intended.
>
> When I first read about atomic counting, I thought so, too.  But then,
> I noticed a new(?) Implementation Advice in the LRM that says, IIRC,
> that compilers should make atomic processor ops available, including
> decrement.  A neighboring paragraph is about intrinsic operations.

You mean C.1(11-12):
(11) It is recommended that intrinsic subprograms be provided for
convenient access to any machine
operations that provide special capabilities or efficiency and that
are not otherwise available through the
language constructs. Examples of such instructions include:
(12) • Atomic read-modify-write operations — e.g., test and set,
compare and swap, decrement and test,
enqueue/dequeue.

But N := N + 1; is not such an operation even if N is atomic. An
implementation would have to provide something like a CAS operation.



  reply	other threads:[~2011-02-03 11:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 20:51 About task-safeness mockturtle
2011-02-02 21:01 ` Vinzent Hoefler
2011-02-02 21:14   ` mockturtle
2011-02-02 22:16     ` Maciej Sobczak
2011-02-02 22:28       ` Shark8
2011-02-02 22:40         ` Peter C. Chapin
2011-02-03  8:33           ` Dmitry A. Kazakov
2011-02-03 17:59       ` Vinzent Hoefler
2011-02-02 22:38 ` J-P. Rosen
2011-02-03  2:44 ` Randy Brukardt
2011-02-03  8:53   ` Niklas Holsti
2011-02-03 11:07     ` Georg Bauhaus
2011-02-03 11:22       ` AdaMagica [this message]
2011-02-03 18:13         ` Jeffrey Carter
2011-02-04  0:33     ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox