Aberdeen Developers – Introduction to Parallelisation

Examples Here are all the examples from Thursday evening’s introductory talk on Parallelisation at the Aberdeen Developers User Group. Starting tasks Parallel.Invokeexample Parallel.Forexample Parallel.ForEachexample Basic PLINQexample Tasks within Tasks example Data Management Independent Object Graphsexample ConcurrentBagexample ConcurrentDictionary example Stopping Tasks Error Handling with AggregateExceptionexample Cancelling Tasks example. Slide Deck You can download the slide deck […]

DDD Belfast Parallelisation Talk

Examples Here are all the examples from Saturday’s introductory talk on Parallelisation at DDD Belfast. Starting tasks Parallel.Invoke example Parallel.For example Parallel.ForEach example Basic PLINQ example Tasks within Tasks example Data Management Independent Object Graphs example ConcurrentBag example ConcurrentDictionary example Stopping Tasks Error Handling with AggregateException example Cancelling Tasks example. Slide Deck You can download […]

DDD South West Parallelisation Talk Overview

Examples Here are all the examples from Saturday’s introductory talk on Parallelisation at DDD South West 2011. Starting tasks Parallel.Invoke example Parallel.For example Parallel.ForEach example Basic PLINQ example Tasks within Tasks example Data Management Independent Object Graphs example ConcurrentBag example ConcurrentDictionary example Stopping Tasks Error Handling with AggregateException example Cancelling Tasks example Slide Deck The […]

Parallelisation Talk examples – Cancelling Tasks

This example showed what happens when tasks are cancelled. In this example, some tasks will be able to run to completion, others will be cancelled and other won’t even get a chance to start because the cancellation token was signalled before the task gets a chance to start. Here is the code for the cancellation […]

DDD Scotland Parallelisation Talk Overview

Follow Up I was asked a question during the talk I wasn’t immediately able to answer which I’ve now found the definite answer. What happens to parallel tasks running in the background when the application exits? Examples Here are all the examples from Saturday’s introductory talk on Parallelisation at DDD Scotland 2011. Starting tasks Parallel.Invoke […]

Scottish Developers Parallelisation Talk Overview

Here are all the examples from this evening’s introductory talk on Parallelisation at Scottish Developers. Starting tasks Parallel.Invoke example Parallel.For example Parallel.ForEach example Basic PLINQ example Tasks within Tasks example Data Management Independent Object Graphs example ConcurrentBag example ConcurrentDictionary example Error Handling AggregateException example The slide deck is available as a PDF file (10.5Mb)

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 error throws an exception. In the first example, only one task throws an exception. Although from the output you can see that more tasks were expected […]

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 object graph without dependencies on other objects outside its own graph. Each iteration of the Parallel.ForEach statement operates on only one item in the List named initialObjectGraph. The operations […]

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 in a real system) which is implemented by MainTask and then waits for that task to complete. The MainTask then launches many independent tasks (impelemnted as […]

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 Library takes care of the actual scheduling, degree of parallelism etc. Parallel.Invoke itself blocks until all the tasks have completed. In this example there are two tasks that […]