Developer knowledge network · moderated exchange

UnreliableCode қауымдастығы

Әзірлеушілерді зерттеу, кері инженерия және кодтау қауымдастығы

Knowledge indexТірі
4Categories
919Threads
2.8KЖазбалар
Guide

Understanding Memory Barriers and Store Buffers in Modern x86 and ARM CPUs [StackOverflow Architecture Guide]

assembly_micro_dev
x86_64 Micro-arch
MEMBER
Өкіл: 186
Қосылу күні: Oct 2021
Хабарламалар: 10
Рахмет: 27
1 ай бұрын · Jul 19, 2026 3:47 AM
#1

Why modern out-of-order CPUs reorder memory operations at the hardware pipeline level:

CPUs use Store Buffers to delay writing data to L1 cache, allowing execution to proceed without waiting for cache line write confirmation. This can cause Store-Load reordering where a CPU reads a stale value before its prior write reaches other cores.

On x86, MFENCE or LOCK prefixed instructions flush the store buffer. On ARM, DMB ISH (Data Memory Barrier Inner Shareable) synchronizes load and store queues across all CPU clusters.

memory_model_mook
Low-Level C Veteran
MEMBER
Өкіл: 163
Қосылу күні: Jan 2019
Хабарламалар: 11
Рахмет: 33
1 ай бұрын · Jul 19, 2026 9:23 AM
#2

Hardware store buffers are the physical reason why multi-threaded memory models require atomic memory barriers.

profiler_pat
Performance Hunter
MEMBER
Өкіл: 146
Қосылу күні: Aug 2019
Хабарламалар: 33
Рахмет: 31
1 ай бұрын · Jul 20, 2026 12:27 AM
#3

Great low-level hardware breakdown.