Tagged articles
31 articles
Page 1 of 1
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
FunTester
FunTester
Aug 7, 2023 · Backend Development

Atomic Operation Pitfalls in Java Performance Testing and How to Fix Them

This article describes a Java performance‑testing script that uses concurrent user initialization, explains how overlooking atomicity in thread‑safe classes caused some users to miss initialization, and presents three practical solutions such as improving stop logic, tracking completed users, and using concurrent collections.

atomicitymultithreadingperformance-testing
0 likes · 7 min read
Atomic Operation Pitfalls in Java Performance Testing and How to Fix Them
Tech Architecture Stories
Tech Architecture Stories
Jul 24, 2023 · Backend Development

Mastering Distributed Locks: When to Use Redis, Zookeeper, and Redlock

This guide explains why distributed locks are needed, how to correctly acquire and release them, compares Redis and Zookeeper implementations—including single‑master, Redlock, and Zookeeper approaches—and offers practical recommendations for ensuring atomicity, preventing deadlocks, and protecting shared resources in production environments.

ZooKeeperatomicityconcurrency
0 likes · 12 min read
Mastering Distributed Locks: When to Use Redis, Zookeeper, and Redlock
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
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.

Instruction ReorderingJavaMemory Model
0 likes · 18 min read
Understanding Java volatile: Usage, Memory Model, Visibility, Atomicity, and Instruction Reordering
Programmer DD
Programmer DD
Aug 15, 2021 · Fundamentals

Is Java’s long and double Access Truly Atomic? A Deep Dive

Through a multithreaded test program, this article explores whether Java’s 64‑bit long and double types are accessed atomically on 32‑bit and 64‑bit JVMs, explains the JVM memory model rules, and shows how volatility and hardware affect atomicity.

JVMJavaLong
0 likes · 10 min read
Is Java’s long and double Access Truly Atomic? A Deep Dive
Programmer DD
Programmer DD
Jul 19, 2021 · Fundamentals

Is Java’s long Truly Atomic? Exploring JVM Memory Model Behavior

This article investigates whether long and double variables are atomic in the JVM, demonstrates non‑atomic behavior on 32‑bit HotSpot with a multithreaded test, explains the Java Memory Model rules, and shows that atomicity is guaranteed on 64‑bit JVMs or when using volatile.

JVMJavaMemory Model
0 likes · 9 min read
Is Java’s long Truly Atomic? Exploring JVM Memory Model Behavior
Alibaba Cloud Developer
Alibaba Cloud Developer
Jun 2, 2021 · Databases

How PolarDB Guarantees Transaction Atomicity: From WAL to Visibility

This article explains how PolarDB ensures transaction atomicity by analyzing ACID principles, detailing the shortcomings of simple Direct‑IO and Buffer‑IO, introducing write‑ahead logging, full‑page backup, checkpointing, visibility mechanisms, and distinguishing durability and atomicity points to achieve reliable crash recovery and consistent data visibility.

PolardbWALatomicity
0 likes · 30 min read
How PolarDB Guarantees Transaction Atomicity: From WAL to Visibility
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.

Instruction ReorderingJavaMemory Model
0 likes · 20 min read
Understanding Java volatile: Visibility, Atomicity, and Instruction Reordering
Architect
Architect
Aug 8, 2020 · Fundamentals

Understanding Java Memory Model, Volatile, Atomicity, Visibility, and Ordering

This article explains the Java memory model, how variables are stored in main and working memory, and why concurrency issues like dirty reads, non‑atomic operations, and instruction reordering occur, while detailing the roles of volatile, synchronized, locks, and atomic classes in ensuring visibility, ordering, and atomicity.

JavaMemory Modelatomicity
0 likes · 21 min read
Understanding Java Memory Model, Volatile, Atomicity, Visibility, and Ordering
Top Architect
Top Architect
Aug 8, 2020 · Backend Development

Analysis and Solutions for Redis Distributed Lock Over‑sell Incident in High‑Concurrency Seckill

This article examines a real-world over‑sell incident caused by an unsafe Redis distributed lock in a high‑traffic seckill service, analyzes the root causes such as lock expiration and non‑atomic stock checks, and presents safer lock implementations, atomic stock operations, and refactored code to prevent future overselling.

