Memory barrier is to ensure the ordring of memory access, and there are several blogs describe what it is.
But I am still trying to find a typical (man forged) case to show its value. I tried the codes in this link https://blog.csdn.net/zhangxiao93/article/details/42966279.
But I am not sure if that code is correct to show the wrong result without using memory barrier.
Any link or code snippet is appreciated.
Asked
Active
Viewed 11 times
0

wangt13
- 959
- 7
- 17
-
https://preshing.com/20120515/memory-reordering-caught-in-the-act/ has an x86 asm example of the standard store-buffer / StoreLoad reordering litmus test. – Peter Cordes Dec 29 '21 at 05:29
-
Great, this is what I really need. – wangt13 Dec 29 '21 at 08:21