5 ms·
Spinlocks are basically the heroin of parallel programming. So many people are addicted to them in the pursuit of performance but the truth is that in 99% of al
by imtringued 4mo ago
Spinlocks are basically the heroin of parallel programming. So many people are addicted to them in the pursuit of performance but the truth is that in 99% of all cases, they are a terrible idea.
Something people don't get about spinlocks is that you're basically saying you own the entire CPU core. In any other situation where the core is shared by multiple processes, it is inherently illogical to use a spinlock.
- xpct 4mo agoIn my experience, there haven't been many cases where I can't assign a core or multiple of them to spinlocks, if it's in my hot path. That said, I probably wouldn't ship spinlocks in consumer libraries or code I expect to be reused across deployments.