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=


 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=

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:
--089e013a0768b8edd304dd5b9f31
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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?

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=



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=

 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:/=

 -Steve

--089e013a0768b8edd304dd5b9f31 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">At least the code looks complete.<div style>It&#39;s a sha= me it uses inline asm though. Would be much nicer to implement via intrinsi= cs.</div></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote= ">On 23 May 2013 10:17, Steven Schveighoffer <span dir=3D"ltr">&lt;<a href= =3D"mailto:schveiguy yahoo.com" target=3D"_blank">schveiguy yahoo.com</a>&g= t;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">On Tue, 07 May 2013 15:58:34 -0400, Dmitry O= lshansky &lt;<a href=3D"mailto:dmitry.olsh gmail.com" target=3D"_blank">dmi= try.olsh gmail.com</a>&gt; wrote:<br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> 07-May-2013 17:25, Andrei Alexandrescu =D0=BF=D0=B8=D1=88=D0=B5=D1=82:<br> </blockquote> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><blockquote class=3D"gmail_quote" style=3D"m= argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> No. A tutorial on memory consistency models would be too long to insert<br> here. I don&#39;t know of a good online resource, does anyone?<br> <br> </blockquote> <br> Sutter&#39;s Mill is a good starting point even though it&#39;s C++ biased.= <br> <br> Two recent insightful talks on C++11 memory model with down and dirty detai= ls:<br> <br> <a href=3D"http://herbsutter.com/2013/02/11/atomic-weapons-the-c-memory-mod= el-and-modern-hardware/" target=3D"_blank">http://herbsutter.com/2013/02/<u=
</u>11/atomic-weapons-the-c-<u></u>memory-model-and-modern-<u></u>hardware=

</blockquote> <br> I finally got around to watching this. =C2=A0Absolutely mind-blowing, and a= very very good talk. =C2=A0This is what I would point people at, although = it is a bit long (and necessarily so). =C2=A0Didn&#39;t seem like it took 3= hours :)<br> <br> I take back all my arguments regarding the previous discussion, they were a= ll wrong, along with my concept of the &quot;issues&quot; with out-of-order= reads/writes. =C2=A0I really like how Herb explains that it doesn&#39;t re= ally matter where the re-ordering happens, to the coder, it&#39;s all the s= ame (as if the source code is reordered), and how you can&#39;t ever really= reason about code if it has races.<br> <br> Is D prepared to do (or does it do?) the same things that C/C++11 does with= atomics? =C2=A0It seems it is a necessity. =C2=A0The docs on core.atomic a= re, well, actually missing: <a href=3D"http://dlang.org/phobos/core_atomic.= html" target=3D"_blank">http://dlang.org/phobos/core_<u></u>atomic.html</a>= <br> <br> -Steve<br> </blockquote></div><br></div> --089e013a0768b8edd304dd5b9f31--
May 22 2013