Month: September 2012

Post navigation

Win A free copy of the ‘Visual Studio 2010 Best Practices’, just by commenting! We’re giving away two ebook editions of Visual Studio 2010 Best Practices. All you have to do to win is comment on why you think you should win a copy of the book. I’ll pick a winner from the most creative answers in two weeks. (function() { var po = document.createElement(‘script’); po.type = ‘text/javascript’; po.async = true; po.src = ‘https://apis.google.com/js/plusone.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(po, s); })();

Now that we’ve seen how a singular x86-x64 focus might affect how we can synchronize atomic invariants, let’s look at non-atomic invariants. While an atomic invariant really doesn’t need much in the way of guarding, non-atomic invariants often do. The rules by which the invariant is correct are often much more complex. Ensuring an atomic invariant like int, for example is pretty easy: you can’t set it to an invalid value, you just need to make sure the value is visible. Non-atomic invariants involve data that can’t natively be modified atomically. The typical case is more than one variable, but … Continue reading Thread synchronization of non-atomic invariants in .NET 4.5

In Thread synchronization of atomic invariants in .NET 4.5 I’m presenting my observations of what the compiler does in very narrow context of only on Intel x86 and Intel x64 with a particular version of .NET. You can install SDKs that give you access to compilers to other processors. For example, if you write something for Windows Phone or Windows Store, you’ll get compilers for other processors (e.g. ARM) with memory models looser than x86 and x64. That post was only observations in the context of x86 and x64. I believe more knowledge is always better; but you have to … Continue reading Thread synchronization of atomic invariants in .NET 4.5 clarifications

I’ve written before about multi-threaded programming in .NET (C#). Spinning up threads and executing code on another thread isn’t really the hard part. The hard part is synchronization of data between threads. Most of what I’ve written about is from a processor agnostic point of view. It’s written from the historical point of view: that .NET supports many processors with varying memory models. The stance has generally been that you’re programming for the .NET memory model and not a particular processor memory model. But, that’s no longer entirely true. In 2010 Microsoft basically dropped support for Itanium in both Windows … Continue reading Thread synchronization of atomic invariants in .NET 4.5