Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ade Miller Senior Development Manager Microsoft patterns & practices.

Similar presentations


Presentation on theme: "Ade Miller Senior Development Manager Microsoft patterns & practices."— Presentation transcript:

1 Ade Miller (adem@microsoft.com) Senior Development Manager Microsoft patterns & practices

2

3 Dual-Core Itanium 2 Intel CPU Trends (sources: Intel, Wikipedia, K. Olukotun) Pentium 386 Pentium 4

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33 1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3

34

35

36

37

38 Futures Pipeline Parallel Tasks Parallel Aggregation Parallel Loop

39

40

41

42

43

44 static void Walk (Tree root, Action action) { if (root == null) return; var t1 = Task.Factory.StartNew(() => action(root.Data)); var t2 = Task.Factory.StartNew(() => Walk(root.Left, action)); var t3 = Task.Factory.StartNew(() => Walk(root.Right, action)); Task.WaitAll(t1, t2, t3); }

45

46 QUIZ…

47

48

49

50 www.microsoft.com/teched www.microsoft.com/learning http://microsoft.com/technet http://microsoft.com/msdn

51

52 Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31 st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registration Join us in Atlanta next year

53

54 Source: More Patterns for Parallel Application Programs, Berna L. Massingill, Timothy G. Mattson and Beverly A. Sanders Master/ Worker SPMD Parallel Loops Fork/ Join Distributed Array Map Reduce Actors SOA Facade Repository MPMD Pipeline Producer/ Consumer Shared Queue Divide & Conquer Task Graph

55

56 Source: Design Patterns – Gamma, Helm, Johnson & Vlissides Patterns of Enterprise Application Architecture - Fowler

57 Source: Design Patterns – Gamma, Helm, Johnson & Vlissides IFoo Foo ConcurrentFoo

58 Source: Patterns of Enterprise Application Architecture - Fowler

59 Task Queue Source: Patterns for Parallel Programming – Mattson, Sanders & Massingill

60 var results = new ConcurrentQueue (); Parallel.For(0, 1000, (i) => { Result result = ComputeResult(i); results.Enqueue(result); });

61 var accountRatings = accounts.AsParallel().Select(item => CreditRating(item)).ToList();

62 Parallel.For (0, acc.Length, i => { acc[i].UpdateCreditRating(); }); #pragma omp parallel for for (int i = 0; i < len; i++) { acc[i].UpdateCreditRating(); }

63 Parallel.Invoke( () => ComputeMean(), () => ComputeMedian() ); parallel_invoke( [&] { ComputeMean(); }, [&] { ComputeMedian(); }, );

64 var input = new BlockingCollection (); var readLines = Task.Factory.StartNew(() => { try { foreach(var line in File.ReadAllLines(@"input.txt")) input.Add(line); } finally { input.CompleteAdding(); } }); var writeLines = Task.Factory.StartNew(() => { File.WriteAllLines(@”output.txt", input.GetConsumingEnumerator()); }); Task.WaitAll(readLines, writeLines);

65 Get-ChildItem C:\ | Where-Object {$_.Length -gt 2KB} | Sort-Object Length

66


Download ppt "Ade Miller Senior Development Manager Microsoft patterns & practices."

Similar presentations


Ads by Google