1.7 KiB
[hardware.interference]
17 Language support library [support]
17.6 Dynamic memory management [support.dynamic]
17.6.6 Hardware interference size [hardware.interference]
inline constexpr size_t hardware_destructive_interference_size = implementation-defined;
This number is the minimum recommended offset between two concurrently-accessed objects to avoid additional performance degradation due to contention introduced by the implementation.
It shall be at least alignof(max_align_t).
[Example 1: struct keep_apart {alignas(hardware_destructive_interference_size) atomic cat; alignas(hardware_destructive_interference_size) atomic dog;}; â end example]
inline constexpr size_t hardware_constructive_interference_size = implementation-defined;
This number is the maximum recommended size of contiguous memory occupied by two objects accessed with temporal locality by concurrent threads.
It shall be at least alignof(max_align_t).
[Example 2: struct together { atomic 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]