Concept: what is the ABA problem?
Suppose you have A Shared variable has A value of A, thread 1 at this time to modify the variables, at the time of thread 1, thread 2 has the variable change into B, then thread and the variable changes became A, when the thread one modified according to the expected value of the old and the Shared memory compares the actual value of the result is the same, the thread 1 think variable has not been modified, the thread 1 submitted successfully, but variable has been modified, this time is not A, A, of this is the problem of ABA,
My question:
1, according to the concept of ABA problem, I the pictures on the logic of thinking is correct, if it is correct, then the ABA problem seems to have no defects loopholes, bank the final balance is correct,
The pictures on the 2, if I was wrong, that need to how to understand?
I also saw other bosses related blog, but very hard to understand their figure painting, so I drew this to understand yourself ABA problem scenarios,
CodePudding user response:
Common scenarios, ABA problem won't be any influence, such as your deposit in the bank, but you can save money by the bank to do something, finally only your money return, the process, however, you know, I don't know, you only care about the results did not change,But if there is some specific scenarios, such as