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

AI-assisted

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.

Close
?
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

AI-assisted

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.

Close
?
Which architecture should I target when I write the litmus test?
Use AArch64 for the MP litmus test. Configure your tools and hardware runs for the same architecture.
Why might Litmus7 not observe an outcome that Herd7 permits?
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.
How do I know I’m ready to move from Herd7 to Litmus7 on hardware?
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.
Which instructions should I use to demonstrate acquire-release ordering?
Use LDAR for load-acquire and STLR for store-release. Compare the examples to see how these instructions enforce acquire-release ordering.
How can I increase the chance of observing rare outcomes with Litmus7?
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.
Next