Tagged articles
spinlock
23 articles · Page 1 of 1
The article explains that the PAUSE (F3 90) instruction does far more than save power or yield to hyper‑threads—it controls speculation depth, avoids memory‑ordering penalties on lock release, and its behavior differs on x86 versus ARM, with misuse causing severe performance regressions in spin‑wait loops.
ARMSMTmemory ordering
0 likes · 16 min read

This article explains Linux kernel spinlocks—from basic concepts and atomic operations to memory barriers, busy‑waiting, and proper usage—illustrating common pitfalls like deadlocks, priority inversion, and recursion, and provides practical guidelines, code examples, and debugging tools to help developers implement safe, efficient synchronization.
C++ atomicConcurrencyLinux kernel
0 likes · 36 min read

This article explains why Linux’s kernel preemption mechanism is essential for allocating CPU resources efficiently, compares kernel and user preemption, details the TIF_NEED_RESCHED flag and preempt_count counter, and shows practical C code and real‑world case studies that illustrate how high‑priority tasks can pre‑empt low‑priority work without causing priority inversion.
Linux schedulingPriority InversionTIF_NEED_RESCHED
0 likes · 41 min read

Choosing the right lock—mutex or spinlock—can dramatically affect program performance; this article explains their underlying waiting mechanisms, compares CPU usage, context‑switch costs, and suitability across multi‑core versus single‑core, high‑contention versus low‑contention scenarios, and provides practical C++ code examples.
C++Mutexperformance
0 likes · 29 min read

This article explains how the Linux kernel ensures safe concurrent access to shared resources through various synchronization mechanisms such as atomic operations, spinlocks, mutexes, read‑write locks, and semaphores, illustrating their concepts, APIs, and practical usage with code examples.
atomic-operationskernelspinlock
0 likes · 42 min read

This article explains the design, principles, and C implementations of Linux kernel synchronization primitives—including spinlocks, semaphores, read‑write locks, and mutexes—illustrated with real‑world analogies, code snippets, and usage constraints in interrupt and multi‑CPU contexts.
LinuxMutexSemaphore
0 likes · 22 min read

This article walks through a real Linux kernel hard lockup case, explaining what hard lockup is, analyzing stack traces and register values, identifying a spinlock contention on a per‑CPU runqueue, and showing how an inappropriate GFP flag caused interrupts to be enabled at the wrong time, leading to a deadlock and the eventual fix.
DebuggingLinuxPerf Events
0 likes · 17 min read

The article categorizes Linux kernel synchronization primitives by their target—critical sections, CPUs, memory, or cache—detailing atomic variables, spinlocks, semaphores, mutexes, read‑write locks, preemption, RCU, and memory barriers, explaining their mechanisms, trade‑offs, and typical kernel usage examples.
LinuxLocksSemaphore
0 likes · 15 min read

The article systematically explains Linux kernel synchronization primitives—from basic atomic operations through queued spinlocks, counting semaphores, and sleeping mutexes to read‑write semaphores and per‑CPU variants—detailing their underlying data structures, memory‑barrier semantics, and the fast‑path and slow‑path acquisition and release APIs.
Linux kernelMutexSemaphore
0 likes · 13 min read

This article provides a comprehensive guide to Java locking mechanisms, covering ReentrantLock, synchronized, ReadWriteLock, and spin locks, with detailed code examples, performance considerations, common use cases, and best practices to ensure thread safety, avoid deadlocks, and optimize concurrency in multithreaded applications.
ConcurrencyJavaLocks
0 likes · 17 min read

Linux kernel synchronization requires protecting shared mutable state from concurrent access using primitives such as spinlocks, mutexes, read‑write locks, or lock‑less techniques like RCU, which copies data and waits for a grace period, each offering distinct performance, latency, and complexity trade‑offs.
ConcurrencyLinux kernelMutex
0 likes · 26 min read

This article explains what a spinlock is, outlines its advantages and disadvantages, describes suitable usage scenarios, and provides a detailed Java implementation using CAS, including code examples and an explanation of the underlying CAS algorithm.
CASJavaLock
0 likes · 5 min read

