Top "Spinlock" questions

A spinlock is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available.

When should one use a spinlock instead of mutex?

I think both are doing the same job,how do you decide which one to use for synchronization?

synchronization mutex spinlock
What exactly are "spin-locks"?

I always wondered what they are: every time I hear about them, images of futuristic flywheel-like devices go dancing (rolling?) …

spinlock
spin_lock_irqsave vs spin_lock_irq

On an SMP machine we must use spin_lock_irqsave and not spin_lock_irq from interrupt context. Why would …

linux-kernel spinlock
Is my spin lock implementation correct and optimal?

I'm using a spin lock to protect a very small critical section. Contention happens very rarely so a spin lock …

c multithreading concurrency mutual-exclusion spinlock
Difference between Mutex, Semaphore & Spin Locks

I am doing experiments with IPC, especially with Mutex, Semaphore and Spin Lock. What I learnt is Mutex is used …

multithreading ipc mutex semaphore spinlock
How does x86 pause instruction work in spinlock *and* can it be used in other scenarios?

The pause instruction is commonly used in the loop of testing spinlock, when some other thread owns the spinlock, to …

multithreading x86 cpu-architecture instructions spinlock
Spinlocks, How Useful Are They?

How often do you find yourself actually using spinlocks in your code? How common is it to come across a …

c# c++ multithreading locking spinlock
Why spinlocks don't work in uniprocessor (unicore) systems?

I know that spinlocks work with spining, different kernel paths exist and Kernels are preemptive, so why spinlocks don't work …

linux-kernel spinlock
Why disabling interrupts disables kernel preemption and how spin lock disables preemption

I am reading Linux Kernel Development recently, and I have a few questions related to disabling preemption. In the "Interrupt …

linux linux-kernel interrupt spinlock preemption
x86 spinlock using cmpxchg

I'm new to using gcc inline assembly, and was wondering if, on an x86 multi-core machine, a spinlock (without race …

gcc assembly synchronization x86 spinlock