Tagged articles
atomic
32 articles · Page 1 of 1
This article examines six typical concurrency mistakes in Spring Boot 3—misusing volatile, unsafe ConcurrentHashMap patterns, exposing mutable collections, removing synchronized, abusing parallel streams, and invisible shutdown flags—showing why they occur and providing concrete, thread‑safe code replacements.
ConcurrencyConcurrentHashMapJava
0 likes · 9 min read

Over the past two years, Go’s sync and sync/atomic packages have introduced new APIs like WaitGroup.Go, enhanced Map methods, modernized atomic types, restructured internal implementations, and added developer‑friendly safeguards such as noCopy, all aimed at improving usability, safety, and performance for concurrent Go programs.
APIConcurrencyGo
0 likes · 12 min read

Lock‑free queues replace costly mutexes with atomic operations, eliminating lock contention, deadlocks, and scalability limits, and this article explains their principles, classic implementations, C++ code examples, performance testing, and real‑world applications such as game engines and high‑throughput servers.
C++CASConcurrency
0 likes · 38 min read

This article explains the principles of non‑blocking algorithms, compares them with blocking concurrency approaches, and demonstrates Java implementations using volatile variables, atomic classes, optimistic locking, and templates, highlighting their advantages and challenges in multithreaded environments.
AlgorithmsConcurrencyatomic
0 likes · 24 min read

This article reviews the Go memory model first written in 2009, highlights missing documentation for sync and sync/atomic APIs, proposes concrete textual and typed‑atomic extensions, and explains why certain compiler optimizations must remain prohibited to preserve clear, race‑free semantics.
ConcurrencyGoHappens-Before
0 likes · 24 min read

This article explains what a mutex is, why it is needed in concurrent programming, shows basic lock/unlock operations with Go code examples, compares mutexes with atomic operations, and provides best‑practice guidelines to avoid deadlocks and improve performance.
ConcurrencySynchronizationatomic
0 likes · 8 min read

This guide explains how to build high‑performance lock‑free data structures in Rust by using atomic operations, memory ordering semantics, and practical examples such as a thread‑safe counter and a lock‑free stack, followed by best‑practice recommendations.
Concurrencyatomiclock-free
0 likes · 4 min read

This article explains Go's concurrency model, detailing how goroutines are scheduled on logical processors, how to create and manage them, detect and resolve race conditions using atomic operations, mutexes, and channels, and demonstrates practical code examples for each concept.
BackendMutexatomic
0 likes · 19 min read

The article explains the distinction between a data race—simultaneous unsynchronized memory access by goroutines—and a race condition—logic errors caused by timing dependencies—using Go code examples, demonstrates how to reproduce each issue, and shows how mutexes or atomic operations can resolve them.
ConcurrencyData RaceGo
0 likes · 5 min read

This article walks through Go's concurrency model, detailing how goroutines are scheduled across logical processors, how to control parallelism with GOMAXPROCS, detect and resolve race conditions using atomic operations, mutexes, and channels, and provides practical code examples for each concept.
ChannelsConcurrencyGo
0 likes · 18 min read

This comprehensive guide explains the fundamentals of concurrent programming in Go, covering the differences between parallelism and concurrency, process and thread concepts, and detailed usage of goroutines, channels, select statements, timers, mutexes, read‑write locks, wait groups, once, sync.Map, and atomic operations with practical code examples and diagrams.
ConcurrencyMutexParallelism
0 likes · 42 min read

This article provides a comprehensive guide to Go's concurrency model, covering goroutine creation, the scheduler, communication via channels, handling race conditions, and synchronization techniques using atomic operations and mutexes, complete with practical code examples and visual diagrams.
ConcurrencyGoMutex
0 likes · 27 min read

This article explores Go's built‑in concurrency primitives—including Mutex, RWMutex, Condition variables, atomic operations, sync.Once, and WaitGroup—detailing their purposes, usage patterns, and best‑practice guidelines to write correct and efficient concurrent programs.
ConcurrencyRWMutexatomic
0 likes · 13 min read

Multithreaded programming splits tasks across logical and hardware threads to exploit multicore CPUs, requiring careful use of synchronization primitives such as mutexes, read‑write locks, condition variables, and lock‑free atomics, while avoiding pitfalls like race conditions, deadlocks, and false sharing for correct, high‑performance software.
C++LockMultithreading
0 likes · 65 min read

This article explains Go's concurrency model, detailing how goroutines are scheduled onto logical processors, how to create and run them, handle race conditions with atomic operations, mutexes, and the race detector, and share data safely using unbuffered and buffered channels with practical code examples.
GoMutexatomic
0 likes · 19 min read

This article explains Go's concurrency model, detailing how goroutines are scheduled onto logical processors, how to create and run them, detect and resolve race conditions with atomic operations, mutexes, and channels, and demonstrates buffered versus unbuffered channel communication.
GoMutexRace Detection
0 likes · 18 min read

