The cost of a thread-context switch is the reason why spinlocks can be useful. The usual number that's quoted is between 2000 and 10,000 cpu cycles for a switch on Windows. Cost that's associated by having to store and reload the processor state and the stalls due to the guaranteed cache misses. This is pure overhead, nothing useful gets done.
So a program can perform better if it waits for a lock to become available, burning up several thousand cycles and periodically trying to enter the lock. Which avoids the context switch if the lock is expected to becomes available quickly.
There is no timer available to wait for such short durations, it is implemented by actually burning cycles with a small loop. Spinning. This is supported at the processor level, the dedicated PAUSE machine code instruction is available to reduce the power consumed while spinning on Intel/AMD cores. Thread.Yield() and Thread.SpinWait() in .NET take advantage of it.
Actually using a spinlock effectively in code can be tricky, it of course only works well if the odds to acquire the lock are high enough. If they are not then spinlocking is actively harmful since it delays a context switch, one that might be required to get another thread to regain the processor and release the lock. The .NET 4.0 SpinLock class is useful, it generates ETW events for failed spins. Not otherwise well documented.