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

Steven Schveighoffer schveiguy at yahoo.com
Wed May 22 17:17:34 PDT 2013


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

> 07-May-2013 17:25, Andrei Alexandrescu пишет:

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

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 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

-Steve


More information about the Digitalmars-d mailing list