Tagged articles
thread synchronization
44 articles · Page 1 of 1
This article explains the key differences between Java's CyclicBarrier and CountDownLatch, focusing on which threads wait, thread lifecycle after signaling, reusability, and a practical pressure-test example using CountDownLatch to simulate concurrent requests.
ConcurrencyCountDownLatchCyclicBarrier
0 likes · 8 min read

This article explains Java's CountDownLatch synchronization tool using a meeting analogy, demonstrates its usage with a Java 17 code example simulating attendees arriving at a meeting, and describes a real-world batch translation scenario where the main thread waits for multiple concurrent translation tasks to complete.
Batch TranslationConcurrency PatternsCountDownLatch
0 likes · 7 min read

This article demystifies Java's happens-before rules, showing why temporal order doesn't guarantee visibility, and how volatile combined with program order ensures a non-volatile variable's visibility across threads through a concrete code example.
ConcurrencyHappens-BeforeJMM
0 likes · 13 min read

This article provides a comprehensive source-code-level analysis of Java's AbstractQueuedSynchronizer (AQS), detailing its three core components—state, CLH wait queue, and ConditionObject—and walking through exclusive lock acquisition/release, fair vs non-fair locking, shared lock propagation, and condition variable await/signal mechanics with code examples.
AQSCLH QueueJava Concurrency
0 likes · 37 min read

This article dives deep into Linux pthread fundamentals, covering process‑vs‑thread concepts, the POSIX API, kernel implementation via the clone syscall, thread lifecycle, synchronization primitives, common pitfalls such as deadlocks, stack overflows and thread leaks, and provides practical debugging and mitigation techniques with real code examples.
LinuxMultithreadingclone syscall
0 likes · 55 min read

This article explains the core principles, API usage, and best‑practice steps for pthread condition variables in embedded Linux, showing why they must be paired with mutexes, how to avoid lost wake‑ups, when to use signal versus broadcast, and includes a complete C example with practical tips.
c-programmingcondition variablepthread
0 likes · 9 min read

This article explains Rust’s std::thread::park/unpark primitives, demonstrates their lost‑wake‑up pitfall, introduces crossbeam’s Parker/Unparker with a token‑based memory feature that eliminates the issue, and provides multiple code examples and usage guidelines for high‑performance thread synchronization.
ConcurrencyCrossbeamParker
0 likes · 17 min read

This article explains what a deadlock is, the four necessary conditions that cause it, demonstrates classic synchronized‑based and Lock‑based deadlock examples in Java, shows how to detect deadlocks with tools such as Arthas, jstack, jvisualvm and JMC, and provides practical strategies—including lock ordering, timeout locks, and two‑phase locking—to break each condition and avoid deadlocks in production code.
ArthasConcurrencyJava
0 likes · 24 min read

Java monitors provide a mechanism for thread synchronization by associating each object with a monitor lock, comprising an entry list, owner thread, and wait set, and the article explains their structure, thread state transitions, and demonstrates usage with a practical code example.
ConcurrencyJavaMultithreading
0 likes · 6 min read

This article explains Java's Exchanger class, detailing its synchronization mechanism, internal source‑code structure, practical usage examples, and how it compares with other concurrency utilities such as CyclicBarrier, Semaphore, and SynchronousQueue.
ConcurrencyExchangerJUC
0 likes · 10 min read

CountDownLatch and CyclicBarrier are two essential Java synchronization tools from java.util.concurrent, enabling threads to coordinate tasks; this guide explains their concepts, usage with code examples, advantages, disadvantages, and key differences, helping developers choose the right tool for thread coordination.
ConcurrencyCountDownLatchCyclicBarrier
0 likes · 10 min read

This article explains the purpose, basic methods, best‑practice usage, and typical scenarios of Java's CountDownLatch utility, providing code examples and a comparison with Thread.sleep to help developers synchronize multiple threads effectively.
CountDownLatchJavaMultithreading
0 likes · 9 min read

This article provides a comprehensive overview of Linux thread synchronization, explaining core concepts such as mutexes, condition variables, semaphores, and futexes, describing their implementation details, code examples, and common usage scenarios like producer‑consumer and reader‑writer problems.
LinuxMutexSemaphore
0 likes · 33 min read

This article explains how to create three Java threads that print the characters A, B, and C in order, first without synchronization, then using Semaphore for ordered output, and finally extending the solution to repeat the ABC sequence twenty times.
ConcurrencyJavaMultithreading
0 likes · 7 min read

