Ways to Mitigate Concurrency
The underlying problem is multiple processes working on the same resource, so the mitigation methods look at how to limit exposure. Let’s first look at general concepts and then look more specifically at databases, which usually are at the heart of concurrency issues.
Two simple generic methods, resource locks and atomic operations, are generally good enough to use in most situations. Locking deals directly with concurrency by preventing simultaneous process flows. Atomic operations move operations closer to the resources and enforce serialization at the resource level.
Locking the resources so no one else can run them makes sense if the workflow is not supposed to run concurrently. In the withdrawal example, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access