Sometimes, Microsoft Gets it Right (The .NET Framework 4)

Parallel Programming are two words which are not nearly used enough by programmers today. I think this is partially due to the fact that most developers are answerable to management types who simply “want to get the job done”. It’s also highly susceptible to deadlocks, race conditions and other problems, which are somewhat more avoidable in traditional single-threaded-apartment model applications. The problem is, that we’ve reached a precipice in CPU architecture where CPUs are scaling out instead of up. In other words, instead of simply working harder and faster, they’re working smarter – executing many simultaneous operations.

The only problem with this is that applications need to be programmed to capitalize on this architecture – and making Multi-threaded applications easier is obviously on Microsoft’s mind with the announcements of features in the upcoming The .NET Framework 4.0.

One of the main the main features I am looking forward to is the Parallel class to easily thread simple loops. This Parallel class represents a significant advancement in simplistically managing loops.  The .Net 4.0 team assures us that “for many common scenarios, it just works, resulting in terrific speedups”.  A similar technique can be used to write parallel loops over iteration spaces of non-integral objects.

Parallel.For(0, N, i=>
  {
    DoWork(i);
  });

There are also overhauls to the ThreadPool class (which was in dire need of serious attention) and the inclusion of “Tasks” – simple generic types which assist developers in creating native IAsyncResult objects: this means that Task can be used as the core of a Begin/End implementation.  They’ve also really thought about these improvments, with easy and clear ways to cancel parallel operations, as well as a number of great ways to handle Exceptions within parallel blocks.

There are of course other advantages to the 4.0 Framework, but it’s the big emphasis on easing MTA (Multi-Threaded Apartment) model application development that’s got me excited.

Enjoy!

2 Replies to “Sometimes, Microsoft Gets it Right (The .NET Framework 4)”

  1. Glad you found your mojo mate! Good post btw… not my gig but very cool… – for those wondering wtf I am on about Ashley and I were talking about blogging inspiration on twitter… nuf said 🙂

  2. Initially, since I didn’t have anything to write about – i was going to do a blog post about not having anything to write about, but it seemed a little self-referential.

    Alas, I decided to read some of my feeds and was reminded of some of the awesomeness that will become .Net 4.0. 😛

Leave a Reply

Your email address will not be published. Required fields are marked *