Tagged articles
38 articles
Page 1 of 1
Tech Freedom Circle
Tech Freedom Circle
Apr 25, 2026 · Fundamentals

Why a Simple Singleton Answer Failed an Alibaba Interview: The Real Role of volatile, Memory Barriers, and Happens‑Before

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.

Happens-beforeJMMJava
0 likes · 20 min read
Why a Simple Singleton Answer Failed an Alibaba Interview: The Real Role of volatile, Memory Barriers, and Happens‑Before
Senior Tony
Senior Tony
Aug 20, 2025 · Backend Development

Why Volatile Solves Memory Visibility and Reordering in Java?

This article explains how the volatile keyword guarantees visibility of shared variables and prevents instruction reordering in Java, covering the Java Memory Model, memory barriers, practical code examples, and the Happens‑Before principle for reliable multithreaded programming.

Instruction ReorderingJMMJava
0 likes · 10 min read
Why Volatile Solves Memory Visibility and Reordering in Java?
The Dominant Programmer
The Dominant Programmer
Jul 9, 2025 · Fundamentals

Understanding Java Memory Model (JMM): Core Concepts and Guarantees

This article explains the Java Memory Model (JMM), detailing its purpose, the distinction from JVM memory structure, the eight memory interaction operations, the happens‑before principle, memory barriers, and common pitfalls such as double‑checked locking and visibility bugs, with concrete code examples.

Happens-beforeJMMJava
0 likes · 12 min read
Understanding Java Memory Model (JMM): Core Concepts and Guarantees
Su San Talks Tech
Su San Talks Tech
Feb 17, 2025 · Fundamentals

Why Changing int to Integer Lets a Non‑volatile Java Loop Terminate

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
Why Changing int to Integer Lets a Non‑volatile Java Loop Terminate
Sanyou's Java Diary
Sanyou's Java Diary
Sep 26, 2024 · Fundamentals

Mastering Java volatile: Visibility, Atomicity, and Memory Model Explained

This article provides a comprehensive guide to Java's volatile keyword, covering its pronunciation, core features such as visibility, lack of atomicity, and instruction reordering prevention, the Java Memory Model, cache‑coherence mechanisms, practical code examples, and best‑practice scenarios like double‑checked locking and when to prefer volatile over heavier synchronization constructs.

JMMMemory Modelmultithreading
0 likes · 21 min read
Mastering Java volatile: Visibility, Atomicity, and Memory Model Explained
Tencent Cloud Developer
Tencent Cloud Developer
Aug 17, 2023 · Backend Development

Java Memory Model and Concurrent Programming: Visibility, Ordering, and Atomicity

The article explains how the Java Memory Model addresses concurrency challenges by defining visibility, ordering, and atomicity guarantees through mechanisms such as volatile, synchronized, cache coherence, memory barriers, CAS operations, and happens‑before relationships, enabling correct and portable multi‑threaded programming.

CASConcurrent ProgrammingHappens-before
0 likes · 25 min read
Java Memory Model and Concurrent Programming: Visibility, Ordering, and Atomicity
Programmer DD
Programmer DD
May 11, 2023 · Backend Development

Why Java’s ArrayList addAll Fails Under Concurrency and How to Fix It

This article explains the importance and challenges of concurrent programming, details Java's memory model and synchronization primitives, analyzes a real‑world case where concurrent addAll on ArrayList caused missing UI elements, and demonstrates how using thread‑safe collections resolves the issue.

ArrayListJMMJava
0 likes · 14 min read
Why Java’s ArrayList addAll Fails Under Concurrency and How to Fix It
Java Tech Enthusiast
Java Tech Enthusiast
Nov 9, 2021 · Fundamentals

Understanding Variable Visibility and the volatile Keyword in Java

The article explains Java’s variable‑visibility problem in multithreaded code, describes the Java Memory Model and the happens‑before rules, and shows how synchronization or declaring a field volatile (as in double‑checked‑locking Singleton) guarantees that updates become visible across threads and prevents instruction reordering.

JMMJavamultithreading
0 likes · 13 min read
Understanding Variable Visibility and the volatile Keyword in Java
Sohu Tech Products
Sohu Tech Products
Oct 27, 2021 · Fundamentals

Understanding Java volatile: Visibility, Atomicity, and Instruction Reordering

This article provides a comprehensive overview of Java's volatile keyword, explaining its pronunciation, role in the Java Memory Model, the three visibility guarantees, how it prevents instruction reordering, its lack of atomicity, practical code examples, and best‑practice scenarios such as double‑checked locking.

Instruction ReorderingJMMJava
0 likes · 21 min read
Understanding Java volatile: Visibility, Atomicity, and Instruction Reordering
Wukong Talks Architecture
Wukong Talks Architecture
Aug 17, 2021 · Fundamentals

Core Java Multithreading Interview Questions and Concepts