This article explains the core concepts of Java's AbstractQueuedSynchronizer, detailing its internal FIFO queue, state management, exclusive and shared modes, and provides complete code examples for custom lock implementation and usage.
AQSAbstractQueuedSynchronizerConcurrency
0 likes · 7 min read

This article explains how to use Java's CyclicBarrier to coordinate three threads that alternately print the characters A, B, and C, providing a detailed analysis, example analogy, complete implementation code, execution result, and a brief summary of its relevance in multithreading interviews.
ConcurrencyCyclicBarrierJava
0 likes · 5 min read

The article explains Java’s concurrency mechanisms, detailing how threads communicate and synchronize via shared memory and the Java Memory Model (JMM), describing atomic actions, the MESI cache protocol, and key principles such as happens‑before, visibility, atomicity, and ordering.
ConcurrencyJMMmemory model
0 likes · 8 min read

This article analyzes a real‑world iOS deadlock caused by priority inversion when a low‑priority thread holds a read‑write lock, explains bounded and unbounded priority inversion, evaluates priority‑ceiling and priority‑inheritance protocols, and demonstrates practical fixes using QoS adjustments, temporary priority boosts, and appropriate lock choices.
LocksPriority InversionQoS
0 likes · 26 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

This article explores the evolution from early mechanical calculators to modern CPUs, explains thread states, synchronization mechanisms, memory barriers, volatile semantics, and JVM lock implementations, and reveals why Java's notify method consistently awakens a specific waiting thread.
CASCPU architectureJVM Internals
0 likes · 39 min read

This article explores the inner workings of Java’s CountDownLatch from JDK 1.8, detailing its core concepts such as the counter, thread synchronization, shared mode, and AQS mechanisms, and demonstrates practical usage through step‑by‑step code analysis and examples.
AQSConcurrencyCountDownLatch
0 likes · 5 min read

An overview of Java’s three primary thread‑synchronization tools—CountDownLatch, CyclicBarrier, and Phaser—explaining their placement in java.util.concurrent, typical use‑cases such as coordinating multi‑threaded tasks in performance testing, and the advantages of each, complemented by illustrative diagrams.
ConcurrencyCountDownLatchCyclicBarrier
0 likes · 7 min read


ITPUBDec 23, 2021 · Fundamentals
The article provides a comprehensive overview of deadlocks, explaining what they are, the resources and ordering issues that cause them, the four necessary conditions, and detailed prevention, detection, and recovery techniques including lock ordering, timeout strategies, and the banker’s algorithm.
ConcurrencyJavaresource allocation
0 likes · 11 min read


政采云技术Oct 22, 2021 · Fundamentals
This article explains three Java concurrency tools - CountDownLatch, CyclicBarrier, and Semaphore - detailing their mechanisms, source code analysis, and practical usage scenarios with code examples.
AQSCountDownLatchCyclicBarrier
0 likes · 13 min read

CountDownLatch is a one‑time synchronization aid that blocks threads until a set of operations complete, illustrated with usage scenarios, a TestHarness example, and a deep dive into its internal implementation using AbstractQueuedSynchronizer, including code snippets and a flow diagram.
AQSConcurrencyCountDownLatch
0 likes · 10 min read

This article analyzes the underlying implementations of Java's synchronized and Lock mechanisms, comparing their differences and exploring the role of AbstractQueuedSynchronizer (AQS) in Lock's functionality.
AQSJava ConcurrencyJava Programming
0 likes · 13 min read

This article introduces Java's Semaphore as a thread‑synchronization tool, explains its flow‑control use cases such as database connections and parking lots, provides a complete parking‑lot simulation code sample, and analyzes the underlying AQS‑based implementation including fairness, acquire/release mechanics, and auxiliary methods.
AQSConcurrencyJava
0 likes · 13 min read


JavaEdgeApr 29, 2021 · Interview Experience
This article explains the semaphore model, its three core operations (init, down, up), how they manage counters and waiting queues, and demonstrates proper usage in Java to achieve mutual exclusion and resource limiting, complete with code examples and visual diagrams.
InterviewJavaSemaphore
0 likes · 6 min read

This article presents various Java solutions for common interview multithreading problems that require sequential printing, demonstrating implementations using Lock, wait/notify, Condition, Semaphore, and LockSupport, along with detailed code examples and explanations of thread communication mechanisms.
ConcurrencyJavaLock
0 likes · 15 min read

