Skip to content

Commit ea19cad

Browse files
committed
Improve the statement of the impact of ABA problem
1 parent 610df96 commit ea19cad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

concurrency-primer.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,8 @@ \subsection{ABA problem}
941941
Also, the possibility to allocate a job with same address could be higher when using memory pool, meaning that more chances to have ABA problem occurred.
942942
In fact, pre-allocated memory should be used to achieve lock-free since \monobox{malloc} could have mutex involved in multi-threaded environment.
943943

944-
Failure to recognize changed target object through comparison can result in stale information.
944+
Being unable to determine whether the target object has been changed through comparison could result in a false positive when the return value of CAS is true.
945+
Thus, the atomicity provided by CAS is not guaranteed.
945946
The general concept of solving this problem involves adding more information to make different state distinguishable, and then making a decision on whether to act on the old state or retry with the new state.
946947
If acting on the old state is chosen, then safe memory reclamation should be considered as memory may have already been freed by other threads.
947948
More aggressively, one might consider the programming paradigm where each operation on the target object does not have a side effect on modifying it.

0 commit comments

Comments
 (0)