This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimization of conditional access to globals: thread-unsafe?


Erik Trulsson wrote:

It is also worth noting that just declaring a variable 'volatile' does not
help all that much in making it safer to use in a threded environment if you
have multiple CPUs.  (There is nothing that says that a multi-CPU system has
to have any kind of automatic cache-coherence.)

The first sentence here could be misleading, there are LOTS of systems where there is automatic cache-coherence, and of course the use of 'volatile' on such systems does indeed help. If you are working on a systemn without cache-coherence, you indeed have big problems, but that's rarely the case, most multi-processor computers in common use do guarantee cache coherence.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]