When you use regular locks (mutexes, critical sections, etc.), the operating system puts your thread in the WAIT state and interrupts it, scheduling other threads on the same kernel. This results in poor performance if the latency is really short, because your thread must now wait for a lead in order to get the CPU time again.
In addition, kernel objects are not available in all kernel states, for example, in the interrupt handler, when swapping is not available, etc.
Spinlocks do not cause an interrupt, but wait in a loop ("spin") until the other kernel releases the lock. This prevents the thread from losing its quantum and continue as soon as the lock is released. A simple spin-lock mechanism allows the kernel to use it in almost any state.
Therefore, on a single-core computer, spinlocking is simply “disabling interrupts” or “boosting IRQL,” which completely prevents thread scheduling.
Spin locks ultimately allow kernels to avoid "large kernel locks" (the lock obtained when the kernel enters the kernel and is released upon exit) and has granular locking of the kernel primitives, causing better multiprocessing on multi-core machines and therefore higher performance .
EDIT: The question arose: "Does this mean that I should use spinlocks wherever possible?" and I will try to answer him:
As I already mentioned, spin locks are only useful in places where the expected latency is shorter than a quantum (read: milliseconds), and unloading does not make much sense (for example, kernel objects are not available).
If the wait time is unknown or you are in user mode, spinlocks are not effective. You consume 100% of the processor time on the standby kernel by checking if spin lock is available. You prevent other threads from running on this kernel before your quantum expires. This scenario is only possible for short packets at the kernel level and is unlikely for a user mode application.
Here is a SO question regarding this: Spinlocks, how useful are they?