Tag: parallelisation
Parallel Loop Anti-pattern
Here’s a quick parallel loop anti-pattern. In other words, don’t do this, it will only make you miserable. If you want to start tasks in a loop watch out for...
Task status state changes
Over the course of the last couple of months I’ve blogged a lot about the Task Parallel Library and mentioned a number of statuses that a task can have, but...
Cancelling parallel tasks
UPDATE (7-June-2011): The post as it originally appeared had a bug in the code, the catch block in the task caught the wrong exception type. See the Gotcha...
Building messages in parallel
I recently saw some code where the developer was attempting to build up messages inside tasks that were being reported outside of the task. In a sequential...
Parallel Tasks and the HttpContext
A few days ago I spotted a question on StackOverflow by someone trying to use a parallel loop in an ASP.NET application. It may have been an ASP.NET MVC...
Handling AggregateExceptions
I’ve written a couple of posts ( see also ) about how the AggregateException plays its part in exception handling in parallel systems. However, it has another...
Tasks that throw exceptions
I’ve blogged before about the AggregateException in .NET 4, but I missed out something that may be important. If you are using Parallel.Invoke or Parallel.For...
Feedback from my DDD Scotland Talk on Parallisation
I got my feedback from my DDD Scotland 2011 talk on Parallelisation . I was actually pleasantly surprised. I guess I was being a little too self critical and...
Background tasks and application exit
During my talk on Parallelisation at DDD Scotland 2011 I was asked what happens if the application finishes while there were still tasks running. At the time,...
Parallelisation Talk Example - Aggregate Exceptions
The two code examples here show what happens when exceptions are thrown within tasks that are not handled within the task. In each case the task that has the...
Parallelisation Talk Example – ConcurrentBag
This example shows a ConcurrentBag being populated and it being accessed while another task is still populating the bag. The ConcurrentBag class can be found...
Parallelisation talk example – Independent Object Graphs
Parallelised code works best when data is not shared. This example shows a simple piece of parallel code where each task operates independently on its own...
Parallelisation Talk Example – Parallel.Invoke
Parallel.Invoke is the most basic way to start many tasks as the same time. The method takes as many Action<…> based delegates as needed. The Task Parallel...
Parallelisation Talk Examples – Basic PLINQ
These are some code examples from my introductory talk on Parallelisation showing the difference between a standard sequential LINQ query and its parallel...
Parallelisation Talk Examples – ConcurrentDictionary
The example used in the talk was one I had already blogged about. The original blog entry the example was based upon is here: Parallelisation in .NET 4.0 – The...
Parallelisation Talk examples - Parallel.For
This is some example code from my introductory talk on Parallelisation. Showing the difference between a standard sequential for loop and its parallel...
Parallelisation Talk Examples – Parallel.ForEach
These are some code examples from my introductory talk on Parallelisation. Showing the difference between a standard sequential foreach loop and its parallel...
Prallelisation Talk Example – Tasks within Tasks
In this example I’m showing the launching of further tasks within an existing task. The Main method launches a single task (of course, it would likely be many...
Tasks that create more work
I’m creating a program that parses a web page then follows the links and then parses the next set of web pages to eventually build a picture of an entire site....
Using semaphores to restrict access to resources
I’m in the process of building a small data extraction application. It uses the new Parallel Extensions in .NET 4 in order to more efficiently extract data...
Parallelisation in .NET 4.0 - The concurrent dictionary
One thing that I was always conscious of when developing concurrent code was that shared state is very difficult to deal with. It still is difficult to deal...
Parallelisation in .NET 4.0 - Part 2 Throwing Exceptions
With more threads running simultaneously in an application there is increasing complexity when it comes to debugging. When exceptions are thrown you usually...
Parallelisation in .NET 4.0 - Part 1 looping
In an upcoming project we have a need for using some parallelisation features. There are two aspects to this, one is that we have to make multiple calls out to...
