Sujet : Re: Memory ordering
De : aph (at) *nospam* littlepinkcloud.invalid
Groupes : comp.archDate : 18. Nov 2024, 12:56:48
Autres entêtes
Message-ID : <GBucnd-uvJwdtqb6nZ2dnZfqnPSdnZ2d@supernews.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : tin/1.9.2-20070201 ("Dalaruan") (UNIX) (Linux/4.18.0-553.5.1.el8_10.x86_64 (x86_64))
jseigh <
jseigh_es00@xemaps.com> wrote:
On 11/16/24 16:21, Chris M. Thomasson wrote:
Fwiw, in C++ std::memory_order_consume is useful for traversing a node
based stack of something in RCU. In most systems it only acts like a
compiler barrier. On the Alpha, it must emit a membar instruction. Iirc,
mb for alpha? Cannot remember that one right now.
That got deprecated. Too hard for compilers to deal with. It's now
same as memory_order_acquire.
It's back in C++20. I think the problem wasn't so much implementing
it, which as you say can be trivially done by aliasing with acquire,
but specifying it. We use load dependency ordering in Java on AArch64
to satisfy some memory model requirements, so it's not as if it's
difficult to use.
Which brings up an interesting point. Even if the hardware memory
memory model is strongly ordered, compilers can reorder stuff,
so you still have to program as if a weak memory model was in
effect.
Yes, exactly. It's not as if this is an issue that affects people who
program in high level languages, it's about what language implementers
choose to do.
Andrew.