April 01, 2003
Memory Consistency & .NET
(a) // Oops - compiler could reorder // writes like this. R = true; for( int i=0; i<n; i++ ) M[i] = ...; (b) // Oops - compiler hoists loop invariant! int t = R; while( t==0 ) continue; for( int i=0; i<n; i++ ) ... = M[i]; Example 2: Compiler that presumes single-thread semantics could transform Example 1 in a way that breaks it. (a) Sender; (b) receiver.
|
|
||||||||||||||||||||||||||||
|
|