Download presentation
Presentation is loading. Please wait.
Published byTeresa Dickerson Modified over 9 years ago
1
Ade Miller (adem@microsoft.com) Senior Development Manager Microsoft patterns & practices
3
Dual-Core Itanium 2 Intel CPU Trends (sources: Intel, Wikipedia, K. Olukotun) Pentium 386 Pentium 4
33
1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3
38
Futures Pipeline Parallel Tasks Parallel Aggregation Parallel Loop
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); }
46
QUIZ…
50
www.microsoft.com/teched www.microsoft.com/learning http://microsoft.com/technet http://microsoft.com/msdn
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
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
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.