[ImageJ-devel] [fiji-devel] Lock-free bit fields, was Re: What's left to do for ImgLib2

Adrian Daerr adrian.daerr at univ-paris-diderot.fr
Thu Oct 30 13:11:39 CDT 2014


Hi Johannes,

> Thank you for your concerns. Let me take the time for a proper discussion
> rather than just linking to two articles of a highly respected developer.

Sorry my mail was really minimalistic. I had a lot of other stuff to do 
and no time to go into details, but thought even just throwing in these 
pointers might be usefull rather sooner than later.

> Let's recapitulate the Double-Checked Locking problem for a moment: any
> non-synchronized access in Java is *not* guaranteed to have the same
> ordered memory-access as *any* other thread.

The article I point to does seem to make exceptions, which is why I 
hesitated in claiming that the DCL problem applies here as well. On the 
second page of the first article for example, Brian Goetz says

| DCL also works with 32-bit primitive values. If the resource field in
| SomeClass were an integer (but not a long or a double), then
| SomeClass would behave as expected. However, you cannot use this
| behavior to fix the problems with DCL when you want to lazily
| initialize an object reference or more than one primitive value.

I doubt using DCL on array elements are within those lucky cases 
however, even if they were a 32-bit primitive values. I have already 
extended way beyond my competences though, so I'll stop here.

best regards,
Adrian



More information about the ImageJ-devel mailing list