Sign In
Parallel Programming with .NET
All about System.Threading, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more...
Tags
.NET 4
.NET 4.5
Article Summary
Async
C++
Cancellation
Code Samples
Coordination Data Structures
Dataflow
Debugging
F#
FAQ
Feedback Requested
Media
Message Passing
MSDN
New Feature?
Parallel Extensions
ParallelExtensionsExtras
Parallelism Blockers
PLINQ
Release
Silverlight
Talks
Task Parallel Library
Testing
ThreadPool
Tools
Visual Studio 2010
Browse by Tags
MSDN Blogs
>
Parallel Programming with .NET
>
All Tags
>
task parallel library
Tagged Content List
Blog Post:
Building Async Coordination Primitives, Part 7: AsyncReaderWriterLock
Stephen Toub - MSFT
In my last past, we looked at building an AsyncLock in terms of an AsyncSemaphore . In this post, we’ll build a more advanced construct, an asynchronous reader/writer lock. An asynchronous reader/writer lock is more complicated than any of the previous coordination primitives we’ve created. ...
on
12 Feb 2012
Blog Post:
Building Async Coordination Primitives, Part 6: AsyncLock
Stephen Toub - MSFT
Last time, we looked at building an AsyncSemaphore . Here, we’ll look at building support for an async mutual exclusion mechanism that supports scoping via ‘using’. As mentioned in the previous post, semaphores are great for throttling and resource management. You can give a semaphore an...
on
12 Feb 2012
Blog Post:
Building Async Coordination Primitives, Part 5: AsyncSemaphore
Stephen Toub - MSFT
In my last few posts, I covered building an AsyncManualResetEvent , an AsyncAutoResetEvent , an AsyncCountdownEvent , and an AsyncBarrier . In this post, I’ll cover building an AsyncSemaphore class. Semaphores have a wide range of applicability. They’re great for throttling, for protected...
on
12 Feb 2012
Blog Post:
Building Async Coordination Primitives, Part 4: AsyncBarrier
Stephen Toub - MSFT
Last time, we looked at building an AsyncCountdownEvent . At the end of the post, I highlighted a common pattern for using such a type, which is for all of the participants to signal and then wait for all of the other participants to signal as well. This kind of synchronization is typically...
on
11 Feb 2012
Blog Post:
Building Async Coordination Primitives, Part 3: AsyncCountdownEvent
Stephen Toub - MSFT
In my last two posts, I discussed building AsyncManualResetEvent and AsyncAutoResetEvent coordination primitives. In this post, I’ll build on that to create a simple AsyncCountdownEvent. A countdown event is an event that will allow waiters to complete after receiving a particular number of signals...
on
11 Feb 2012
Blog Post:
Building Async Coordination Primitives, Part 2: AsyncAutoResetEvent
Stephen Toub - MSFT
In my last post, I discussed building an asynchronous version of a manual-reset event . This time, we’ll build an asynchronous version of an auto-reset event. A manual-reset event is transitioned to the signaled state when requested to do so (i.e. calling Set()), and then it remains in that state...
on
11 Feb 2012
Blog Post:
Building Async Coordination Primitives, Part 1: AsyncManualResetEvent
Stephen Toub - MSFT
The Task-based Async Pattern (TAP) isn’t just about asynchronous operations that you initiate and then asynchronously wait for to complete. More generally, tasks can be used to represent all sorts of happenings, enabling you to await for any matter of condition to occur. We can even use Tasks...
on
11 Feb 2012
Blog Post:
Potential pitfalls to avoid when passing around async lambdas
Stephen Toub - MSFT
One of the really useful capabilities of the new async methods feature in C# and Visual Basic is the ability to write async lambdas and anonymous methods (from here on in this post, I’ll refer to both of these as async lambdas, since the discussion applies equally to both). This allows you to easily...
on
8 Feb 2012
Blog Post:
When “ExecuteSynchronously” doesn’t execute synchronously
Stephen Toub - MSFT
When creating a task continuation with ContinueWith, developers have the opportunity to provide a TaskContinuationOptions enum value, which could include the TaskContinuationOptions.ExecuteSynchronously flag. ExecuteSynchronously is a request for an optimization to run the continuation task on...
on
7 Feb 2012
Blog Post:
FromAsync(asyncResult, …) vs FromAsync(beginMethod, …)
Stephen Toub - MSFT
The Task Parallel Library (TPL) provides a set of “ FromAsync ” helper methods that create a Task or a Task<TResult> to represent an invocation of an APM method pair, i.e. BeginXx / EndXx. There are, however, two different flavors among these overloads: ones that accept an IAsyncResult “asyncResult...
on
6 Feb 2012
Blog Post:
Await, SynchronizationContext, and Console Apps: Part 2
Stephen Toub - MSFT
Yesterday, I blogged about how you can implement a custom SynchronizationContext in order to pump the continuations used by async methods so that they may be processed on a single, dedicated thread. I also highlighted that this is basically what UI frameworks like Windows Forms and Windows Presentation...
on
21 Jan 2012
Blog Post:
Implementing a SynchronizationContext.SendAsync method
Stephen Toub - MSFT
I recently saw two unrelated questions, the answers to which combine to form a potentially useful code snippet. The first question was about SynchronizationContext. SynchronizationContext provides a Post method, which asynchronously schedules the supplied delegate and object state to be executed according...
on
20 Jan 2012
Blog Post:
Await, SynchronizationContext, and Console Apps
Stephen Toub - MSFT
When I discuss the new async language features of C# and Visual Basic, one of the attributes I ascribe to the await keyword is that it “tries to bring you back to where you were.” For example, if you use await on the UI thread of your WPF application, the code that comes after the await completes...
on
20 Jan 2012
Blog Post:
FAQ on Task.Start
Stephen Toub - MSFT
Recently I’ve heard a number of folks asking about Task.Start, when and when not to use it, how it behaves,and so forth. I thought I’d answer some of those questions here in an attempt to clarify and put to rest any misconceptions about what it is and what it does. 1. Question: When can I use Task...
on
14 Jan 2012
Blog Post:
Awaiting Socket Operations
Stephen Toub - MSFT
The System.Net.Sockets.Socket class in .NET exposes multiple sets of asynchronous methods that perform the same basic operations but that are exposed with different patterns. The first set follows the APM pattern, where for a synchronous method like Receive, the BeginReceive and EndReceive methods...
on
15 Dec 2011
Blog Post:
Paper :: TPL Performance Improvements in .NET 4.5
Danny Shih
We invested a lot of time into making parallel programming “just faster” for .NET 4.5. You’ve already seen some neat tricks to ConcurrentDictionary . There’s a lot more to say about improving the performance of the Task Parallel Library, and Joe Hoag has a written an excellent paper on the...
on
10 Nov 2011
Blog Post:
Crafting a Task.TimeoutAfter Method
Joe Hoag
Imagine that you have a Task handed to you by a third party, and that you would like to force this Task to complete within a specified time period. However, you cannot alter the “natural” completion path and completion state of the Task, as that may cause problems with other consumers of the Task. So...
on
10 Nov 2011
Blog Post:
Updated Async CTP
Stephen Toub - MSFT
In April, we released the Async CTP Refresh, and since then we've seen fantastic adoption of the technology. We've also seen the technology landscape evolve. Windows Phone 7.5, aka "Mango", was released. Silverlight 5 has had both a Beta and an RC release. And there have been multiple patches to Visual...
on
1 Nov 2011
Blog Post:
When at last you await
Stephen Toub - MSFT
When you start using async methods heavily, you’ll likely see a particular pattern of composition pop up from time to time. Its structure is typically either of the form: async Task FooAsync() { … // some initialization code without awaits await BarAsync...
on
24 Oct 2011
Blog Post:
Task.Run vs Task.Factory.StartNew
Stephen Toub - MSFT
In .NET 4, Task.Factory.StartNew was the primary method for scheduling a new task. Many overloads provided for a highly configurable mechanism, enabling setting options, passing in arbitrary state, enabling cancellation, and even controlling scheduling behaviors. The flip side of all of this...
on
24 Oct 2011
Blog Post:
Keeping Async Methods Alive
Stephen Toub - MSFT
Consider a type that will print out a message when it’s finalized, and that has a Dispose method which will suppress finalization: class DisplayOnFinalize : IDisposable { public void Dispose() { GC.SuppressFinalize(this); } ~DisplayOnFinalize() { Console.WriteLine(“Finalized”...
on
2 Oct 2011
Blog Post:
Don’t Forget To Complete Your Tasks
Stephen Toub - MSFT
“Don’t forget to complete your tasks.” That guidance may sound trivial and silly, but I recently saw it as a source of a bug in software written by some very smart folks, and thus thought this would be a good opportunity to remind folks of the imperative. Tasks represent a promise...
on
2 Oct 2011
Blog Post:
Task Exception Handling in .NET 4.5
Stephen Toub - MSFT
For the .NET Framework 4.5 Developer Preview, a lot of work has been done to improve the Task Parallel Library (TPL), in terms of functionality, in terms of performance, and in terms of integration with the rest of the .NET Framework. With all of this work, we’ve strived for a very high compatibility...
on
28 Sep 2011
Blog Post:
Updated TPL Dataflow CTP
Stephen Toub - MSFT
It’s been a few months since April when we last released a Community Technology Preview (CTP) of System.Threading.Tasks.Dataflow.dll, aka “TPL Dataflow”. Today for your programming pleasure, we have another update. As mentioned in “ What’s New for Parallelism in .NET...
on
27 Sep 2011
Blog Post:
What’s New For Parallelism in .NET 4.5
Stephen Toub - MSFT
.NET 4 and Visual Studio 2010 saw the introduction of a wide range of new support for parallelism: the Task Parallel Library (TPL), Parallel LINQ (PLINQ), new synchronization and coordination primitives and collections (e.g. ConcurrentDictionary), an improved ThreadPool for handling parallel workloads...
on
17 Sep 2011
Page 1 of 5 (119 items)
1
2
3
4
5