[concurrency-interest] The very best CAS loop
martinrb at google.com
Mon Sep 26 22:31:59 EDT 2016
weak cas should never be slower than strong cas. There's still time to fix
it before jdk9 ships!
Measuring performance in the presence of heavy contention is troublesome.
Optimizing code can make such microbenchmarks slower by increasing
contention. Will this benchmark get better if we change the implementation
to grab a global lock and starve the other thread?
"""A key weakness of the CAS operation, known to both researchers and
practitioners of concurrent programming, is its performance in the presence
of memory contention. When multiple threads concurrently attempt to apply
CAS operations to the same shared variable, typically at most a single
thread will succeed in changing the shared variable’s value and the CAS
operations of all other threads will fail. Moreover, significant
degradation in performance occurs when variables manipulated by CAS become
contention “hot spots”: as failed CAS operations generate coherence traffic
on most architectures, they congest the interconnect and memory devices and
slow down successful CAS operations,"""
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest