[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*]