This article explains the Java volatile keyword, covering its underlying principles, effects on visibility and instruction reordering, appropriate usage scenarios, limitations, and provides a practical code example demonstrating how volatile ensures thread visibility and prevents dead loops in multithreaded programs.
CASJavaMultithreading
0 likes · 6 min read


ITPUBJan 7, 2024 · Backend Development
A Redis lock timeout caused users to be blocked for two hours, revealing problems with lock leakage and mis‑release; the article explains the root causes, proper use of SETNX with EXPIRE, and Lua scripts for atomic operations and safe lock deletion.
Distributed LockExpireLua
0 likes · 7 min read

This article explains essential techniques for managing concurrent access and race conditions in PHP, covering mutex locks, semaphores, atomic operations, queue-based processing, database access optimization, and transaction management to improve system reliability and performance.
ConcurrencyMutexPHP
0 likes · 5 min read

This article explains how Java achieves lock‑free concurrency using CAS and volatile for optimistic locking, discusses its advantages and drawbacks such as the ABA problem and contention hotspots, and presents solutions including versioned CAS classes and contention‑reduction techniques provided by the JUC package.
CASConcurrencyJUC
0 likes · 6 min read

This article explains the concept of thread synchronization in Java and provides detailed examples of four implementation methods—using the synchronized keyword, ReentrantLock, atomic variables, and ThreadLocal—along with code snippets and a comparison of their advantages and usage scenarios.
ReentrantLockSynchronizedThreadLocal
0 likes · 6 min read

The article explains Go’s concurrency model, detailing how goroutines are lightweight work units scheduled by the Go runtime onto logical processors, the role of the scheduler, differences between concurrency and parallelism, thread limits, and practical synchronization tools such as WaitGroup, atomic operations, and mutexes.
GoMutexSynchronization
0 likes · 19 min read

Lock‑free (non‑blocking) algorithms replace traditional locks with hardware primitives such as compare‑and‑swap (CAS) to ensure data consistency during concurrent access, offering superior scalability and eliminating deadlocks, and the article explains Java’s atomic variables, CAS‑based implementations, and how to address the ABA problem with AtomicStampedReference.
ABACASConcurrency
0 likes · 5 min read

This article explains how Redis introduced Lua scripting to combine multiple commands atomically, covers Lua basics, data types, control structures, script execution with EVAL/EVALSHA, script management commands, and practical tips for writing efficient, safe Redis Lua scripts.
CacheLuaRedis
0 likes · 14 min read

This article explains how the volatile keyword ensures visibility of shared variables across threads, illustrates its behavior with examples and code, discusses its limitations regarding atomicity, and presents solutions using synchronized blocks or atomic classes for proper thread synchronization in Java.
ConcurrencyJavaSynchronization
0 likes · 8 min read

This article explains how the volatile keyword guarantees visibility of shared variables across threads, demonstrates its limitations with non‑atomic operations, and shows how to achieve proper thread synchronization using atomic classes or synchronized blocks in Java.
Javaatomicthread visibility
0 likes · 10 min read

Because PHP lacks native multithreading, Swoole adopts a multi‑process model and provides the Atomic class for lock‑free integer operations, which can be shared across worker processes; this guide explains its purpose, configuration, usage patterns, code examples, and important pitfalls.
BackendConcurrencyPHP
0 likes · 3 min read

This article explains the Compare‑and‑Swap (CAS) mechanism, its hardware‑level implementation via Java’s Unsafe class, provides sample code for basic CAS, atomic adders, custom atomic types, analyzes the ABA problem, and presents solutions such as versioned stamps and AtomicStampedReference.
CASJavaUnsafe
0 likes · 10 min read

The article explains the concepts of pessimistic and optimistic locking, details how CAS (Compare‑And‑Swap) implements optimistic locks in Java, discusses their advantages, drawbacks such as the ABA problem and high spin costs, and compares CAS usage with synchronized blocks in concurrent programming.
CASJava ConcurrencyOptimistic Lock
0 likes · 14 min read

This article explains what a non‑reentrant function is, why it matters in concurrent Go programs, and demonstrates two practical implementations—using a sync.Mutex and an atomic flag—to ensure a function runs only once at any given time.
ConcurrencyGoMutex
0 likes · 5 min read

This article walks through Java's concurrency fundamentals, covering the Java Memory Model, thread communication, atomic classes, synchronization techniques, safe object publication, and practical thread‑pool usage, while highlighting common pitfalls and performance considerations.
JMMJavaThreadPool
0 likes · 25 min read

This article explains how lock-free techniques such as Compare-And-Swap (CAS) and Java's atomic classes—including AtomicBoolean, AtomicInteger, AtomicReference, and their array and field updaters—provide optimistic concurrency control, reduce context switches, and improve performance compared to traditional locking mechanisms.
CASConcurrencyJava
0 likes · 11 min read