This article compiles 16 classic Java multithreading interview questions covering high‑concurrency containers, CAS and ABA problems, volatile vs synchronized, the Java Memory Model, ThreadLocal drawbacks, AQS, thread‑pool architecture, queue types, sizing strategies, rejection policies, lifecycle management, and graceful shutdown techniques.

CASJMMJava
0 likes · 20 min read
Core Java Multithreading Interview Questions and Concepts
ITPUB
ITPUB
Jul 29, 2021 · Fundamentals

Mastering Java’s Happens‑Before Principle and Memory Model

This article explains the Java Memory Model, how threads interact with main and working memory, and details the happens‑before rules—including program order, monitor, volatile, thread start, join, and transfer—to help developers understand visibility and ordering challenges in concurrent Java programs.

Happens-beforeJMMJava
0 likes · 10 min read
Mastering Java’s Happens‑Before Principle and Memory Model
macrozheng
macrozheng
May 21, 2021 · Fundamentals

Why Java’s Memory Model Matters: Unveiling the Hidden Rules of Concurrency

This article explains the hardware memory hierarchy, cache‑coherency issues, processor optimizations and instruction reordering, and shows how the Java Memory Model (JMM) defines eight operations to guarantee visibility, atomicity and ordering for multithreaded Java programs.

Cache CoherencyJMMJava
0 likes · 12 min read
Why Java’s Memory Model Matters: Unveiling the Hidden Rules of Concurrency
TAL Education Technology
TAL Education Technology
May 13, 2021 · Backend Development

Understanding Java Concurrency: Volatile, Synchronized, JMM, and MESI

This article provides a comprehensive tutorial on Java concurrency, covering the usage and implementation principles of the volatile and synchronized keywords, the Java Memory Model, the MESI cache protocol, common visibility and reordering issues, and practical code examples for designing efficient multithreaded solutions.

JMMJavaMESI
0 likes · 17 min read
Understanding Java Concurrency: Volatile, Synchronized, JMM, and MESI
Su San Talks Tech
Su San Talks Tech
Apr 28, 2021 · Fundamentals

Master Java Concurrency: HashMap, ConcurrentHashMap, JMM, Thread Pools & More

Explore deep Java concurrency concepts, from HashMap internals and its JDK7/JDK8 differences to ConcurrentHashMap’s lock strategies, thread states, memory models, volatile, CAS, synchronized, thread pools, AQS, and common interview questions, providing comprehensive insights for mastering multithreaded programming.

HashMapJMMThreadPool
0 likes · 38 min read
Master Java Concurrency: HashMap, ConcurrentHashMap, JMM, Thread Pools & More
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Jan 8, 2021 · Backend Development

Deep Dive into Java HashMap, ConcurrentHashMap, JMM, and Concurrency Fundamentals

This article provides a comprehensive overview of Java's HashMap and ConcurrentHashMap implementations, explains core concurrency concepts such as thread states, the differences between concurrency and parallelism, memory models, volatile semantics, singleton patterns, thread pools, ThreadLocal, CAS, and the AQS framework.

HashMapJMMJava
0 likes · 31 min read
Deep Dive into Java HashMap, ConcurrentHashMap, JMM, and Concurrency Fundamentals
vivo Internet Technology
vivo Internet Technology
Jan 6, 2021 · Fundamentals

Deep Dive into Java Volatile Keyword: CPU Cache, MESI Protocol, and JMM

The article thoroughly explains how CPU caches and the MESI coherence protocol interact with Java’s Memory Model, detailing the volatile keyword’s role in ensuring visibility and preventing instruction reordering, and illustrates these concepts with examples such as visibility problems and double‑checked locking.

CPU cacheInstruction ReorderingJMM
0 likes · 22 min read
Deep Dive into Java Volatile Keyword: CPU Cache, MESI Protocol, and JMM
Code Ape Tech Column
Code Ape Tech Column
Dec 25, 2020 · Fundamentals

Inside the JVM: Unraveling Memory Areas, GC, and Class Loading

This article provides a comprehensive overview of the Java Virtual Machine, covering its runtime data areas, the Java Memory Model, heap organization, garbage‑collection algorithms, HotSpot implementation details, JVM tuning parameters, and the class‑loading mechanism.

Garbage CollectionJMMJVM
0 likes · 29 min read
Inside the JVM: Unraveling Memory Areas, GC, and Class Loading
Selected Java Interview Questions
Selected Java Interview Questions
Sep 20, 2020 · Backend Development

Comprehensive Guide to Java Multithreading: Concepts, APIs, and Best Practices

This article provides an in‑depth overview of Java multithreading, covering fundamental concepts such as processes, threads, parallelism vs concurrency, thread creation methods, lifecycle states, synchronization mechanisms, memory model nuances, lock implementations, common pitfalls like deadlocks, and practical usage of thread pools with best‑practice recommendations.

CASJMMJava
0 likes · 39 min read
Comprehensive Guide to Java Multithreading: Concepts, APIs, and Best Practices
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Jun 30, 2020 · Fundamentals

Understanding Java Volatile Keyword and Memory Model

