2 ms·
How would a global lock fix this? Presumably you would have a process that is trying to decrement get a global lock and then crash, and eventually release the
by jedberg 11y ago
How would a global lock fix this? Presumably you would have a process that is trying to decrement get a global lock and then crash, and eventually release the lock anyway, right? So you get the same outcome.
- YZF 11y agoYou can build things like 2 phase locking on top of that. You're right though that simply taking a lock before updating two values doesn't solve the atomicity of that update problem. However if you're updating a single value then taking a lock can make your life easier vs. systems with no locks and eventual consistency.
- jedberg 11y agoYou can make your life as a programmer easier in exchange for making your life as an operator harder. :) Locks are brittle and hurt reliability.