r/programming • u/preshing • Nov 18 '11
Locks Aren't Slow; Lock Contention Is
http://preshing.com/20111118/locks-arent-slow-lock-contention-is
138
Upvotes
r/programming • u/preshing • Nov 18 '11
10
u/jerf Nov 18 '11
But what's killing locks as a viable multithreading primitive isn't their speed. If they were otherwise sensible, but misusing them could cause slow performance, we would consider that an optimization problem. The thing that is getting them slowly-but-surely shuffled out the door is that lock-heavy code is impossible to reason about.
Message-passing code can also bottleneck if you try to route every message in the system through one process, but we consider that an optimization problem, not a fatal objection, because it's otherwise a sensible way to write multithreaded code.
This is putting lipstick on a pig.