core.stdc.stdatomic

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Nov 15 09:55:15 UTC 2023


On 15/11/2023 10:33 PM, Walter Bright wrote:
> Is this only a problem with load/cas?

A store by itself should be ok.

If you do any loading like you do with cas or atomicOp, then the timings 
might not be in any way predictable.

But the general rule of thumb for this is: if an atomic operation is by 
itself for a given block of memory then you can ignore timings. If it 
used in conjunction with another atomic instruction (or more), you have 
to consider if timings can mess it up.

But wrt. load/cas they are the two big primitives that are used in the 
literature very heavily so they need to be prioritized over the others 
for implementing intrinsics. They will also be used very heavily in any 
problem data structure function from my own experience.


A random fun fact, the book I recommend on the subject "The Art of 
Multiprocessor Programming" one of the authors teachers at the same 
university as Roy!

https://shop.elsevier.com/books/the-art-of-multiprocessor-programming/herlihy/978-0-12-415950-1


More information about the Digitalmars-d mailing list