Just released a screen cast demoing Parallel.For and Parallel.ForEach where we are not demoing the virtues of Parallel Sleep….
Click here to see this and many other Rock Solid Knowledge Screen casts
Andy's observations as he continues to attempt to know all that is .NET...
Just released a screen cast demoing Parallel.For and Parallel.ForEach where we are not demoing the virtues of Parallel Sleep….
Click here to see this and many other Rock Solid Knowledge Screen casts
Just added a screen cast on how to create short and long running tasks in .NET 4. You can get to all the Rock Solid Knowledge screen casts via www.rocksolidknowledge.com/screencasts
Just to say that we will be delivering talks at Software Architect 2009, here is a full list of our sessions.
Been playing around with the new version of Pfx for .NET. I must say Ive been very impressed with the improvements since the last CTP for .NET 3.5. So here goes a series of blogs and screen casts on some on various bits of Pfx for .NET 4 BETA 1.
The one thing that really shouts is that the original Pfx types are no longer something for just fine grained parallelism its is a unification of the various threading API’s. Unifying Api’s is something not new to the .NET framework its been happening since 1.1. As developers its great that whilst the framework is evolving a constant effort is being made to refactor and simplify previous complexity.
So previously If I wanted to create a short running piece of background work I would favour the thread pool, if I was to write a long running piece of background activity I would have to create my own custom thread. Creating a short running thread using the thread pool meant either QueueUserWorkItem or Delegate.BeginInvoke, and a long running via new Thread(), and calling Start.
Now for either types of situation you simply create a new Task using the new Task type, either via the Task Factory ( not a real GOF Factory, but don’t get me started on that ), or via new Task()
Task bgTask = Task.Factory.StartNew( MyShortRunningTask);
For a long running task we use the same API but this time giving it a hint that this is a long running task and shouldn’t therefore use a thread pool thread, but create a new thread outside the thread pool
Task bgTask = Task.Factory.StartNew( MyLongRunningTask, TaskCreationOptions.LongRunning);
So too very similar calls but leaving it up to the framework to decide how best to schedule the work.
Just noticed that I can drag source windows outside the IDE in VS2010, this is something Ive wanted for ages…Now I can really use multiple monitors
I’ve written many articles on my blog about how Im sick of trade show demos of Pfx ( Parallel framework extensions ). You know the ones using simple Parallel.For with Thread.Sleep or Thread.SpinWait as the piece of work. These examples scale wonderfully but the moment people take those simple examples and apply them to their own for loops terrible performance often results. Thankfully the Pfx team have written a blog article offering some suggestions about what to do when the piece of work inside the for loop is too small. ( Blog article ). Interesting this is the first time I’ve seen them utilise the number of processors in the machine to determine the number of tasks, something I’ve advocated many times in the past for tasks of equal cost.
Since C# v3 you have been able to initialise collections leaving a trailing comma…
List<int> vals = new List<int>
{
1,
2,
3,
4,
5,
};
I was asking students in a recent class if they liked it or not…One said that he didn’t like the final comma as he thought it suggested something was missing…My original reason for liking them was that it meant I could easily add to the list. However one student said he liked them as it meant that if you ever did a source control diff on the different versions the diff would only show one line change as opposed to two. I never thought of that…