4 ms·
What purpose would locks and concurrent primitives have in a system where running code is not preempted?
by kstenerud 7y ago
What purpose would locks and concurrent primitives have in a system where running code is not preempted?
- trhway 7y agoIn addition to parallel in all senses/levels systems mentioned by the other commenter, another example would be a truely single threaded hardware with cooperative or even sequential multithreading where you'd use locking/etc. to safeguard your memory model invariants against for example compiler, JIT and hardware optimization shenanigans.
- StillBored 7y agoTo guarantee two different threads don't try to simultaneously mutate (or in some cases access) shared resources.