What is Memory barrier?

An instruction guaranteeing that memory operations before it become visible to other cores before those after it, also called a fence, such as RISC-V fence.

Field: Multicore & Synchronization

Memory barrier in the explanations

Questions that mention Memory barrier (2)

  1. What is the role of a memory barrier (fence) instruction?
  2. The two threads above run simultaneously on different cores (assume no compiler reordering). Which outcome cannot occur under sequential consistency but can occur on real CPUs such as x86?

Related terms

Sequential consistency Store buffer ABA problem Acquire-release semantics Atomic instruction Barrier synchronization Bus snooping Compare-and-swap Condition variable Critical section

Back to the glossary