Subj : Re: double-checked locking in C To : comp.programming.threads From : David Schwartz Date : Fri Jul 08 2005 03:06 am "Laurent Deniau" wrote in message news:daldon$6if$1@sunnews.cern.ch... >> CPUs are allowed to do *ANYTHING* as long as it meets the standard. > If find funny to think that cpus meet software standards or OS standards. > A cpu is not designed for C neither for POSIX. C and POSIX try to support > in their norm most of the hardwares through an abstract machine. No, the C implementation is designed to force the CPU to comply with the standard, and no more. > CPUs are allowed to do anything as long as it does not change the > observable behavior conforming to the assembly instructions semantics. > Nothing to do with any software standards. He means once the C implementation is complete. At that point, the CPU can do whatever it wants, however if it violates the standard, then either the CPU or the C implementation is broken. He is assuming everything else but the CPU has been designed or arranged to conform to the standard. > Compilers and OS are allowed to do anything as long as it does not change > the observable behavior conforming to the standards. Just be careful here. By "observable", it means observable as defined by the standard! For example, the C standard cannot use the word "observable" to mean a value seen by concurrent code on another CPU on an SMP system because the C standard is defined in terms of only a single context of execution. Anything that might happen in a situation like that is outside the scope of the C standard. DS .