Content deleted Content added
→In Java: clarified the global ordering over volatiles |
|||
Line 234:
==In Fortran==
<syntaxhighlight lang="fortran">
integer, volatile :: i ! When not defined volatile the following two lines of code are identical
Line 240:
write(*,*) i*i ! Loads the variable i twice from memory and multiplies those values
</syntaxhighlight>
By always "drilling down" to memory of a VOLATILE, the Fortran compiler is precluded from reordering reads or writes to volatiles. This makes visible to other threads actions done in this thread, and vice versa.<ref>{{cite web
|url=https://software.intel.com/en-us/forums/intel-moderncode-for-parallel-architectures/topic/279191
|title=Volatile and shared array in Fortran |website=Intel.com}}</ref>
Use of VOLATILE reduces and can even prevent optimization.<ref>{{cite web
|url=https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vnbq/index.html
|title=VOLATILE |website=Oracle.com}}</ref>
==References==
|