Parallel Development in VS10

Post on 24-May-2015

454 views 0 download

Tags:

description

Powered by MVP roadshow presentation, Riga (LV), Vilnius (LT).

Transcript of Parallel Development in VS10

Powered by MVPIndependent Experts. Real World Answers.

10. februārī, Rīgā

Parallel Computing withVisual Studio 2010

Valdis IljuconoksMicrosoft C# MVP, Latvia

Why we care about this?

Performance

Avoid multithreadingParallel programming is hard

It’s for experts

Parallelism Will Increase Your

Application's Complexity

The key is

measurement

Comparison Matrix (Amdahl's law)

So just use threads ?!

Crap code running in parallel

is just Parallelized crap

code

Where do I start?

Tasks vs Data

Control Flow

Control andData Flow

Data Parallelism

Chunk sizeChunk layout

Data dependencies

Task Parallelism

Task countWork per taskDependencies

Control and Data Flow

Task ConstraintsExternal Constraints

Orderings

Availability - Framework 4

Some Functionality in 3.5

Reactive Extensions (Rx)Parallel Extensions CTP

Parallel Library Content

Task Parallel Library (TPL) and Concurrency and Coordination Runtime (CCR)

Parallel LINQ (PLINQ)

New debugging and profiling tools

Coordination data structures

Parallel Pattern Library(PPL) C++ only

Parallel Library Architecture

Some of the issues

Some of the issues

Race conditions

Some of the issues

Race conditions

Deadlocks

Some of the issues

Race conditionsDeadlocks

Thread starvation

Some of the issues

Race conditionsDeadlocks

Thread starvation

Difficult to code and debug

Some of the issues

Race conditionsDeadlocks

Thread starvationDifficult to code and debug

Environmental

Important Concepts

Concurrent != Parallel

Single core machine?

Parallelization features

Can slow down

Getting started?

Task Factory

demo

Parallel.For()Parallel.ForEach()Parallel.Invoke()

Cancelling Task

demo

AvoidConsole.WriteLine()

Debugging Enhancements

Parallel Task WindowParallel Stack Window

demo

Deadlocks

demo

Parallelism Will Increase Your

Application's Complexity

Work Stealing

PLINQ

demo

Success Keys:

Frameworks and librariesTools (VS2010)

Guidance

Maslow’s Hammer

Questions ?

Future Considerations

Dormant GPUs

Distribute work across

multiple machines?

Async CTP

Valdis Iljuconoks

Software ArchitectMicrosoft C# MVP, Latvia

valdis.iljuconoks@dotnet.lvhttp://dotnet.lv/blogs/vi

Powered by MVPIndependent Experts. Real World Answers.

10. februārī, Rīgā