Tag

instruction reordering

0 views collected around this technical thread.

Architecture Digest
Architecture Digest
Aug 10, 2023 · Fundamentals

Instruction Reordering and Ordering in Java Double-Checked Locking

The article explains the difference between instruction reordering and ordering, analyzes how the double‑checked locking pattern can suffer from reordering at the bytecode level, and demonstrates how synchronized provides ordering while volatile only prevents visibility issues, using Java code examples and detailed bytecode analysis.

ConcurrencyDouble-Checked LockingJava
0 likes · 7 min read
Instruction Reordering and Ordering in Java Double-Checked Locking
Selected Java Interview Questions
Selected Java Interview Questions
Aug 3, 2023 · Backend Development

Instruction Reordering and Ordering in Java: Analysis of Double-Checked Locking

The article explains the distinction between instruction reordering and ordering in Java, analyzes how volatile and synchronized affect memory visibility and atomicity, and demonstrates with bytecode and multithreaded examples why double‑checked locking requires both volatile and synchronized to avoid partially constructed singleton instances.

ConcurrencyDouble-Checked LockingJava
0 likes · 6 min read
Instruction Reordering and Ordering in Java: Analysis of Double-Checked Locking
Sanyou's Java Diary
Sanyou's Java Diary
Mar 16, 2023 · Fundamentals

Mastering Java’s volatile: Visibility, Atomicity, and Memory Barriers Explained

This article provides a comprehensive guide to Java's volatile keyword, covering its pronunciation, role in the Java Memory Model, visibility guarantees, lack of atomicity, instruction reordering prevention, memory barriers, and practical usage patterns such as double‑checked locking and atomic classes.

AtomicityConcurrencyJMM
0 likes · 20 min read
Mastering Java’s volatile: Visibility, Atomicity, and Memory Barriers Explained
High Availability Architecture
High Availability Architecture
Mar 16, 2022 · Fundamentals

Understanding Ordering Issues and Volatile in Java Concurrency

This article explains why intuition fails in multithreaded Java programs, demonstrates ordering problems with simple thread examples, shows how instruction reordering and JIT optimizations can produce unexpected results, and presents the volatile keyword and jcstress testing as reliable solutions to ensure correct visibility and ordering.

ConcurrencyJavaMemory Model
0 likes · 9 min read
Understanding Ordering Issues and Volatile in Java Concurrency
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.

AtomicityConcurrencyJMM
0 likes · 21 min read
Understanding Java volatile: Visibility, Atomicity, and Instruction Reordering
Wukong Talks Architecture
Wukong Talks Architecture
Oct 20, 2021 · Fundamentals

Understanding Java volatile: Usage, Memory Model, Visibility, Atomicity, and Instruction Reordering

This article provides a comprehensive guide to Java's volatile keyword, covering its pronunciation, purpose, three core properties, interaction with the Java Memory Model, visibility and atomicity examples, instruction reordering, memory barriers, and practical usage such as double‑checked locking and when to prefer volatile over heavier synchronization mechanisms.

AtomicityConcurrencyJava
0 likes · 18 min read
Understanding Java volatile: Usage, Memory Model, Visibility, Atomicity, and Instruction Reordering
JD Tech
JD Tech
Apr 2, 2021 · Fundamentals

Why Intuition Fails: Ordering, Instruction Reordering, and Volatile in Java Concurrency

The article explains how Java's memory model and compiler optimizations can reorder writes, causing ordering bugs in multithreaded programs, demonstrates the issue with simple and jcstress tests, and shows that declaring the flag as volatile restores the expected behavior.

ConcurrencyJavaMemory Model
0 likes · 10 min read
Why Intuition Fails: Ordering, Instruction Reordering, and Volatile in Java Concurrency
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 cacheConcurrencyJMM
0 likes · 22 min read
Deep Dive into Java Volatile Keyword: CPU Cache, MESI Protocol, and JMM
Wukong Talks Architecture
Wukong Talks Architecture
Aug 17, 2020 · Fundamentals

Understanding Java volatile: Visibility, Atomicity, and Instruction Reordering

This article explains the purpose and pronunciation of Java's volatile keyword, describes the Java Memory Model and its three guarantees, demonstrates how volatile ensures visibility but not atomicity, explores instruction reordering and memory barriers, and compares volatile with synchronized and other concurrency tools.

AtomicityConcurrencyJava
0 likes · 20 min read
Understanding Java volatile: Visibility, Atomicity, and Instruction Reordering