[concurrency-interest] dealing with people that questionvisibility problems

David Holmes dcholmes at optusnet.com.au
Wed Feb 21 21:27:44 EST 2007

Gregg Wonderly wrote:
> The issue that I see is that it is more possible to study code for a race
> condition when you see the effects.  These are more readily
> understood.  It is difficult to understand visibility related bugs

It is difficult to uncover the fact that you have a visiblity related bug.
But studying the code if you find a shared mutable variable that is not
volatile and not accessed under synchronization, then you potentially have a
visibility related bug.

Making all variables volatile fixes only pure-visibility bugs and in the
process will totally kill performance by disallowing a slew of
optimizations. My contention is that it is more likely that there is an
atomicity bug as well as a visibility bug, and that volatile won't help fix
it. In fact volatile could further obscure the bug by making it even less
likely to appear in practice, such as during testing. Effective testing of
concurrent programs benefits from the least allowed order, as this makes it
easier to expose races.


More information about the Concurrency-interest mailing list