www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How are D atomics? [was: Low-Lock Singletons In D]

reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Tue, 07 May 2013 15:58:34 -0400, Dmitry Olshansky  =

<dmitry.olsh gmail.com> wrote:

 07-May-2013 17:25, Andrei Alexandrescu =D0=BF=D0=B8=D1=88=D0=B5=D1=82:=
 No. A tutorial on memory consistency models would be too long to inse=
rt
 here. I don't know of a good online resource, does anyone?
Sutter's Mill is a good starting point even though it's C++ biased. Two recent insightful talks on C++11 memory model with down and dirty =
=
 details:

 http://herbsutter.com/2013/02/11/atomic-weapons-the-c-memory-model-and=
-modern-hardware/ I finally got around to watching this. Absolutely mind-blowing, and a = very very good talk. This is what I would point people at, although it = is = a bit long (and necessarily so). Didn't seem like it took 3 hours :) I take back all my arguments regarding the previous discussion, they wer= e = all wrong, along with my concept of the "issues" with out-of-order = reads/writes. I really like how Herb explains that it doesn't really = matter where the re-ordering happens, to the coder, it's all the same (a= s = if the source code is reordered), and how you can't ever really reason = about code if it has races. Is D prepared to do (or does it do?) the same things that C/C++11 does = with atomics? It seems it is a necessity. The docs on core.atomic are,= = well, actually missing: http://dlang.org/phobos/core_atomic.html -Steve
May 22 2013
parent Manu <turkeyman gmail.com> writes:
At least the code looks complete.
It's a shame it uses inline asm though. Would be much nicer to implement
via intrinsics.


On 23 May 2013 10:17, Steven Schveighoffer <schveiguy yahoo.com> wrote:

 On Tue, 07 May 2013 15:58:34 -0400, Dmitry Olshansky <
 dmitry.olsh gmail.com> wrote:

  07-May-2013 17:25, Andrei Alexandrescu =D0=BF=D0=B8=D1=88=D0=B5=D1=82:

  No. A tutorial on memory consistency models would be too long to insert
 here. I don't know of a good online resource, does anyone?
Sutter's Mill is a good starting point even though it's C++ biased. Two recent insightful talks on C++11 memory model with down and dirty details: http://herbsutter.com/2013/02/**11/atomic-weapons-the-c-** memory-model-and-modern-**hardware/<http://herbsutter.com/2013/02/11/ato=
mic-weapons-the-c-memory-model-and-modern-hardware/>

 I finally got around to watching this.  Absolutely mind-blowing, and a
 very very good talk.  This is what I would point people at, although it i=
s
 a bit long (and necessarily so).  Didn't seem like it took 3 hours :)

 I take back all my arguments regarding the previous discussion, they were
 all wrong, along with my concept of the "issues" with out-of-order
 reads/writes.  I really like how Herb explains that it doesn't really
 matter where the re-ordering happens, to the coder, it's all the same (as
 if the source code is reordered), and how you can't ever really reason
 about code if it has races.

 Is D prepared to do (or does it do?) the same things that C/C++11 does
 with atomics?  It seems it is a necessity.  The docs on core.atomic are,
 well, actually missing: http://dlang.org/phobos/core_**atomic.html<http:/=
/dlang.org/phobos/core_atomic.html>
 -Steve
May 22 2013