[concurrency-interest] Problems understanding "visibility"

David Holmes dholmes at dltech.com.au
Wed Oct 19 14:52:59 EDT 2005


> I'm having problems understanding this word "visibility" that keeps
> getting used.

Unless a write in one thread happens-before a read in another thread, then
the write need never be seen by that other thread. This is the conceptual
model. For simplicity assume a variable is kept in a thread-local-location
and unless two actions in two different threads are ordered by
happens-before, then writes to the variable only affect the thread's local
version of the variable.

Of course real hardware is unlikely to do this (in fact some cache
architectures pretty much guarantee that all writes go to main memory within
a bounded time). But the compiler could use a register to hold the local
value of a variable.

> Is it possible to create a concurrent program that can
> actually tell the difference between acquire/release having only
> ordering constraints, and acquire/release having ordering + visibility
> constraints?

I don't think it makes sense to talk about ordering without visibility as it
is the order in which writes are seen that is at issue.

> Moreover, what concurrent design idioms require visibility
> for correctness?

Pretty much all of them.

David Holmes

More information about the Concurrency-interest mailing list