Questions on C/C++ volatile from SC08 Tutorial S08: A Hands-on Introduction to OpenMP
Michael_Wong 120000M1EH Visits (3237)
I must point out that IBM xl C/C++ 10.1 compiler for AIX and Linux both have support for OpenMP 3.0, in addiiton to the compilers mentioned during the tutorial. In fact, this compiler was one of the first to have support for OpenMP 3.0 in the industry since the ratification of the specification in May, 2008.
You can get a trial version from the link above.
There were a few C++ specific questions. During the discussion on OpenMP memory model, one questions involves how volatile in C/C++ is used in multithreaded program.
The C++ 0x Standard will clarify that the volatile keyword continues to have nothing to do with multithreading. It merely indicates that something from the environment may change the value. The role of an atomic variable will be used to indicate that another thread may change the value of this variable. It is possible to say that a variable is an atomic volatile to indicate that something from the environment AND another thread may change the value. The C standard, when it supports concurrency in C1x will likely adapt the same meaning.
So in short, C++ Volatile !=Jave volatile and C++ Volatile!= C++ atomic. During C++0x concurrency deliberations, we discussed at length and felt that there is too much history and presumed meanings involved with volatile. In fact, it may even have different meanings varying from compilers to platforms. So it was felt wiser to leave it alone, allowing implementers to retain whatever meaning they are used to, and adapt a new way of naming truly atomic types.
I hope this helps to answer one of the question regarding the role of volatile.
There was another question about how OpenMP 3.0 changed the role of what constructor (default, copy, assignment) is called by each of the priv