You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: concurrency-primer.tex
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -955,10 +955,10 @@ \subsection{ABA problem}
955
955
In addition to embedding the version number into a pointer, we could consider utilizing an additional 32-bit or 64-bit value next to the target object for the version number.
956
956
It requires the compare-and-swap instruction to be capable of comparing a wider size at once.
957
957
Sometimes, this is referred to as \introduce{double-width compare-and-swap}.
958
-
On x86-64 processors, for atomic instructions that load or store more that a CPU word size, it needs additional hardware support.
959
-
You can use \monobox{grep cx16 /proc/crpuinfo} to check if the processor supports 16-byte compare-and-swap.
958
+
On x86-64 processors, for atomic instructions that load or store more than a CPU word size, it needs additional hardware support.
959
+
You can use \monobox{\$grep cx16 /proc/cpuinfo} to check if the processor supports 16-byte compare-and-swap.
960
960
For hardware that does not support the desired size, software implementations which may have locks involve are used instead as mentioned in \secref{arbitrarily-size}.
961
-
Back to the example, the following code is fixed by using an an version number that increments each time a job is added to the empty queue. On x86-64, add a compiler flag \monobox{-mcx64} to enable 16-byte compare-and-swap in \monobox{worker} function.
961
+
Back to the example, ABA problem in the following code is fixed by using an version number that increments each time a job is added to the empty queue. On x86-64, add a compiler flag \monobox{-mcx64} to enable 16-byte compare-and-swap in \monobox{worker} function.
962
962
963
963
\inputminted{c}{./examples/rmw_example_aba.c}
964
964
@@ -969,7 +969,7 @@ \subsection{ABA problem}
969
969
See \secref{fusing}.
970
970
Another way to prevent ABA problem in the example is using safe memory reclamation mechanisms.
971
971
Different from previously mentioned acting on the old state, the address of a job is not freed until no one is using it.
972
-
This prevents memory allocator or memory pool reuses the address and causing problem.
972
+
This prevents memory allocator or memory pool from reusing the address and causing problem.
973
973
974
974
\section{Sequential consistency on weakly-ordered hardware}
0 commit comments