Skip to main content
Filter by
Sorted by
Tagged with
4 votes
0 answers
176 views

As the title states, I have a question about the visibility of memory operation guarantees with happens before order. I've read the cppref memory order and a previous C++ iso draft, but I still cannot ...
Haiyang He's user avatar
1 vote
1 answer
189 views

Consider this outline of a simple multi-threaded application. It has one writer thread, and ten reader threads. #include <atomic> #include <thread> const int Num_readers{...
WaltK's user avatar
  • 802
1 vote
0 answers
88 views

I have a thread pool implementation, which stops all threads by setting a special atomic bool stop to true. Its destructor looks like this: ThreadPool::~ThreadPool() { stop.store(true); for (...
Artegful's user avatar
2 votes
0 answers
116 views

Is it possible on any real hardware in the real world, for the updated value of an atomic integer written by one thread to become visible to another thread earlier via an indirect path, where a third ...
Qwert Yuiop's user avatar
1 vote
1 answer
58 views

I want to test if there are any bugs in my program where the memory sequence has not been properly used, but I do not have a weakly order memory environment for testing. For example, on x86, all loads ...
untitled's user avatar
  • 563
2 votes
1 answer
216 views

Can the hardware reorder an atomic load followed by an atomic store, if the store is conditional on the load? It would be highly unintuitive if this could happen, because if thread1 speculatively due ...
Qwert Yuiop's user avatar
0 votes
2 answers
218 views

I was testing the behavior of the control dependencies in LINUX KERNEL MEMORY BARRIERS, and had a problem with the location of the fence. I was testing this on AArch64 on a Qualcomm Snapdragon 835, ...
Kymdon's user avatar
  • 13
7 votes
0 answers
268 views

below is a copy screen from https://www.youtube.com/watch?v=5uIsadq-nyk, at 1:12:23, the line std::size_t seq2=seq.load(std::memory_order_relaxed) baffles me. I am not very familiar with the atomics, ...
Michael's user avatar
  • 810
0 votes
1 answer
80 views

I want to check if host notifications might be lost in the following scenarios. The hypothesis is shown in the figure below. However, I am not sure whether the commit actions of the last two CPUs ...
wang fuqiang's user avatar
3 votes
0 answers
163 views

In C++23, consider the classic IRIW litmus test, with the modification that all loads are now seq_cst, while stores are still relaxed: void reader0(atomic_int *x, atomic_int *y) { int l0x = x->...
Liu Xiaoyi's user avatar
2 votes
1 answer
168 views

Aarch64 and RISC-V WMO seem to allow Store/Store reordering according to their formal specifications. However, Store/Store reordering seems very tricky to perform in practice: the CPU would need to ...
64_'s user avatar
  • 579
1 vote
0 answers
104 views

I am writing a RISC-V assembly program whose goal is to assess the performance of main memory, in read access only for now. I have thought about a simple benchmark code, that would load multiple ...
SFV's user avatar
  • 11
4 votes
1 answer
103 views

The following code comes from the GCC Wiki. // -Thread 1- y.store (20, memory_order_relaxed) x.store (10, memory_order_relaxed) // -Thread 2- if (x.load (memory_order_relaxed) == 10) { assert (y....
hk134579's user avatar
4 votes
1 answer
163 views

I'm struggling to understand the standardese regarding memory_order_seq_cst guarantees and I'm not able to find an appropriate example. The code below demonstrates my situation. #include <atomic>...
Jordan Woyak's user avatar
4 votes
1 answer
93 views

So I've came across Jeff Preshing's wonderful blog posts on what's Acquire/Release and how they may be achieved with some CPU barriers. I've also read that SeqCst is about some total order that's ...
Not A Name's user avatar
6 votes
2 answers
266 views

In C++, I have two threads. Each thread does a store first on one variable, then a load on another variable, but in reversed order: std::atomic<bool> please_wake_me_up{false}; uint32_t cnt{0}; ...
sedor's user avatar
  • 326
4 votes
1 answer
119 views

Until C++17 the standard contained the following paragraph (C++17 Section 32.4 [atomics.order] paragraph 6): For atomic operations A and B on an atomic object M, where A modifies M and B takes its ...
mpoeter's user avatar
  • 3,041
2 votes
1 answer
149 views

I'm new to lock-free algorithms and trying to implement Stack which is the simplest lock-free data structure. Here is my implementation of bounded array-based lock-free stack. public class ...
Some Name's user avatar
  • 9,730
0 votes
1 answer
114 views

Where do I need to put memory barriers? The writes to image in thread A should be visible in thread B? The spots are marked in the pseudo code example and are derived from this question/answer. There ...
knivil's user avatar
  • 857
1 vote
0 answers
132 views

I found this term in https://rcs.uwaterloo.ca/~ali/cs854-f23/papers/topdown.pdf For example, incorrect data speculation generated Memory Ordering Nukes [7] - a subset of Machine Clears. What is it ...
k1r1t0's user avatar
  • 867
2 votes
1 answer
91 views

I recently encountered two seemingly opposing explanations on the transitivity of acquire-release semantics. The section "Transitive Synchronization with Acquire-Release Ordering" on pg 160 ...
ron burgundy's user avatar
1 vote
0 answers
42 views

Context This question explores the semantics of the MFENCE full memory barrier instruction in the x86 instruction set, particularly in comparison with modifying instructions that include the LOCK ...
Dmytro Kostenko's user avatar
1 vote
0 answers
143 views

The topic of the Store Buffer (SB) and its mechanics, size, purpose, and interaction with other buffers has been discussed on Stack Overflow several times. However, certain aspects of its operation ...
Dmytro Kostenko's user avatar
1 vote
2 answers
191 views

With the seq_cst memory order, the following code should never have v1 == 0 and v2 == 2 . But it still just prints Reorder happened on my Apple M1 chip. I really don't know why. #include <semaphore....
Ryaaan's user avatar
  • 25
-1 votes
1 answer
81 views

The following code is an example from the book C++ Concurrency in Action (2nd edition). The author mentions that threads Ta and Tb can observe different memory states: Tc observes x == true and y == ...
hao's user avatar
  • 1

1
2 3 4 5
20