.NET Parallel Programming

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

6th Annual Microsoft Financial Services Developer Conference

We’ll be speaking this week in NYC about Parallel Extensions to the .NET Framework at the Microsoft Financial Services Developer Conference.

“The 2008 Microsoft Financial Services Developer Conference will focus on providing developers and architects in Financial Services a clear roadmap of the Microsoft development platform with a focus on High Performance Computing (HPC).”

Implementing the Asynchronous Programming Model with Future

One of our design goals for the Task Parallel Library is to integrate well into existing asynchronous mechanisms in the .NET Framework.  And one of the most common concurrency-related patterns in the .NET Framework is the Asynchronous Programming Model (APM), which typically manifests as a BeginXx method that kicks off an asynchronous operation and returns an IAsyncResult,

Custom parallel looping constructs

For those of you that have examined the internals of the Task Parallel Library in our December ’07 CTP release, you’ve likely noticed that the methods on the System.Threading.Parallel type are implemented on top of System.Threading.Tasks.Task type, and that they do so taking advantage of Task’s self-replicating functionality. 

Task Parallel Library on Channel 9

Charles from Channel 9 sat down with several of us from the Parallel Computing Platform team to discuss the Task Parallel Library component of Parallel Extensions. A video of the conversation is now available on Channel9: https://channel9.msdn.com/Showpost.aspx?postid=384229. We hope you like it, and as always,

Burton Smith on Channel 9

Burton Smith
is a Technical Fellow at Microsoft and an industry leader in the fields of parallel and high-performance computing.  As part of a new video series we’ve kicked off, the folks at Channel 9 have posted a terrific hour-long interview with Burton about the past,

Interested in parallel computing? We’re hiring!

If you’re reading this post, you most likely have an interest in parallel computing, writing concurrent software, and the like.  Take that interest a step further, and help us make the manycore era a successful reality by coming to work on the Parallel Computing Platform team at Microsoft.

Recursion and Concurrency

When teaching recursion in an introductory computer science course, one of the most common examples used involves a tree data structure.  Trees are useful in this regard as they are simple and recursive in nature, with a tree’s children also being trees,

PLINQ at Seattle Code Camp

In the Seattle area and want to hear more about PLINQ?  Igor Ostrovsky, a developer on the Parallel Extensions team, will be speaking today at the Seattle Code Camp from 3:00-4:15pm.  Check it out!

Parallel Aggregations in PLINQ

Quick Overview of LINQ Aggregations
In order to explain the issues we encounter when parallelizing aggregations in PLINQ, let’s first take a quick look at how aggregations work in LINQ.
Aggregation is an operation that iterates over a sequence of input elements,

Uncategorized

New Task APIs in .NET 4.6

There are several nice API-level enhancements to the Task Parallel Library in .NET 4.6, which you can grab a preview of as part of the Visual Studio 2015 CTP.
Task.From*
.NET 4.5 had a Task.FromResult method.  This method makes it quick and easy to manufacture a new Task for a known result value,

.NET memory allocation profiling and Tasks

The .NET Framework blog published this morning a guest post from yours truly on .NET Memory Allocation Profiling with Visual Studio 2012.  As you’re trying to improve the performance, throughput, and memory usage of code that uses Tasks, the described profiler in Visual Studio can be a valuable tool in your tool belt (of course,

Tasks, Monads, and LINQ

A few years back, Wes Dyer wrote a great post on monads, and more recently, Eric Lippert wrote a terrific blog series exploring monads and C#. In that series, Eric alluded to Task<TResult> several times, so I thought I’d share a few related thoughts on Task<TResult>

“Invoke the method with await”… ugh!

I can be a bit sensitive when it comes to language and how concepts are conveyed.  I think it’s important to be accurate, even if not precise, when describing what something is or how to use it, as otherwise the folks to whom you’re communicating can easily form the wrong mental model for that thing. 

MVP Summit presentation on async

Lucian Wischik and I presented an “async clinic” at the MVP Summit in Bellevue this week.  The async/await keywords in C# and Visual Basic drastically simplify asynchronous programming, but that of course doesn’t mean that using them is without any gotchas: the goal of the discussion was to highlight some of the key areas in which we see developers struggling with asynchronous development and to help provide guidance on avoiding and overcoming those roadblocks. 

Psychic Debugging of Async Methods

These days it’s not uncommon for me to receive an email or read a forum post from someone concerned about a problem they’re experiencing with an async method they’ve written, and they’re seeking help debugging the issue.  Sometimes plenty of information about the bug is conveyed,

Cooperatively pausing async methods

Recently I was writing an app that processed a bunch of files asynchronously.  As with the Windows copy file dialog, I wanted to be able to provide the user with a button that would pause the processing operation.
To achieve that,

C# memory model articles

Igor Ostrovsky is one of the minds behind the parallel programming support in the .NET Framework.  Igor’s recently written a great set of articles for MSDN Magazine to cover “The C# Memory Model in Theory and Practice“.  Part 1 is available now in the December 2012 issue,

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),

How do I cancel non-cancelable async operations?

This is a question I hear relatively frequently:

“I have an async operation that’s not cancelable.  How do I cancel it?”

The construction of the question often makes me chuckle, but I understand and appreciate what’s really being asked.  The developer typically isn’t asking how to cancel the operation itself (if they are asking that,