RFR: 8367013: Add Atomic<T> to package/replace idiom of volatile var plus AtomicAccess:: operations

David Holmes dholmes at openjdk.org
Tue Oct 7 01:21:45 UTC 2025


On Fri, 3 Oct 2025 09:02:30 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> That's only true in the HotSpot API. It's not true for C++ <atomic> or the C equivalent, or in most published papers, where the default for "atomic" loads and stores is sequentially consistent.

Well we were talking about the Hotspot API as it was the default there that you were commenting on. I would suggest that many published papers assume seq-cst so that they can write simplified algorithms for lock-free code that avoids getting bogged down in what, and where, memory barriers are needed. Correct me if I am wrong but my understanding is that assembler level loads/stores are "relaxed" unless you request otherwise.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27539#issuecomment-3374811706


More information about the hotspot-dev mailing list