Skip to content

Commit 56185ef

Browse files
committed
Review thread synch and the Arm memory model Learning Path
1 parent 45c2072 commit 56185ef

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

content/learning-paths/servers-and-cloud-computing/memory_consistency/_index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
2-
title: Explore Thread Synchronization in the Arm Memory Model
2+
title: Explore Thread Synchronization in the Arm memory model
33

44
minutes_to_complete: 150
55

66
who_is_this_for: This is an advanced topic for developers seeking practical ways to test thread synchronization approaches in the Arm memory model.
77

88
learning_objectives:
9-
- Test thread synchronization assembly snippets against the formal definition of the Arm Memory Model.
9+
- Test thread synchronization assembly snippets against the formal definition of the Arm memory model.
1010
- Test thread synchronization assembly snippets on Arm hardware.
1111
- Compare the results of different thread synchronization approaches.
1212

1313
prerequisites:
1414
- An understanding of memory consistency models (such as Sequential Consistency, Weak Ordering, Relaxed Consistency, and Processor Consistency).
1515
- An understanding of thread synchronization.
16-
- Familiarity with Arm Assembly Language, and the ability to find relevant information on Arm assembly instructions.
16+
- Familiarity with Arm assembly language, and the ability to find relevant information on Arm assembly instructions.
1717
- Familiarity with general-purpose registers.
1818
- Familiarity with memory barriers, including Acquire-Release Semantics.
1919

@@ -27,6 +27,7 @@ armips:
2727
operatingsystems:
2828
- Linux
2929
tools_software_languages:
30+
- Runbook
3031
- Herd7
3132
- Litmus7
3233
- Arm ISA

content/learning-paths/servers-and-cloud-computing/memory_consistency/arm_mem_model.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layout: "learningpathall"
88

99
Most developers don't need deep knowledge of a CPU's memory consistency model. Programming languages and runtimes abstract the CPU’s model by providing their own memory ordering rules, synchronization constructs, and libraries. As long as the developer uses these correctly, compilers and runtime engines ensure that the code executes correctly on any CPU - whether its memory ordering is strong or weak.
1010

11-
That said, developers might want to dig deeper into this topic for various reasons including:
11+
Developers might want to dig deeper into this topic for various reasons including:
1212

1313
- Extracting additional performance from weakly-ordered CPUs, such as Arm CPUs:
1414
- Although compilers and runtimes typically do a good job of maximizing performance, manual tuning in well understood niche cases might provide further improvements. In most cases, all it takes to improve performance is using latest compilers, compiler switches, and runtimes.
@@ -81,7 +81,7 @@ litmus7 --help
8181

8282
The input to both `herd7` and `litmus7` tools are snippets of assembly code, called litmus tests.
8383

84-
Shown below are some example of running the tools with a litmus test. In the next section, you will go through an actual litmus test example.
84+
Shown below are some example of running the tools with a litmus test.
8585

8686
Run herd7 with a litmus test:
8787
```
@@ -107,3 +107,5 @@ Run litmus7 with GCC emitting atomic instructions as required by the litmus test
107107
```
108108
litmus7 ./test.litmus -ccopts="-mcpu=native"
109109
```
110+
111+
Continue to the next section to learn about a litmus test example.

content/learning-paths/servers-and-cloud-computing/memory_consistency/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Histogram (1 states)
302302

303303
Both `herd7` and `litmus7` show the expected result. It might be worth increasing the number of iterations on `litmus7` to build more confidence in the result.
304304

305-
Now lets remove the load-acquire in `P1` and use a dependency as a barrier. Create a new litmus file `test6.litmus` with the contents shown below:
305+
Now remove the load-acquire in `P1` and use a dependency as a barrier. Create a new litmus file `test6.litmus` with the contents shown below:
306306

307307
```
308308
AArch64 MP+Loop+Dep

content/learning-paths/servers-and-cloud-computing/memory_consistency/explore_deeper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The [diy7 documentation](https://diy.inria.fr/doc/index.html) also provides link
2525

2626
- [Barriers on Armv8](https://developer.arm.com/documentation/100941/0101/Barriers).
2727
- [Load-Acquire and Store-Release on Armv8](https://developer.arm.com/documentation/102336/0100/Load-Acquire-and-Store-Release-instructions).
28-
- [Barrier Litmus Tests and Cookbook](https://developer.arm.com/documentation/genc007826/latest). This was written during the Armv7 days, but it still has relevance.
28+
- [Barrier Litmus Tests and Cookbook](https://developer.arm.com/documentation/genc007826/latest). This was written in 2009, but is still relevant.
2929

3030
## More Tests to Explore
3131

content/learning-paths/servers-and-cloud-computing/memory_consistency/litmus_syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Positive: 1 Negative: 3
138138
```
139139
Outcome `(1,0)` is observed when testing against the Arm memory model, as indicated by the positive witness on the test condition. This result demonstrates that the Arm memory model violates Sequential Consistency.
140140

141-
The Arm memory model tends to be considered a Relaxed Consistency model, which means that it is possible for an Arm CPU in the real world to use ordering rules that are stronger than Relaxed Consistency. Going stronger on the memory model will not violate the Arm ordering rules. A stronger memory model means that there might be less opportunity for hardware-based optimizations, it will not affect the correctness of code execution - assuming there are no bugs in the code. That said, you can think of all Arm Neoverse CPUs as following a Relaxed Consistency model, which means that acquire-release ordering is supported.
141+
The Arm memory model tends to be considered a Relaxed Consistency model, which means that it is possible for an Arm CPU in the real world to use ordering rules that are stronger than Relaxed Consistency. Going stronger on the memory model will not violate the Arm ordering rules. A stronger memory model means that there might be less opportunity for hardware-based optimizations, it will not affect the correctness of code execution - assuming there are no bugs in the code. You can think of all Arm Neoverse CPUs as following a Relaxed Consistency model, which means that acquire-release ordering is supported.
142142

143143
In a Release Consistency model, ordinary memory accesses like `STR` and `LDR` do not need to follow program order. This relaxation in the ordering rules expands the list of instruction permutations in the litmus test above. It is these additional instruction permutations allowed by the Relaxed Consistency model that yield at least one permutation that results in `(1,0)`. Below is one such example of a permutation. For this permutation, the `LDR` instructions in `P1` are reordered.
144144

0 commit comments

Comments
 (0)