Memory Ordering in Modern Microprocessors (Part I, Part II).
"Linux provides a carefully chosen set of memory-barrier primitives, as follows:
"Linux provides a carefully chosen set of memory-barrier primitives, as follows:
- smp_mb(): “memory barrier” that orders both loads and stores. This means loads and stores preceding the memory barrier are committed to memory before any loads and stores following the memory barrier.
- smp_rmb(): “read memory barrier” that orders only loads.
- smp_wmb(): “write memory barrier” that orders only stores.
- smp_read_barrier_depends(): forces subsequent operations that depend on prior operations to be ordered. This primitive is a no-op on all platforms except Alpha.""All of Linux's locking primitives, including spinlocks, reader-writer locks, semaphores and read-copy updates (RCUs), include any needed barrier primitives."P.S. Тут, видимо, вариант той же самой статьи.P.P.S. Эти статьи можно использовать как введение к более сложному чтиву - "What Every Programmer Should Know About Memory" (114 pages).