Scaling Up with CLR 4.0 ThreadPool and Task Parallel Library (Includes Benchmark)

All replies

  • Thanks for the post. Please be very cautious about using such benchmarks to make decisions or to evaluate whether the ThreadPool or TPL is right for you.  The implementation and architecture of both have changed significantly since previous releases, and it's quite likely that any performance measurements done thus far are no longer valid.  Moreover, in .NET 4.0, the Task Parallel Library uses the new .NET 4.0 ThreadPool as its default scheduler.
    Friday, May 01, 2009 3:52 PM
  • Thanks for the reply Stephen, I will mention this notation in the post.

    The fact that the TPL will eventuallty use the CLR thread pool is very good news,

    Running the benchmark made me realize pretty quickly that the ThreadPool and the TPL using a completely different scheduler and that the performance check is not authentic at all. However, I've waited so long for such technology and the TPL got me so excited so couldn't help it.

    It will be nice to run the benchmark on CLR 4.0 and see the improvements :-)

    Friday, May 01, 2009 4:08 PM
  • Some of the information referenced is now out of date.

    For information, see the changes in Beta 1 of TPL: http://blogs.msdn.com/pfxteam/archive/2009/04/06/9534426.aspx

    For example, this is no longer valid:

    Task task1 = Task.Create(delegate { taskWork(); });

    It has been reworked now to use the new TaskFactory class:

    Task task1 = Task.Factory.StartNew(delegate { taskWork(); });

    Also, I'd be highly suspicious of any benchmarks using the current code.  The RTM version of this will be using the new Task Scheduler based on the changes in the core BCL ThreadPool, and the ThreadPool will be receiving some of the changes relating to work stealing, hill climbing, etc.  Many of these changes aren't in the released versions of TPL or the betas yet.  For more details, see: http://blogs.msdn.com/ericeil/archive/2009/04/23/clr-4-0-threadpool-improvements-part-1.aspx

    Reed Copsey, Jr. - http://reedcopsey.com
    Friday, May 01, 2009 4:11 PM
  • I am suspicious about my benchmark too, and I will point out those notes in my blog,

    I am following the "What’s new" posts at fxteam blog (http://blogs.msdn.com/pfxteam/) and I will try to keep up..

    Best Regards and thanks for reading and commenting,

    Friday, May 01, 2009 4:26 PM