[concurrency-interest] High performance clock/counter

Doug Lea dl at cs.oswego.edu
Sat Apr 24 07:21:05 EDT 2010


On 04/23/10 18:10, Peter Veentjer wrote:

> I'm looking for a high performance counter to be used inside an STM.
>

We've considered putting some counter-based classes
in j.u.c., but supporting the range of needs and tradeoffs
doesn't seem amenable to a small set of solutions.
Among the possibilities:

* If you are willing to live with approximate results
on reads, then striping can work well (as in Cliff Click's
high-scale lib -- http://sourceforge.net/projects/high-scale-lib/)

* For accurate reads, See Herlihy & Shavit's book for discussion
of tree-based  counters and counting networks, that entail a fair
amount of overhead.

* If you only need to detect special properties/values
(non-zero in particular) see SNZI (Scalable non-zero indicators)
by Mark Moir's group -- http://research.sun.com/scalable/pubs/index.html,
that was developed mainly for STM support.

* For some problems involving contended counters, the
best solutions often entail reducing contention pressure
by engaging in some domain-specific alternative action
when an attempted CAS on a simple variable fails.

-Doug


More information about the Concurrency-interest mailing list