Parallel Development in VS10

49
Powered by MVP Independent Experts. Real World Answers. 10. februārī, Rīgā

description

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

Transcript of Parallel Development in VS10

Page 1: Parallel Development in VS10

Powered by MVPIndependent Experts. Real World Answers.

10. februārī, Rīgā

Page 2: Parallel Development in VS10

Parallel Computing withVisual Studio 2010

Valdis IljuconoksMicrosoft C# MVP, Latvia

Page 3: Parallel Development in VS10

Why we care about this?

Page 4: Parallel Development in VS10

Performance

Page 5: Parallel Development in VS10

Avoid multithreadingParallel programming is hard

It’s for experts

Page 6: Parallel Development in VS10

Parallelism Will Increase Your

Application's Complexity

Page 7: Parallel Development in VS10

The key is

measurement

Page 8: Parallel Development in VS10

Comparison Matrix (Amdahl's law)

Page 9: Parallel Development in VS10

So just use threads ?!

Page 10: Parallel Development in VS10

Crap code running in parallel

is just Parallelized crap

code

Page 11: Parallel Development in VS10

Where do I start?

Page 12: Parallel Development in VS10

Tasks vs Data

Control Flow

Control andData Flow

Page 13: Parallel Development in VS10

Data Parallelism

Chunk sizeChunk layout

Data dependencies

Page 14: Parallel Development in VS10

Task Parallelism

Task countWork per taskDependencies

Page 15: Parallel Development in VS10

Control and Data Flow

Task ConstraintsExternal Constraints

Orderings

Page 16: Parallel Development in VS10

Availability - Framework 4

Page 17: Parallel Development in VS10

Some Functionality in 3.5

Reactive Extensions (Rx)Parallel Extensions CTP

Page 18: Parallel Development in VS10

Parallel Library Content

Page 19: Parallel Development in VS10

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

Page 20: Parallel Development in VS10

Parallel Library Architecture

Page 21: Parallel Development in VS10

Some of the issues

Page 22: Parallel Development in VS10

Some of the issues

Race conditions

Page 23: Parallel Development in VS10

Some of the issues

Race conditions

Deadlocks

Page 24: Parallel Development in VS10

Some of the issues

Race conditionsDeadlocks

Thread starvation

Page 25: Parallel Development in VS10

Some of the issues

Race conditionsDeadlocks

Thread starvation

Difficult to code and debug

Page 26: Parallel Development in VS10

Some of the issues

Race conditionsDeadlocks

Thread starvationDifficult to code and debug

Environmental

Page 27: Parallel Development in VS10

Important Concepts

Page 28: Parallel Development in VS10

Concurrent != Parallel

Page 29: Parallel Development in VS10

Single core machine?

Page 30: Parallel Development in VS10

Parallelization features

Can slow down

Page 31: Parallel Development in VS10

Getting started?

Page 32: Parallel Development in VS10

Task Factory

demo

Page 33: Parallel Development in VS10

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

Page 34: Parallel Development in VS10

Cancelling Task

demo

Page 35: Parallel Development in VS10

AvoidConsole.WriteLine()

Page 36: Parallel Development in VS10

Debugging Enhancements

Parallel Task WindowParallel Stack Window

demo

Page 37: Parallel Development in VS10

Deadlocks

demo

Page 38: Parallel Development in VS10

Parallelism Will Increase Your

Application's Complexity

Page 39: Parallel Development in VS10

Work Stealing

Page 40: Parallel Development in VS10

PLINQ

demo

Page 41: Parallel Development in VS10

Success Keys:

Frameworks and librariesTools (VS2010)

Guidance

Page 42: Parallel Development in VS10

Maslow’s Hammer

Page 43: Parallel Development in VS10

Questions ?

Page 44: Parallel Development in VS10

Future Considerations

Page 45: Parallel Development in VS10

Dormant GPUs

Page 46: Parallel Development in VS10

Distribute work across

multiple machines?

Page 47: Parallel Development in VS10

Async CTP

Page 48: Parallel Development in VS10

Valdis Iljuconoks

Software ArchitectMicrosoft C# MVP, Latvia

[email protected]://dotnet.lv/blogs/vi

Page 49: Parallel Development in VS10

Powered by MVPIndependent Experts. Real World Answers.

10. februārī, Rīgā