opensubscriber
   Find in this group all groups
 
Unknown more information…

d : dotnet-cx@discuss.develop.com 14 December 2007 • 1:36PM -0500

Re: Native version of VolatileRead and VolatileWrite
by Peter Ritchie

REPLY TO AUTHOR
 
REPLY TO GROUP




That's sscli, not the .NET BCL.  I think they have different memory models.

My guess is the MemoryBarrier was placed between "int ret = address"
and "return ret" to ensure the two instructions aren't reordered with
respect to each other.

One problem I see with that is that the read from "address" may not see
writes from other threads.

As Vance Morrision describes the .NET 2.0 memory model [1] "reads can only
move earlier in time, but never past a write", and "a write cannot move
past a read from the same thread to the same location"; it seems, at least
in .NET 2.0, there could be no reordering with respect to each other.

[1] http://msdn.microsoft.com/msdnmag/issues/05/10/MemoryModels/#S5

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.