This article provides a detailed analysis of Linux kernel spinlocks, focusing on the evolution from ticket‑based locks to the modern queued spinlock (qspinlock), explaining its code hierarchy, data structures, state machine, and the acquisition/release algorithms with accompanying diagrams.
ConcurrencyLinuxMCS lock
0 likes · 15 min read

This article explains the concepts of spin locks and mutexes, introduces the CLH lock as a fair spin lock used in Java's AbstractQueuedSynchronizer, and provides a detailed step‑by‑step walkthrough of its initialization, lock acquisition, release, testing, and common pitfalls with illustrative code and diagrams.
AQSCLHLockConcurrency
0 likes · 17 min read

This article explains the core synchronization mechanisms used in modern Linux kernels—including atomic operations, spinlocks, semaphores, and mutexes—detailing their definitions, underlying implementations, API usage, performance characteristics, and appropriate usage scenarios across different execution contexts such as process, interrupt, and soft‑interrupt contexts.
Linux kernelMutexSemaphore
0 likes · 12 min read

The article examines the performance drawbacks of traditional monolithic kernels, especially IPC overhead, and argues that microkernel designs using arbitration can reduce lock contention, supported by C code simulations and benchmark graphs that compare execution time, CPU utilization, and scalability across thread and CPU counts.
ConcurrencyIPCMicrokernel
0 likes · 19 min read

This article examines how the increased latency of Intel's PAUSE instruction on Skylake CPUs creates a performance bottleneck for MySQL, details the profiling steps that identified ut_delay as the hotspot, and presents a series of optimizations—including spin‑wait parameter tuning and a MySQL 8.0 patch—that restore throughput on affected hardware.
CPU performanceMySQLPerformance Tuning
0 likes · 19 min read

This article explains typical Java issues such as NullPointerException, demonstrates using spin locks for efficient multithreading, emphasizes low‑coupling design, shows how to diagnose CPU spikes with Linux tools and jstack, and describes why hash functions have O(1) lookup with collision‑resolution strategies.
CPU Monitoringhash functionslow coupling
0 likes · 5 min read

This article explains the different types of Java locks—including fair, reentrant, exclusive, read‑write, optimistic, pessimistic, segment, biased, lightweight, heavyweight, and spin locks—describes their characteristics, usage scenarios, and provides concrete code examples for each implementation.
AQSJavaReentrantLock
0 likes · 15 min read


ITPUBOct 22, 2017 · Fundamentals
This article explains the purpose and mechanics of process sleep in the Linux kernel, detailing how wait queues and wake‑up functions operate, why sleeping in atomic contexts such as interrupt handlers or while holding spinlocks is unsafe, and demonstrates the resulting deadlock with a sample driver.
Linux kernelSleepinterrupt context
0 likes · 16 min read


ITPUBAug 18, 2017 · Fundamentals
The article explains what deadlocks are, compares spinlocks and semaphores, describes typical deadlock scenarios in the Linux kernel, and details the built‑in detection mechanisms such as hung‑task (D‑state) and soft‑lockup (R‑state) along with the NMI watchdog for long interrupt disabling.
LinuxSemaphoredeadlock
0 likes · 14 min read


ITPUBAug 17, 2016 · Fundamentals
This article explains how deadlocks arise in Linux kernels, compares spinlocks and semaphores, and details the kernel's built‑in D‑state, R‑state, and long‑interrupt‑disable detection mechanisms such as hung‑task, soft‑lockup, and NMI watchdog, including key code snippets.
LinuxSemaphoredeadlock
0 likes · 14 min read


ITPUBAug 12, 2016 · Fundamentals
The article explains how Linux spinlocks, originally designed for SMP systems, operate in UP kernels, why CONFIG_DEBUG_SPINLOCK changes their behavior, and which spinlock variants should be used in different interrupt and preemption contexts.
CONFIG_DEBUG_SPINLOCKLinux kernelSynchronization
0 likes · 14 min read
