Download presentation
Presentation is loading. Please wait.
Published byJasper Boyd Modified over 9 years ago
3
Parallel Pattern Library Resource Manager Task Scheduler Task Parallel Library Task Parallel Library Parallel LINQ Managed Native Key: Threads Operating System Concurrency Runtime Programming Models ThreadPool Task Scheduler Resource Manager Data Structures Tools Tooling Parallel Debugger Tool Windows Parallel Debugger Tool Windows Concurrency Visualizer Agents Library UMS Threads.NET Framework 4 Visual C++ 10 Visual Studio IDE Visual Studio IDE Windows Parallel LINQ
4
int[] output = arr.Select(x => Foo(x)).ToArray(); int[] output = arr.Select(x => Foo(x)).ToArray(); int[] output = arr.AsParallel().Select(x => Foo(x)).ToArray(); int[] output = arr.AsParallel().Select(x => Foo(x)).ToArray();
5
coding walkthrough
6
1 1 int[] input =... bool[] output = input.AsParallel().Select(x => IsPrime(x)).ToArray(); int[] input =... bool[] output = input.AsParallel().Select(x => IsPrime(x)).ToArray(); input:output: 6 6 3 3 8 8 2 2 7 7 … … F F F F T T F F T T T T … …
7
IEnumerable input = Enumerable.Range(1,100); bool[] output = input.AsParallel().Select(x => IsPrime(x)).ToArray(); IEnumerable input = Enumerable.Range(1,100); bool[] output = input.AsParallel().Select(x => IsPrime(x)).ToArray();... Input Enumerator output:
8
var q = input.AsParallel().Select(x => IsPrime(x)); foreach(var x in q) {... } var q = input.AsParallel().Select(x => IsPrime(x)); foreach(var x in q) {... } Input Enumerator Output Enumerator Output Enumerator... Poll MoveNext
9
var q = input.AsParallel().AsOrdered().Select(x => IsPrime(x)); foreach(var x in q) {... } var q = input.AsParallel().AsOrdered().Select(x => IsPrime(x)); foreach(var x in q) {... } Input Enumerator Output Enumerator Output Enumerator... Poll MoveNext
10
Input Enumerator... int result = input.AsParallel().Aggregate( 0, (a, e) => a + Foo(e), (a1,a2) => a1 + a2); int result = input.AsParallel().Aggregate( 0, (a, e) => a + Foo(e), (a1,a2) => a1 + a2); res1: res2: resN: result:
11
Input Enumerator... int result = input.AsParallel().AsOrdered().Where(x => IsPrime(x)).First(); int result = input.AsParallel().AsOrdered().Where(x => IsPrime(x)).First(); resultFound: F F result: Poll Set
12
int[] output = input.AsParallel().Where(x => IsPrime(x)).GroupBy(x => x % 5).Select(g => ProcessGroup(g)).ToArray(); int[] output = input.AsParallel().Where(x => IsPrime(x)).GroupBy(x => x % 5).Select(g => ProcessGroup(g)).ToArray();... Input Enumerator output:...
16
Core 1 5 5 Core 2 Core 3 Core 4 Invalidate Cache 6 6 7 7 3 3 2 2 5 5 7 7 3 3 2 2 Memory: 5 5 7 7 3 3 2 2 5 5 7 7 3 3 2 2 5 5 7 7 3 3 2 2 Cache line
18
src.Select(x => Foo(x)).TakeWhile(x => Filter(x)).AsParallel().Select(x => Bar(x)).ToArray(); src.Select(x => Foo(x)).TakeWhile(x => Filter(x)).AsParallel().Select(x => Bar(x)).ToArray();
23
Built by Developers for Developers….
24
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.