3 ms·
> Replaced the cas spinlock in kernel mutexes with a "parking" lock. Anyone know what a "parking lock" is (and how it works)? I couldn't find anything on the
by tiffanyh 5mo ago
> Replaced the cas spinlock in kernel mutexes with a "parking" lock.
Anyone know what a "parking lock" is (and how it works)?
I couldn't find anything on the man pages about it.
https://man.openbsd.org/OpenBSD-5.5/lock.9 https://man.openbsd.org/OpenBSD-5.5/lock.9
https://man.openbsd.org/OpenBSD-5.9/mutex.9 https://man.openbsd.org/OpenBSD-5.9/mutex.9
- sanxiyn 5mo ago"Parking" lock is a reference to this: https://webkit.org/blog/6161/locking-in-webkit/ https://webkit.org/blog/6161/locking-in-webkit/
- tiffanyh 5mo agoThanks! Wow, this is from 10-years ago.
- packetlost 5mo agoIt's a lock/mutex implementation that puts the blocked thread to sleep, usually via cooperative yielding to the scheduler instead of continuing to perform CAS operations on the lock continuously. Spinlocks have great performance when they're not heavily contended and the locks are held for short periods of time, but if either of those things are true the blocked thread can easily consume an entire CPU core while it's blocked.