Same C code, two architectures, two different observable behaviors. x86-64’s TSO model hides store→load reordering most of the time; ARM64’s weaker model lets you see it directly. This video runs a minimal test that demonstrates the difference and prints the reorder count.
If you’ve written lock-free code that “worked on x86 but broke on ARM,” this is the underlying mechanism.
What the test shows
- In the video: five runs per CPU. On the x86-64 Intel machine, one to five reorders appeared per half a million iterations. On ARM64, most runs showed about five to ten, with one run reaching 30. With a memory fence, both architectures showed none.
- In the blog post’s ARM64 run over a million iterations, the both-zero outcome appeared ~2.3% of the time with no barrier, ~1.8% with only a compiler barrier, and 0.0% with a
dsb syfence. A compiler barrier alone does not fix it; you need a real CPU fence.
Comments
This space is waiting for your voice.
Comments will be supported shortly. Stay connected for updates!
This section will display user comments from various platforms like X, Reddit, YouTube, and more. Comments will be curated for quality and relevance.
Have questions? Reach out through:
Want to see your comment featured? Mention us on X or tag us on Reddit.