May 23, 2013 How are D atomics? [was: Low-Lock Singletons In D] | ||||
---|---|---|---|---|
| ||||
On Tue, 07 May 2013 15:58:34 -0400, Dmitry Olshansky <dmitry.olsh@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 |
May 23, 2013 Re: How are D atomics? [was: Low-Lock Singletons In D] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer Attachments:
| 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 пишет:
>>
>
> 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/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<http://dlang.org/phobos/core_atomic.html>
>
> -Steve
>
|
Copyright © 1999-2021 by the D Language Foundation