Learn about the C++ memory model for porting applications to Arm
Introduction
Introduction to C++ Memory Models
The C++ Memory Model and Atomics
Walk through a Race condition example
Detecting race conditions
Next Steps
Learn about the C++ memory model for porting applications to Arm
Review frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
No. The example uses an Arm-based AWS
t4g.xlarge instance, but other instance types can be used.Code with a latent race can appear to work on x86 but exhibit different or nondeterministic behavior on Arm due to memory ordering differences. The example is designed to make this contrast visible.
Use a recent version of the
clang compiler that includes ThreadSanitizer. TSan instruments your program at compile time and reports potential data races at runtime.TSan adds instrumentation and runtime checks, which introduce significant overhead. Use TSan builds for debugging data races, not for measuring performance.
Don’t assume x86 memory ordering semantics on Arm. Revisit the code with the C++ memory model in mind and use atomics and proper synchronization instead of relying on implicit ordering.