What does “spurious failure” on AtomicInteger weakCompareAndSet mean?

后端 未结 4 2010
不思量自难忘°
不思量自难忘° 2021-02-05 08:43

The Java AtomicInteger class has a method -

boolean weakCompareAndSet(int expect,int update)

Its documnentation says:

Ma

4条回答
  •  耶瑟儿~
    2021-02-05 09:11

    A good use-case for weakCompareAndSet is performance counters - no need for ordering, high rate of updates (so ordering hurts on weakly ordered systems), but will not drop counts under high loads (tightly contented perf-counters can drop 99% of all counts, essentially leaving the counters' value relative to un-contended counters random).

提交回复
热议问题