This article breaks down the inner workings of Java’s ReentrantLock, explaining spin locks, the role of AbstractQueuedSynchronizer, fair vs. non‑fair locking, and step‑by‑step thread execution with code examples and diagrams to illustrate the complete lock acquisition and release process.
AQSConcurrencyJava
0 likes · 17 min read

This article explains Java’s CyclicBarrier synchronization barrier introduced in JDK 1.5, detailing its constructors, key methods such as await() and reset(), usage patterns for coordinating multiple threads in performance testing, and provides a complete demo with code examples and practical tips for handling timeouts and exceptions.
ConcurrencyCyclicBarrierJDK1.5
0 likes · 7 min read

This article explains why Java introduced the Lock API after Java 1.5, compares it with synchronized, details the explicit lock features, walks through the AQS (AbstractQueuedSynchronizer) implementation, and shows how ReentrantLock, fairness, reentrancy, and conditions are built on top of AQS.
AQSConcurrencyJava
0 likes · 36 min read

This article explores eight Java concurrency techniques—including join, main‑thread join, wait/notify, thread pools, Condition, CountDownLatch, CyclicBarrier, and Semaphore—to achieve sequential thread execution, complete with code examples and sample outputs for each method.
ConcurrencyJavaSemaphore
0 likes · 22 min read

The article explains Java’s various lock mechanisms—including optimistic vs. pessimistic, spin and adaptive spin, no‑lock through heavyweight states, fair vs. unfair, reentrant vs. non‑reentrant, and exclusive vs. shared locks—using JDK 8 source code and practical examples to guide developers in choosing the appropriate lock for different concurrency scenarios.
CASConcurrencyJava
0 likes · 26 min read

This article explains the purpose, differences, internal structure, and core methods of Java's CountDownLatch, shows how it leverages AQS for shared lock semantics, and provides a complete example demonstrating its usage in a thread‑synchronization scenario.
AQSConcurrencyCountDownLatch
0 likes · 8 min read

This article explains the concept and internal design of Java's Semaphore, shows how to create fair or non‑fair instances, details the acquire and release operations, compares fairness strategies, and provides a complete parking‑lot example with runnable code and output.
AQSConcurrencyFair vs Nonfair
0 likes · 8 min read

This article explains Java’s CyclicBarrier synchronization aid, detailing its purpose, constructors, the await() workflow, internal implementation with ReentrantLock and Condition, generation handling, error scenarios, timeout support, and provides a complete multithreaded example illustrating its practical use.
ConcurrencyCyclicBarrierJava
0 likes · 10 min read


ITPUBJun 19, 2018 · Fundamentals
This article explains what a Linux process is, how the kernel schedules multiple processes, the nature and dangers of zombie processes, techniques to prevent them, and the fundamentals of multithreading, including thread creation, scheduling, priorities, and synchronization issues.
LinuxProcess Managementoperating system
0 likes · 14 min read

The article explains why Java concurrency is essential, outlines its risks, and details how thread communication and synchronization work, covering the Java Memory Model, the roles of volatile and synchronized for visibility and ordering, and illustrating these concepts with code examples.
ConcurrencyHappen-BeforeJMM
0 likes · 16 min read

This article explains various iOS thread synchronization tools—including NSLock, NSRecursiveLock, NSConditionLock, NSCondition, @synchronized, dispatch_semaphore, pthread_mutex, and the deprecated OSSpinLock—detailing their internal implementations, usage patterns, code examples, and performance considerations for developers seeking safe concurrent programming on Apple platforms.
ConcurrencyLocksNSLock
0 likes · 22 min read

This article explains how Java's Lock interface and its ReentrantLock implementation provide flexible thread synchronization, inter‑thread communication via Condition objects, and the distinction between fair and non‑fair locking, complemented by illustrative code screenshots.
ConcurrencyConditionJava
0 likes · 7 min read

This article explains the classic producer‑consumer problem in Java, demonstrates initial implementations using wait/notify with a single producer and consumer, analyzes issues that arise with multiple threads, and presents step‑by‑step code refinements—including while‑loops and notifyAll—to achieve correct multithreaded synchronization.
Producer-ConsumernotifyAllthread synchronization
0 likes · 9 min read

This article explains the internal workings of Java's Object.wait() and notify() methods, detailing how synchronized blocks, monitorenter/monitorexit instructions, the HotSpot ObjectMonitor, wait sets, and entry lists cooperate to manage thread coordination and lock ownership in multithreaded environments.
ConcurrencyHotSpotJVM
0 likes · 10 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
