Grokking Concurrency MEAP V12 by copyright-2023-manning-publications.html

Grokking Concurrency MEAP V12 by copyright-2023-manning-publications.html

Author:copyright-2023-manning-publications.html
Language: eng
Format: epub


We’ve implemented an ATM as a thread that simply call to deposit method followed by a call to withdraw method with the same amount of money (say $10). And we run 1000 of them concurrently. So the account balance should remain the same as we add and remove the same amount of money – we expect it to be zero at the end of the program, right?

But if we run this code, we often find that the balance at the end of the program is different:

Balance of unsynced account after concurrent transactions: Actual: 380 Expected: 0



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.