Tag

Double-Checked Locking

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
Selected Java Interview Questions
Selected Java Interview Questions
Feb 21, 2021 · Fundamentals

Understanding Double-Checked Locking Singleton Pattern in Java

This article explains the double-checked locking implementation of the Singleton pattern in Java, detailing why two null checks are necessary, the role of the volatile keyword in preventing instruction reordering and ensuring visibility across threads, and provides a complete example code.

ConcurrencyDouble-Checked LockingJava
0 likes · 5 min read
Understanding Double-Checked Locking Singleton Pattern in Java
Selected Java Interview Questions
Selected Java Interview Questions
May 9, 2020 · Fundamentals

Java Singleton Pattern: Lazy, Eager, Static Inner Class, Enum, and Double-Checked Locking

This article explains the Java Singleton pattern, covering lazy (thread‑unsafe), eager, static inner‑class, enum, and double‑checked locking implementations, discusses their thread‑safety, performance, and serialization issues, and provides complete code examples for interview preparation.

Design PatternDouble-Checked LockingJava
0 likes · 6 min read
Java Singleton Pattern: Lazy, Eager, Static Inner Class, Enum, and Double-Checked Locking
FunTester
FunTester
Feb 15, 2020 · Backend Development

Understanding Double-Checked Locking Singleton Pattern in Java

This article explains the double‑checked locking design pattern for thread‑safe singletons in Java, demonstrates its performance drawbacks, and presents alternative implementations such as early initialization, init‑on‑demand holder, and enum‑based singletons, highlighting their advantages and limitations.

ConcurrencyDesign PatternDouble-Checked Locking
0 likes · 6 min read
Understanding Double-Checked Locking Singleton Pattern in Java
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Sep 16, 2019 · Fundamentals

Why Java Provides Both synchronized and volatile: A Deep Dive into Concurrency

This article explains the distinct roles of Java's synchronized and volatile keywords, analyzes their performance and ordering characteristics, demonstrates how instruction reordering can cause bugs in double‑checked locking, and shows why volatile remains indispensable for safe concurrent programming.

ConcurrencyDouble-Checked LockingJava
0 likes · 12 min read
Why Java Provides Both synchronized and volatile: A Deep Dive into Concurrency
Java Captain
Java Captain
Nov 13, 2017 · Fundamentals

Understanding the Singleton Design Pattern in Java: Implementations, Thread Safety, and Best Practices

This article explains the Singleton design pattern in Java, covering its definition, lazy and eager implementations, thread‑safety issues such as double‑checked locking and volatile, and alternative approaches like static inner classes and enums, providing code examples and practical insights.

ConcurrencyDesign PatternDouble-Checked Locking
0 likes · 14 min read
Understanding the Singleton Design Pattern in Java: Implementations, Thread Safety, and Best Practices