.NET Parallel Programming

All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…

PLINQ and Int32.MaxValue

In both .NET 4 and .NET 4.5, PLINQ supports enumerables with up to Int32.MaxValue elements.  Beyond that limit, PLINQ will throw an overflow exception.  LINQ to Objects itself has this limitation with certain query operators (such as the indexed Select operator which counts the elements processed), but PLINQ has it with more.This ...

PLINQ Queries That Run in Parallel in .NET 4.5

One interesting thing to know about PLINQ is that not all queries are guaranteed to execute in parallel (See PLINQ Queries That Run Sequentially for reference). You can think of the AsParallel method as a hint to run in parallel for query shapes that it believes will be faster. By default, PLINQ prefers to use a simple sequential algorithm ...

PLINQ’s Ordering Model

In order to execute parallel queries as efficiently as possible, Parallel LINQ (PLINQ) treats ordering as optional. By default, PLINQ considers sequences to be unordered, unless the user explicitly opts into maintaining ordering using either the AsOrdered or the OrderBy operator.Roy Patrick Tan wrote a detailed article that...

Lesser-known Multi-threaded Debugging Support in Visual Studio 2010

We’ve been very excited about the new debugging windows in Visual Studio 2010, namely Parallel Tasks and Parallel Stacks, as well as the newly revamped Threads window, and thus we’ve talked about them quite a bit. For an overview, you can read the MSDN Magazine article at https://msdn.microsoft.com/en-us/magazine/ee410778.aspx, and Daniel ...

ParallelExtensionsExtras Tour – #14 – SingleItemPartitioner

(The full set of ParallelExtensionsExtras Tour posts is available here.) In a previous ParallelExtensionsExtras Tour blog post, we talked about implementing a custom partitioner for BlockingCollection<T>.  Custom partitioning is an advanced but important feature supported by both Parallel.ForEach and PLINQ, as it allows the ...

F# PowerPack supports PLINQ

The F# team has released the F# PowerPack for download on CodePlex, and we're very excited that the PowerPack now has direct support for PLINQ.  From the CodePlex site: F# Parallel LINQ IntegrationFSharp.PowerPack.Parallel.dll provides an F#-style API for parallel operations on sequences that are part of .NET 4.0 as System.Linq....