5 ms·
> how can we provide a mutual exclusion mechanism on the bare hardware? This is a bit misleading. It's easier to provide mutual exclusion on bare hardware than
by greatfilter251 3y ago
> how can we provide a mutual exclusion mechanism on the bare hardware?
This is a bit misleading. It's easier to provide mutual exclusion on bare hardware than in an OS; just do a spinlock, except with modern ISAs the core doesn't even spin.
Presumably core doesn't offer this because it's a massive footgun for devs new to multithreading who would not understand why this is unacceptable to use in an OS-hosted process.
- tialaramex 3y ago> with modern ISAs the core doesn't even spin. Although tricks like PAUSE are much cheaper than a naive spinlock, they are still spinning as I understand it, just not as frantically because that's pointless and wasteful.
- dataangel 3y agoIt's even simpler than that, PAUSE just prevents the CPU from trying to speculatively execute across iterations.
- greatfilter251 3y agoI'm not familiar with a pause instruction in a modern isa. Sounds like x86 crap. I'm talking about wfi, wfe, and friends.