Showing results for ThreadPool - .NET Blog

Apr 13, 2012
Post comments count3
Post likes count6

Should I expose synchronous wrappers for asynchronous methods?

Stephen Toub - MSFT
Stephen Toub - MSFT

In a previous post Should I expose asynchronous wrappers for synchronous methods?, I discussed “async over sync,” the notion of using synchronous functionality asynchronously and the benefits that doing so may or may not yield. The other direction of “sync over async” is also interesting to explore. Avoid Exposing Synchrono...

.NET Parallel Programming
Mar 14, 2012
Post comments count0
Post likes count1

Is it ok to use nested Parallel.For loops?

Stephen Toub - MSFT
Stephen Toub - MSFT

Every now and then, I get this question: “is it ok to use nested Parallel.For loops?” The short answer is “yes.”  As is often the case, the longer answer is, well, longer. Typically when folks ask this question, they’re concerned about one of two things.  First, they’re concerned that each nested loop will assume it “owns the machine” and will thu...

.NET Parallel Programming
Apr 13, 2010
Post comments count0
Post likes count0

ThreadPool performance you can see

Stephen Toub - MSFT
Stephen Toub - MSFT

We've spent a lot of time touting improvements to the .NET Framework in .NET 4 around threading, including core enhancements to the performance of the runtime itself.  Sometimes data is more powerful than words, however, and it's useful to be able to see exactly what kind of difference such improvements can make.  To assist with that, her...

.NET Parallel Programming
Apr 9, 2010
Post comments count0
Post likes count0

ParallelExtensionsExtras Tour – #7 – Additional TaskSchedulers

Stephen Toub - MSFT
Stephen Toub - MSFT

(The full set of ParallelExtensionsExtras Tour posts is available here.)In our last two ParallelExtensionsExtras blog tour posts, we’ve discussed two TaskScheduler implementations in ParallelExtensionsExtras: StaTaskScheduler and ConcurrentExclusiveInterleave.  These are just 2 of more than 10 schedulers in ParallelExtensionsExtras, and ...

.NET Parallel Programming
Nov 21, 2009
Post comments count0
Post likes count0

PDC09 Parallelism Session Videos Now Available

Stephen Toub - MSFT
Stephen Toub - MSFT

Attendees at PDC09 this past week were privy to quite a few sessions on parallel computing.  Now that the videos of these sessions are online, you can view them as well from the comfort of your own home.  Here are some of the key parallelism-related sessions from this past week:Overview  Managed code in Visual Studio 2010 ...

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

Slides from Parallelism Tour

Stephen Toub - MSFT
Stephen Toub - MSFT

Last week, I had the privilege of touring around Tennessee, Kentucky, Ohio, and Michigan, speaking about the new parallel computing support in Visual Studio 2010 and the .NET Framework 4.  Many folks I spoke with were interested in getting a copy of the slide deck I used, so I’ve attached it to this blog post.  Enjoy! Toub_ParallelismTour...

.NET Parallel Programming
Oct 15, 2009
Post comments count0
Post likes count1

Task.Wait and “Inlining”

Stephen Toub - MSFT
Stephen Toub - MSFT

“What does Task.Wait do?” Simple question, right?  At a high-level, yes, the method achieves what its name implies, preventing the current thread from making forward progress past the call to Wait until the target Task has completed, one way or another.  If the Task ran to completion, Wait will return successfully.  If th...

.NET Parallel Programming
Sep 22, 2009
Post comments count0
Post likes count1

TaskScheduler.FromCurrentSynchronizationContext

Stephen Toub - MSFT
Stephen Toub - MSFT

The Task abstractions in .NET 4 run on instances of the TaskScheduler class.  Two implementations of TaskScheduler ship as part of the .NET Framework 4.  The first is the default scheduler, which is integrated with the .NET 4 ThreadPool and takes advantage of its work-stealing queues.  The second is the type of TaskScheduler returned...

.NET Parallel Programming
Jul 7, 2009
Post comments count0
Post likes count0

TaskCreationOptions.PreferFairness

Stephen Toub - MSFT
Stephen Toub - MSFT

One of the ways in which the Task Parallel Library achieves good performance is through “work-stealing”.  Work-stealing is supported in the .NET 4 ThreadPool for access through the Task Parallel Library and its default scheduler.  This manifests as every thread in the ThreadPool having its own queue for work; when that thread ...

.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