Tagged articles
atomicity
34 articles · Page 1 of 1
This article introduces thread safety by explaining threads, shared memory, and thread switching, then demonstrates a race condition where a Java counter loses increments due to non-atomic count++, and shows how synchronized fixes it by serializing access.
Java ConcurrencyShared MemorySynchronized
0 likes · 11 min read

The article explains why Java concurrency is difficult by showing that two threads each incrementing an int ten thousand times may not produce twenty thousand, then explores the motivations for multithreading, the differences between concurrency and parallelism, and the three core challenges of visibility, atomicity, and ordering.
ConcurrencyJavaMultithreading
0 likes · 23 min read

The article explains how Redis guarantees atomic operations through single‑command atomicity, MULTI/EXEC transactions, and the WATCH optimistic‑lock mechanism, providing Java/Jedis code examples and discussing their role in ensuring data consistency in distributed systems.
JavaJedisOptimistic Lock
0 likes · 6 min read

This article explains the challenges of thread synchronization in distributed systems, introduces the concept of distributed locks, compares common implementations such as Redis, Zookeeper, and databases, and provides robust Java and Lua solutions to ensure atomicity, avoid deadlocks, and support lock renewal.
ConcurrencyDistributed LockJava
0 likes · 14 min read

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

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.
Multithreadingatomicityperformance-testing
0 likes · 7 min read

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.
ConcurrencyDistributed LockRedis
0 likes · 12 min read

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.
JMMatomicityinstruction reordering
0 likes · 20 min read

This article explains the Java Memory Model, distinguishes main memory from thread-local memory, and demonstrates how visibility, ordering, and atomicity affect concurrent programs through code examples, volatile and synchronized keywords, double‑checked locking, and the Happens‑Before rules.
ConcurrencyJMMJava
0 likes · 18 min read

This article explains the concept of atomicity, demonstrates atomic and non‑atomic Java code using volatile and AtomicInteger, discusses visibility, instruction reordering, the happens‑before principle, and how the JVM implements its memory model with heap and stack structures.
ConcurrencyJavaatomicity
0 likes · 10 min read

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.
JMMJavaatomicity
0 likes · 21 min read

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.
Javaatomicityinstruction reordering
0 likes · 18 min read

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.
ConcurrencyJVMJava
0 likes · 10 min read

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.
ConcurrencyJVMJava
0 likes · 9 min read

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.
Crash RecoveryPolarDBWAL
0 likes · 30 min read

This article explains Java thread safety by defining it, breaking down atomicity, visibility, and ordering, illustrating core concepts with AtomicInteger and AtomicStampedReference examples, and detailing the underlying CAS mechanisms, JMM rules, and the ABA problem.
CASConcurrencyJava
0 likes · 10 min read

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.
Javaatomicityinstruction reordering
0 likes · 20 min read

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.
ConcurrencyJavaatomicity
0 likes · 21 min read

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.
Distributed LockJavaatomicity
0 likes · 11 min read

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-BeforeJavaatomicity
0 likes · 27 min read

This article demonstrates how the volatile keyword influences thread communication in Java, compares client and server JVM modes, analyzes resulting memory visibility and reordering effects, and explores atomicity limits with bytecode examples and practical recommendations.
ConcurrencyJVMJava
0 likes · 8 min read

This article breaks down the Java Memory Model, detailing how atomicity, visibility, and ordering work in multithreaded programs, illustrating the impact of instruction reordering, and showing how synchronized, volatile, and happens‑before rules ensure correct concurrent behavior.
ConcurrencyHappens-BeforeJava
0 likes · 13 min read

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

This article explores how CPU, memory, and I/O speed differences create concurrency bugs, detailing the three core issues of visibility, atomicity, and ordering in Java's memory model and showing practical code examples and solutions.
Javaatomicitymemory model
0 likes · 11 min read

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.
ConcurrencyMultithreadingatomicity
0 likes · 4 min read

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.
ConcurrencyJavaMultithreading
0 likes · 4 min read

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.
ConcurrencyJavaMultithreading
0 likes · 4 min read

This article explains Java’s atomicity and thread‑safety concepts, demonstrates how a simple volatile counter increment isn’t atomic, and shows a multithreaded test that produces inconsistent results, illustrating why proper synchronization is required for safe concurrent access.
ConcurrencyJavaMultithreading
0 likes · 4 min read

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.
ConcurrencyJavaatomicity
0 likes · 16 min read

This article reviews the evolution of Redis‑based distributed lock implementations—from the simple V1.0 pattern to the more robust V3.1 and Redlock algorithm—highlighting their mechanisms, common pitfalls, and guidance on selecting the most suitable lock for a given scenario.
BackendConcurrencyDistributed Lock
0 likes · 13 min read

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.
ConcurrencyHappens-BeforeJava
0 likes · 7 min read

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.
ConcurrencyJavaatomicity
0 likes · 2 min read

This article explains how atomic operations, Java concurrency primitives, database transaction mechanisms, and scalability techniques combine to ensure data consistency and high performance in large‑scale e‑commerce systems under extreme traffic loads.
ConcurrencyJavaatomicity
0 likes · 20 min read

This article explains how Redis Lua scripting can make operations faster, cut network overhead, guarantee atomic execution, and enable script reuse, and it provides practical examples including a simple hello‑world script and a URL‑shortening implementation.
LuaRedisatomicity
0 likes · 3 min read
