17.5. Potential problems
We shall use the simple example of Section 17.3.2 to illustrate the problems that can occur during concurrent execution of composite operations and some approaches to their solution. Suppose:
process P executes transfer (account-A, account-B, £1000)
process Q executes transfer (account-B, account-A, £200)
In more detail:
P: | debit (account-A, £1000); | credit (account-B, £1000) |
Q: | debit (account-B, £200); | credit (account-A, £200 |
Showing more detail of a possible implementation for P (Q is similar):
P: | debit (account-A, £1000);
read the value of account-A check whether the debit can be made (value ≥ £1000), if not give an error response, otherwise write the debited value as the new value of account-A |
P: | credit (account-B, £1000); ... |
Get Operating Systems: Concurrent and Distributed Software Design now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.