This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
[hardware.interference]
# 17 Language support library [[support]](./#support)
## 17.6 Dynamic memory management [[support.dynamic]](support.dynamic#hardware.interference)
### 17.6.6 Hardware interference size [hardware.interference]
[🔗](#lib:hardware_destructive_interference_size)
`inline constexpr size_t hardware_destructive_interference_size = implementation-defined;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3217)
This number is the minimum recommended offset
between two concurrently-accessed objects
to avoid additional performance degradation due to contention
introduced by the implementation[.](#1.sentence-1)
It shall be at least alignof(max_align_t)[.](#1.sentence-2)
[*Example [1](#example-1)*: struct keep_apart {alignas(hardware_destructive_interference_size) atomic<int> cat; alignas(hardware_destructive_interference_size) atomic<int> dog;}; — *end example*]
[🔗](#lib:hardware_constructive_interference_size)
`inline constexpr size_t hardware_constructive_interference_size = implementation-defined;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3239)
This number is the maximum recommended size of contiguous memory
occupied by two objects accessed with temporal locality by concurrent threads[.](#2.sentence-1)
It shall be at least alignof(max_align_t)[.](#2.sentence-2)
[*Example [2](#example-2)*: struct together { atomic<int> dog; int puppy;};struct kennel {// Other data members...alignas(sizeof(together)) together pack; // Other data members...};static_assert(sizeof(together) <= hardware_constructive_interference_size); — *end example*]