Tagged articles
memory barrier
11 articles · Page 1 of 1
This article explains Java's volatile and CAS primitives, detailing volatile's visibility and ordering guarantees, the memory barriers the JVM inserts, CAS's atomic compare‑and‑swap operation, common pitfalls like the ABA problem, and how their combination enables lock‑free thread safety, with code examples and interview tips.
CASConcurrencyHappens-Before
0 likes · 9 min read

The article dissects an Alibaba interview question about the volatile modifier, showing why answering only with a lazy‑loaded singleton is insufficient, and explains how volatile prevents instruction reordering, establishes memory barriers, and creates happens‑before relationships to make double‑checked locking safe.
ConcurrencyHappens-BeforeJMM
0 likes · 20 min read

This article explains what memory barriers are, why they are essential for correct multi‑core operation in the Linux kernel, how different barrier types work, their implementation details, and practical guidelines for using them safely in synchronization primitives and driver code.
Linux kernelLow-Level ProgrammingMultithreading
0 likes · 47 min read

This article explains the purpose of C's volatile keyword, how it influences compiler optimizations, its role in multithreaded scenarios, the distinction between visibility and atomicity, and why memory barriers or locks are preferred for proper synchronization.
C++ConcurrencyMultithreading
0 likes · 8 min read

This article explains key embedded software concepts, including how stack watermark detection tracks maximum stack usage, the differences between shallow and deep copying of data structures, the distinction between synchronous and asynchronous processing, and the role of memory barriers in enforcing operation ordering on weakly consistent architectures.
Deep CopyShallow CopySynchronous
0 likes · 7 min read

This article explores a classic Java concurrency puzzle where a non‑volatile flag causes an infinite loop, examines how modifying the loop variable from int to Integer or adding volatile affects termination, and explains the underlying JVM memory‑barrier behavior revealed by DeepSeek.
HotSpotJMMJava
0 likes · 11 min read

This article explains how Java's volatile keyword provides visibility guarantees and prevents instruction reordering through memory barriers, illustrates its behavior with code examples, discusses its limitations regarding atomicity, and outlines appropriate usage scenarios such as state flags and double‑checked locking.
Javainstruction reorderingmemory barrier
0 likes · 9 min read

The article categorizes Linux kernel synchronization primitives by their target—critical sections, CPUs, memory, or cache—detailing atomic variables, spinlocks, semaphores, mutexes, read‑write locks, preemption, RCU, and memory barriers, explaining their mechanisms, trade‑offs, and typical kernel usage examples.
LinuxLocksSemaphore
0 likes · 15 min read

This article explains the purpose, usage scenarios, and memory semantics of Java's volatile keyword, demonstrates its behavior with code examples and memory barrier concepts, and summarizes how volatile ensures visibility and ordering across threads.
ConcurrencyJavamemory barrier
0 likes · 9 min read

This article explains concurrency fundamentals by examining hardware-level cache coherence, memory barriers, and lock mechanisms, then shows how Go's sync.Mutex and Java's volatile keyword implement these concepts to ensure atomicity, visibility, and ordering across multiple cores.
Concurrencycache coherencehardware
0 likes · 8 min read

This article explains how Java's ReentrantLock guarantees memory visibility for shared variables without using volatile, by leveraging the Java Memory Model's happens‑before guarantees, the lock's internal volatile state, and underlying CPU memory‑barrier instructions such as the LOCK prefix.
Happens-BeforeJavaReentrantLock
0 likes · 10 min read
