Showing results for Parallel Extensions - .NET Blog

Jun 19, 2009
Post comments count0
Post likes count1

Tasks and the Event-based Asynchronous Pattern

Stephen Toub - MSFT
Stephen Toub - MSFT

As has been discussed previously, one of the new features in the Task Parallel Library is TaskCompletionSource<TResult>, which enables the creation of a Task<TResult> that represents any other asynchronous operation.  There are a wide variety of sources in the .NET Framework for asynchronous work.  One comes from components th...

.NET Parallel Programming
Jun 13, 2009
Post comments count0
Post likes count0

How PLINQ processes an IEnumerable on multiple cores

Igor Ostrovsky - MSFT
Igor Ostrovsky - MSFT

As Ed Essey explained in Partitioning in PLINQ, partitioning is an important step in PLINQ execution. Partitioning splits up a single input sequence into multiple sequences that can be processed in parallel. This post further explains chunk partitioning, the most general partitioning scheme that works on any IEnumerable<T>.Chunk partitioning ...

.NET Parallel Programming
Jun 6, 2009
Post comments count0
Post likes count0

Achieving Speedups with Small Parallel Loop Bodies

Stephen Toub - MSFT
Stephen Toub - MSFT

The Parallel class represents a significant advancement in parallelizing managed loops.  For many common scenarios, it just works, resulting in terrific speedups.  However, while ideally Parallel.For could be all things to all people, such things rarely work out, and we’ve had to prioritize certain scenarios over others.One area Par...

.NET Parallel Programming
Jun 3, 2009
Post comments count0
Post likes count0

Mechanisms for Creating Tasks

Stephen Toub - MSFT
Stephen Toub - MSFT

The core entity in the Task Parallel Library around which everything else revolves is System.Threading.Tasks.Task.  The most common way of creating a Task will be through the StartNew method on the TaskFactory class, a default instance of which is exposed through a static property on Task, e.g. var t = Task.Factory.StartNew(() => {  &n...

.NET Parallel Programming
Jun 2, 2009
Post comments count2
Post likes count2

The Nature of TaskCompletionSource

Stephen Toub - MSFT
Stephen Toub - MSFT

The Task Parallel Library is centered around the Task class and its derived Task<TResult>. The main purpose of these types is to represent the execution of an asynchronous workload and to provide an object with a means to operate on that workload, whether it be to wait for it, to continue from it, or the like. The primary type of asynchronous...

.NET Parallel Programming
Jun 1, 2009
Post comments count0
Post likes count0

Tasks and Unhandled Exceptions

Stephen Toub - MSFT
Stephen Toub - MSFT

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 threw a...

.NET Parallel Programming
May 29, 2009
Post comments count0
Post likes count1

ParallelOptions.MaxDegreeOfParallelism vs PLINQ’s WithDegreeOfParallelism

Stephen Toub - MSFT
Stephen Toub - MSFT

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 slight n...

.NET Parallel Programming
May 27, 2009
Post comments count0
Post likes count1

Exiting from Parallel Loops Early

Stephen Toub - MSFT
Stephen Toub - MSFT

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.ExceptionsIn ...

.NET Parallel Programming
May 26, 2009
Post comments count0
Post likes count1

Does Parallel.For use one Task per iteration?

Stephen Toub - MSFT
Stephen Toub - MSFT

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 => {   &n...

.NET Parallel Programming
May 22, 2009
Post comments count0
Post likes count0

.NET 4 Cancellation Framework

Mike Liddell
Mike Liddell

A very interesting addition to .NET 4 is a set of new types that specifically assist with building cancellation-aware applications and libraries. The new types enable rich scenarios for convenient and safe cancellation, and help simplify situations that used to be be difficult and error-prone and non-composable. The details of the new types are des...

.NET Parallel Programming