Memory Barrier - Low-level Architecture-specific Primitives

Low-level Architecture-specific Primitives

Memory barriers are low-level primitives which are part of the definition of an architecture's memory model. Like instruction sets, memory models vary considerably between architectures, so it is not appropriate to generalize about memory barrier behavior. The conventional wisdom is that using memory barriers correctly requires careful study of the architecture manuals for the hardware being programmed. That said, the following paragraph offers a glimpse of some memory barriers which exist in contemporary products.

Some architectures, including the ubiquitous x86/x64, provide several memory barrier instructions including an instruction sometimes called "full fence". A full fence ensures that all load and store operations prior to the fence will have been committed prior to any loads and stores issued following the fence. Other architectures, such as the Itanium, provide separate "acquire" and "release" memory barriers which address the visibility of read-after-write operations from the point of view of a reader (sink) or writer (source) respectively. Some architectures provide separate memory barriers to control ordering between different combinations of system memory and I/O memory. When more than one memory barrier instruction is available it is important to consider that the cost of different instructions may vary considerably.

Read more about this topic:  Memory Barrier

Famous quotes containing the word low-level:

    The Republicans hardly need a party and the cumbersome cadre of low-level officials that form one; they have a bankroll as large as the Pentagon’s budget, dozens of fatted PACs, and the well-advertised support of the Christian deity.
    Barbara Ehrenreich (b. 1941)