[concurrency-interest] Concurrent Read/Write without Synchronization

Mark Thornton mthornton at optrak.co.uk
Sat Dec 18 12:18:05 EST 2010


On 18/12/2010 04:12, Insane Membrane wrote:
> There seems to be confusing descriptions on what volatiles are used 
> for.  I work in both .Net and Java, and for the most part the 
> differences around this type of thing have been small.  My 
> understanding was .net had the same approach - a write is atomic but
I believe the memory model used in .NET is stronger than required by Java.

http://msdn.microsoft.com/en-us/magazine/cc163715.aspx

"Another memory model was needed, and the result is the .NET Framework 
2.0 runtime memory model. The rules for this model are:

   1. All the rules that are contained in the ECMA model, in particular
      the three fundamental memory model rules as well as the ECMA rules
      for volatile.
   2. Reads and writes cannot be introduced.
   3. A read can only be removed if it is adjacent to another read to
      the same location from the same thread. A write can only be
      removed if it is adjacent to another write to the same location
      from the same thread. Rule 5 can be used to make reads or writes
      adjacent before applying this rule.
   4. Writes cannot move past other writes from the same thread.
   5. Reads can only move earlier in time, but never past a write to the
      same memory location from the same thread."

Another reference:
http://blogs.msdn.com/b/jaredpar/archive/2008/01/17/clr-memory-model.aspx

Mark Thornton



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20101218/02be480a/attachment.html>


More information about the Concurrency-interest mailing list