Stephen Toub - MSFT

Partner Software Engineer, .NET

Stephen Toub is a developer on the .NET team at Microsoft.

Post by this author

Tasks and Unhandled Exceptions

Prior to the .NET Framework 2.0, unhandled exceptions were largely ignored by the runtime.  For example, if a work item queued to the ThreadPool threw an exception that went unhandled by that work item, the ThreadPool would eat that exception and continue on its merry way.  Similarly, if a finalizer running on the finalizer thread ...

ParallelOptions.MaxDegreeOfParallelism vs PLINQ’s WithDegreeOfParallelism

We exert a good deal of effort ensuring that the APIs we provide are consistent within Parallel Extensions as well as with the rest of the .NET Framework.  This is from many angles, including behavior and general design, but also naming.  So when there are slight differences in naming, it raises questions.One occurrence of such a ...

Exiting from Parallel Loops Early

Exiting out of loops early is a fairly common pattern, one that doesn’t go away when parallelism is introduced.  To help simplify these use cases, the Parallel.For and Parallel.ForEach methods support several mechanisms for breaking out of loops early, each of which has different behaviors and targets different requirements....

Does Parallel.For use one Task per iteration?

In .NET 4, the new Parallel class provides For, ForEach, and Invoke methods for performing operations in parallel. One mental model that some folks use when thinking about Parallel.For is that it’s equivalent to running one System.Threading.Tasks.Task per iteration, e.g. that a loop like: Parallel.For(0, N, i => {  &...

Samples for Parallel Programming with the .NET Framework 4

Along with the release of the .NET Framework 4 Beta 1, we've just published a slew of samples that demonstrate using Parallel Extensions in a variety of ways.  You can download these from Code Gallery at https://code.msdn.microsoft.com/ParExtSamples.These samples include raytracers, a sudoku game, an image colorization algorithm, solvers ...

.NET 4 MSDN documentation for parallelism

In addition to the Betas of Visual Studio 2010 and the .NET Framework 4 being available for download today, the MSDN documentation for .NET 4 Beta 1 is also available.  This includes quite a bit of useful information about the new parallelism constructs.  Here's a summary of the relevant material, with links: Related to...

.NET 4 Beta 1 is now available, with parallelism!

We’re very excited that the .NET Framework 4 Beta is now available for public download, as .NET 4 has Parallel Extensions built into its core. You can download the Betas for Visual Studio 2010 and .NET Framework 4 at https://msdn.microsoft.com/en-us/netframework/dd582936.aspx.For more information on what’s new in Beta 1 regarding ...

Getting random numbers in a thread-safe way

It’s very common in a parallel application to need random numbers for this or that operation.  For situations where random numbers don’t need to be cryptographically-strong, the System.Random class is typically a fast-enough mechanism for generating values that are good-enough.  However, effectively utilizing Random in a ...

“Session-in-a-box” on Parallel Programming with .NET 4.0

At PDC 2008 and TechEd EMEA 2008, Daniel Moth delivered several hit talks on parallel programming with the .NET Framework 4.0.  The videos of both of those talks are available online, and he’s since created a series of blog posts capturing the content from those sessions in a way that should make it easy for others to re-present the...

Parallelism Videos Galore

It's been a hectic and exciting few weeks, and we on the Parallel Computing Platform team have been having a great time talking with customers all over the world, at the PDC, at TechEd EMEA, at DevConnections, through Channel 9, and more.  A lot of the resulting material is now available online for viewing, so do check it out if you're ...