[Mono-list] Need advise on Mono Memory Model
rednaxela0607 at hotmail.com
Thu Oct 4 03:25:09 EDT 2007
I'm still new to this mailing-list and I'm sure someone's asked about similar questions before, but it's hard to find documented materials related to this topic: does the current stable version of Mono (namely 220.127.116.11) conform to the ECMA standard of memory model, which is a weak model, or does it conform to the stronger one as used by MS .Net Framework 2.0 or later? Is it different on various implementations of Mono, such that the ones on IA64 are not using the stronger model?
I'd also like to know, there was a hint that MS is trying to revise the ECMA CLI standard so that a stronger memory gets employed, does anybody know how's that in progress?
Anyway, just to be sure I got the concepts right, please correct me if I got the Mono/CLR memory model wrong:
1. No reorder can happen if there's a MemoryBarrier (as given by Interlocked or Thread.VolatileRead/Write) or volatile variable in between in a method; or if reorder happened, it's invisible to programmers (given that reads and writes cannot move before a volatile read, and reads and writes cannot move after a volatile write)
2. Monitor.Enter has aquire semantics, Monitor.Exit has release semantics, does that mean that before entering a critical section, everything in the thread's own copy of memory (if the memory is cached) gets synchronized with the latest values in the main memory, and after leaving a critical section, all changes done by the current thread will be flushed out to the main memory?
3. Does a volatile read behave just like a Monitor.Enter in terms of having aquire semantics, that everything in the thread's own copy of memory (and not just the volatile variable itself) gets synchronized with the latest values in the main memory, and vice versa?
4. What's the cost of using a volatile variable in comparison to using locks in Mono? Should I expect less overhead with a volatile variable rather than with locks, if all accesses to it must not be reordered?
5. What are the major differences between a Mono/CLR memory model and the Java memory model (after Java 5) that I should care about?Greetings,- RednaxelaFX
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list