Tagged articles
22 articles
Page 1 of 1
Deepin Linux
Deepin Linux
Apr 23, 2026 · Fundamentals

Master Spinlock: Understand Linux Kernel Synchronization and Avoid Deadlocks

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++ atomicLinux kernelLockdep
0 likes · 36 min read
Master Spinlock: Understand Linux Kernel Synchronization and Avoid Deadlocks
Deepin Linux
Deepin Linux
Oct 17, 2025 · Fundamentals

How Linux Kernel Preemption Keeps Your System Responsive – A Deep Dive

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 schedulingSpinlockTIF_NEED_RESCHED
0 likes · 41 min read
How Linux Kernel Preemption Keeps Your System Responsive – A Deep Dive
Deepin Linux
Deepin Linux
Oct 3, 2025 · Fundamentals

When to Use Mutex vs Spinlock: Performance Guide and Best Practices

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.

CSpinlockmutex
0 likes · 29 min read
When to Use Mutex vs Spinlock: Performance Guide and Best Practices
Deepin Linux
Deepin Linux
Mar 30, 2025 · Fundamentals

Understanding Linux Kernel Synchronization Mechanisms

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.

KernelSpinlockatomic operations
0 likes · 42 min read
Understanding Linux Kernel Synchronization Mechanisms
Tencent Architect
Tencent Architect
Jun 24, 2024 · Operations

Root Cause Analysis of Linux Kernel Hard Lockup on CPU 51

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.

DebuggingKernelLinux
0 likes · 17 min read
Root Cause Analysis of Linux Kernel Hard Lockup on CPU 51
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Dec 29, 2023 · Fundamentals

Overview of Linux Kernel Synchronization Mechanisms: Atomic Operations, Spinlocks, Semaphores, and Mutexes

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 kernelSpinlockSynchronization
0 likes · 13 min read
Overview of Linux Kernel Synchronization Mechanisms: Atomic Operations, Spinlocks, Semaphores, and Mutexes
FunTester
FunTester
Oct 26, 2023 · Fundamentals

Mastering Java Locks: Reentrant, Synchronized, ReadWrite, and Spin Locks Explained

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.

JavaLocksReadWriteLock
0 likes · 17 min read
Mastering Java Locks: Reentrant, Synchronized, ReadWrite, and Spin Locks Explained
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Mar 17, 2023 · Operations

Understanding Synchronization Mechanisms and RCU in the Linux Kernel

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.

Linux kernelRCUSpinlock
0 likes · 26 min read
Understanding Synchronization Mechanisms and RCU in the Linux Kernel
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Nov 11, 2021 · Fundamentals

Understanding and Implementing the CLH Spin Lock in Java

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.

AQSCLHLockJava
0 likes · 17 min read
Understanding and Implementing the CLH Spin Lock in Java
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Aug 14, 2020 · Fundamentals

Linux Kernel Synchronization: Atomics, Spinlocks, Semaphores & Mutexes

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 kernelOperating SystemSpinlock
0 likes · 12 min read
Linux Kernel Synchronization: Atomics, Spinlocks, Semaphores & Mutexes
Liangxu Linux
Liangxu Linux
Aug 12, 2020 · Fundamentals

Why Microkernels Can Beat Monolithic Kernels: A Deep Dive with C Simulations

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.

IPCMonolithic KernelOperating System
0 likes · 19 min read
Why Microkernels Can Beat Monolithic Kernels: A Deep Dive with C Simulations
dbaplus Community
dbaplus Community
May 31, 2020 · Databases

Why Intel’s PAUSE Instruction Slows MySQL on Skylake CPUs and How to Fix It

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 performancePAUSE instructionSpinlock
0 likes · 19 min read
Why Intel’s PAUSE Instruction Slows MySQL on Skylake CPUs and How to Fix It
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 14, 2019 · Backend Development

Common Java Pitfalls and Performance Tips: NullPointerException, Spin Locks, Low Coupling, CPU Monitoring, and Hash Functions

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 MonitoringLow CouplingSpinlock
0 likes · 5 min read
Common Java Pitfalls and Performance Tips: NullPointerException, Spin Locks, Low Coupling, CPU Monitoring, and Hash Functions
Java Captain
Java Captain
Jan 26, 2019 · Fundamentals

Classification and Implementation of Various Java Locks

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
Classification and Implementation of Various Java Locks
ITPUB
ITPUB
Oct 22, 2017 · Fundamentals

Why Can't Interrupt Handlers Sleep? Understanding Linux Kernel Sleep and Wakeup Mechanisms

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 kernelSpinlockinterrupt context
0 likes · 16 min read
Why Can't Interrupt Handlers Sleep? Understanding Linux Kernel Sleep and Wakeup Mechanisms
ITPUB
ITPUB
Aug 12, 2016 · Fundamentals

Why Do Spinlocks Behave Differently on UP vs SMP Linux Kernels?

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 kernelSpinlock
0 likes · 14 min read
Why Do Spinlocks Behave Differently on UP vs SMP Linux Kernels?