[concurrency-interest] Elements in AtomicReferenceArray and AtomicReference[] both distinct?

davidcholmes at aapt.net.au davidcholmes at aapt.net.au
Wed Aug 1 22:41:59 EDT 2012


There's a huge amount of idle speculation and erroneous reading in  
that thread. "Doug Lea's code" is the BACKPORT implementation of  
j.u.c. The backport is for pre-Java 5 system on which there is no  
direct support for atomic operations - which is what Unsafe provides  
through the VM.

There is NO locking involved in Java 5+ AtomicReferenceArray - atomic  
operations (using hardware level atomic instructions) are done per  
element.

David Holmes

Quoting Raph Frank <raphfrk at gmail.com>:

> I always assumed that elements in an AtomicReferenceArray were
> distinct.  Threads that accessed different elements would not
> interfere.
>
> This thread suggests otherwise, that the protection is at the entire
> array level.
>
> http://www.java-forums.org/threads-synchronization/25324-atomicreferencearray-t-equivalent-array-atomicreference-t.html
>
> Which is correct, do an array of AtomicReferences give better concurrency?
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>






More information about the Concurrency-interest mailing list