JavaSeckillatomicity
0 likes · 11 min read
Analysis and Solutions for Redis Distributed Lock Over‑sell Incident in High‑Concurrency Seckill
Programmer DD
Programmer DD
Jul 2, 2020 · Fundamentals

Why volatile Doesn’t Guarantee Atomicity in Java and How to Use It Correctly

This article explains the Java memory model, the role of the volatile keyword in ensuring visibility and ordering, why it cannot provide atomicity for compound operations, and presents proper synchronization techniques such as synchronized, Lock, AtomicInteger, and double‑checked locking.

Happens-beforeJavaMemory Model
0 likes · 27 min read
Why volatile Doesn’t Guarantee Atomicity in Java and How to Use It Correctly
Programmer DD
Programmer DD
Oct 14, 2019 · Fundamentals

Mastering Java Locks: Ensure Atomicity and Avoid Concurrency Bugs

This article explains the root cause of atomicity issues in multithreaded Java programs, introduces mutex concepts, demonstrates three synchronized lock usages with code examples, discusses critical sections, lock granularity, and common pitfalls, and provides practical guidelines for correctly protecting shared resources.

Javaatomicity
0 likes · 9 min read
Mastering Java Locks: Ensure Atomicity and Avoid Concurrency Bugs
FunTester
FunTester
Jul 22, 2019 · Fundamentals

Why a Simple Increment Isn’t Thread‑Safe: A Java Concurrency Demo

This article explains atomicity, thread safety, and race conditions in Java by showing how a volatile counter increment can produce nondeterministic results when accessed concurrently, complete with sample code and console output analysis.

atomicityconcurrencyexample
0 likes · 4 min read
Why a Simple Increment Isn’t Thread‑Safe: A Java Concurrency Demo
FunTester
FunTester
Jul 16, 2019 · Fundamentals

Why Incrementing a Counter Isn’t Thread‑Safe in Java: A Hands‑On Demo

This article explains atomicity, thread safety, and thread‑unsafe behavior in Java, demonstrates a simple class with a volatile counter, runs two concurrent threads that increment it, shows the non‑atomic nature of i++, and analyzes why the final value may remain 1.

Javaatomicityconcurrency
0 likes · 4 min read
Why Incrementing a Counter Isn’t Thread‑Safe in Java: A Hands‑On Demo
FunTester
FunTester
Jul 14, 2019 · Fundamentals

Why a Simple Increment Fails in Multithreaded Java: A Concurrency Demo

This article explains atomicity, thread safety, and race conditions in Java by walking through a concrete example where multiple threads increment a shared volatile variable, showing why the non‑atomic i++ operation leads to inconsistent results.

Javaatomicityconcurrency
0 likes · 4 min read
Why a Simple Increment Fails in Multithreaded Java: A Concurrency Demo
Java Captain
Java Captain
Feb 27, 2019 · Fundamentals

Understanding Java volatile: Memory Visibility, Ordering, and Interview Insights

This article explains the Java volatile keyword, covering its memory‑visibility and ordering guarantees, how it interacts with the Java Memory Model, why it does not ensure atomicity, and demonstrates typical interview‑style examples and code snippets such as flag signaling and double‑checked locking.

JavaMemory Modelatomicity
0 likes · 16 min read
Understanding Java volatile: Memory Visibility, Ordering, and Interview Insights
Programmer DD
Programmer DD
Jun 9, 2018 · Fundamentals

Unlocking Java’s Memory Model: Core Concepts and the Happens‑Before Rule

This concise summary explains the Java Memory Model’s definition of thread‑memory interaction, covering atomicity, visibility, ordering, the happens‑before principle, compiler/processor reordering constraints, and sequential consistency, while also listing key reference articles and further reading.

Happens-beforeJavaMemory Model
0 likes · 7 min read
Unlocking Java’s Memory Model: Core Concepts and the Happens‑Before Rule
ZhiKe AI
ZhiKe AI
Feb 23, 2017 · Fundamentals

Why volatile Is Not Thread‑Safe: A Java Increment Test

The article presents a Java program where 100 threads each increment a volatile int 1,000 times, showing that the final value may be less than the expected 100,000, and explains that volatile only guarantees visibility, not atomicity, making it unsuitable for concurrent modifications.

Javaatomicityconcurrency
0 likes · 2 min read
Why volatile Is Not Thread‑Safe: A Java Increment Test