Explore thread synchronization in the Arm memory model
Introduction
Thread Synchronization, Arm Memory Model, and Tools
Herd7 and Litmus7 Test Primer
Thread Synchronization Examples
Additional Resources
Next Steps
Explore thread synchronization in the Arm memory model
Who is this for?
This is an advanced topic for developers seeking practical ways to test thread synchronization approaches in the Arm memory model.
What will you learn?
Upon completion of this Learning Path, you will be able to:
- Test thread synchronization assembly snippets against the formal definition of the Arm memory model.
- Test thread synchronization assembly snippets on Arm hardware.
- Compare the results of different thread synchronization approaches.
Prerequisites
Before starting, you will need the following:
- An understanding of memory consistency models (such as sequential consistency, weak ordering, relaxed consistency, and processor consistency)
- An understanding of thread synchronization
- Familiarity with Arm assembly language, and the ability to find relevant information on Arm assembly instructions
- Familiarity with general-purpose registers
- Familiarity with memory barriers, including acquire and release semantics
Summary
This summary was 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.
You’ll examine thread synchronization on Arm systems with small concurrency litmus tests. First, you’ll create an AArch64 MP-style test and use Herd7 to analyze outcomes allowed by the formal Arm memory model. You’ll then run the same specification on Arm hardware with Litmus7 and compare observed behavior with the model. Along the way, you’ll explore acquire-release ordering through
LDAR and STLR examples.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.
Use AArch64 for the MP litmus test. Configure your tools and hardware runs for the same architecture.
Herd7 evaluates outcomes against the formal memory model, while Litmus7 runs the test on hardware. A compliant Arm CPU can exhibit stronger ordering than the formal model, and a finite run can miss rare outcomes. Increasing the iteration count improves your chances of observing rare outcomes but doesn’t guarantee that every permitted outcome will occur.
Run the test in Herd7 and review the outcomes permitted by the formal model. After you can reproduce and interpret the outcomes, run the same test with Litmus7 on Arm hardware to compare behavior.
Use
LDAR for load-acquire and STLR for store-release. Compare the examples to see how these instructions enforce acquire-release ordering.Increase the iteration count with the
-s option. For example, run litmus7 ./test.litmus -s 5000000 to execute five million iterations instead of the default one million.