This article provides a comprehensive tutorial on Java's volatile keyword, covering its role in the Java Memory Model, the three concurrency fundamentals of atomicity, visibility, and ordering, and detailed explanations of volatile's visibility, ordering guarantees, implementation mechanisms, and a source code example.

JMMJavaMemory Model
0 likes · 10 min read
Understanding Java Volatile Keyword and Memory Model
Programmer DD
Programmer DD
May 18, 2020 · Fundamentals

Why Java’s final Fields Matter: Memory Model Rules Explained

This article explores Java’s memory model rules for final fields, detailing how writes and reads are ordered, the impact on object construction, examples with primitive and reference types, and processor-specific implementations, illustrating why final provides safe initialization without explicit synchronization.

JMMJavaMemory Model
0 likes · 13 min read
Why Java’s final Fields Matter: Memory Model Rules Explained
Architecture Digest
Architecture Digest
Mar 14, 2020 · Fundamentals

Understanding the Java Memory Model (JMM) and Its Concurrency Rules

This article explains the Java Memory Model, describing how main memory and thread‑local working memory interact, the eight primitive actions defined by the JVM, the special semantics of volatile, long and double variables, and how these concepts underpin atomicity, visibility and the happens‑before principle in concurrent Java programs.

Happens-beforeJMMJava
0 likes · 23 min read
Understanding the Java Memory Model (JMM) and Its Concurrency Rules
Architecture Digest
Architecture Digest
Dec 7, 2019 · Fundamentals

Understanding the Java volatile Keyword and Its Role in Concurrency

This article explains the Java volatile keyword, covering its memory visibility and ordering guarantees, how it interacts with the Java Memory Model, common pitfalls such as lack of atomicity, and practical usage examples like flag signaling and double‑checked locking in concurrent programming.

JMMJavaconcurrency
0 likes · 17 min read
Understanding the Java volatile Keyword and Its Role in Concurrency
Programmer DD
Programmer DD
Jun 4, 2018 · Fundamentals

How Java’s As‑If‑Serial Semantics Keep Single‑Thread Results but Break Multithreaded Guarantees

The article explains why Java and the JVM reorder instructions for performance, the conditions that must be met, how the as‑if‑serial rule protects single‑threaded outcomes, and why the same reordering can violate happens‑before guarantees in multithreaded code, illustrated with concrete examples and code.

Instruction ReorderingJMMJava
0 likes · 8 min read
How Java’s As‑If‑Serial Semantics Keep Single‑Thread Results but Break Multithreaded Guarantees
Java Captain
Java Captain
Jun 3, 2018 · Fundamentals

Understanding High Concurrency in Java: Memory Model, Thread Safety, and Synchronization Techniques

This article explores Java high‑concurrency concepts, detailing the Java Memory Model, thread communication, instruction reordering, atomic classes, synchronization mechanisms, lock implementations, concurrent collections, and safe object publication, providing code examples and practical guidance for building robust multithreaded applications.

JMMJavaThreadSafety
0 likes · 18 min read
Understanding High Concurrency in Java: Memory Model, Thread Safety, and Synchronization Techniques
21CTO
21CTO
Oct 24, 2017 · Backend Development

Mastering Java Concurrency: Key Concepts, Thread Lifecycle, and JMM Explained

This article explains essential Java concurrency concepts—including synchronous vs. asynchronous execution, concurrency vs. parallelism, critical sections, blocking and non‑blocking operations—covers thread states, creation methods, priorities, common thread APIs, and the Java Memory Model’s guarantees on atomicity, visibility, and ordering.

JMMJavaSynchronization
0 likes · 22 min read
Mastering Java Concurrency: Key Concepts, Thread Lifecycle, and JMM Explained
Architecture Digest
Architecture Digest
Oct 24, 2017 · Backend Development

Understanding Java Thread Concurrency: Concepts, Lifecycle, and the Java Memory Model

This article explains key Java concurrency concepts—including synchronization, parallelism, critical sections, blocking vs non‑blocking, thread lifecycle, priority, common thread methods, interrupt handling, and the Java Memory Model’s guarantees of atomicity, visibility, ordering, and happens‑before relations—providing practical examples and code snippets for backend developers.

JMMJavaSynchronization
0 likes · 24 min read
Understanding Java Thread Concurrency: Concepts, Lifecycle, and the Java Memory Model
Architecture Digest
Architecture Digest
Feb 26, 2016 · Backend Development

Comprehensive Guide to Java Concurrency: Concepts, Synchronization, Thread Pools, and the Java Memory Model

This article provides an extensive overview of Java concurrency, covering synchronous vs asynchronous calls, critical sections, blocking and non‑blocking behavior, deadlock, starvation, livelock, concurrency levels, the Java Memory Model, atomicity, visibility, ordering, thread lifecycle, synchronization mechanisms, thread pools, and related utilities.

JMMJavaSynchronization
0 likes · 39 min read
Comprehensive Guide to Java Concurrency: Concepts, Synchronization, Thread Pools, and the Java Memory Model