tmp/tmpph6sl6ad/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Hardware interference size <a id="hardware.interference">[[hardware.interference]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
inline constexpr size_t hardware_destructive_interference_size = implementation-defined{};
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
This number is the minimum recommended offset between two
|
| 8 |
+
concurrently-accessed objects to avoid additional performance
|
| 9 |
+
degradation due to contention introduced by the implementation. It shall
|
| 10 |
+
be at least `alignof(max_align_t)`.
|
| 11 |
+
|
| 12 |
+
[*Example 1*:
|
| 13 |
+
|
| 14 |
+
``` cpp
|
| 15 |
+
struct keep_apart {
|
| 16 |
+
alignas(hardware_destructive_interference_size) atomic<int> cat;
|
| 17 |
+
alignas(hardware_destructive_interference_size) atomic<int> dog;
|
| 18 |
+
};
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
— *end example*]
|
| 22 |
+
|
| 23 |
+
``` cpp
|
| 24 |
+
inline constexpr size_t hardware_constructive_interference_size = implementation-defined{};
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
This number is the maximum recommended size of contiguous memory
|
| 28 |
+
occupied by two objects accessed with temporal locality by concurrent
|
| 29 |
+
threads. It shall be at least `alignof(max_align_t)`.
|
| 30 |
+
|
| 31 |
+
[*Example 2*:
|
| 32 |
+
|
| 33 |
+
``` cpp
|
| 34 |
+
struct together {
|
| 35 |
+
atomic<int> dog;
|
| 36 |
+
int puppy;
|
| 37 |
+
};
|
| 38 |
+
struct kennel {
|
| 39 |
+
// Other data members...
|
| 40 |
+
alignas(sizeof(together)) together pack;
|
| 41 |
+
// Other data members...
|
| 42 |
+
};
|
| 43 |
+
static_assert(sizeof(together) <= hardware_constructive_interference_size);
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
— *end example*]
|
| 47 |
+
|