Parallel Programming for Managed Developers with Visual Studio 2010 - PowerPoint PPT Presentation

parallel programming for managed developers with visual studio 2010 l.
Skip this Video
Loading SlideShow in 5 Seconds..
Parallel Programming for Managed Developers with Visual Studio 2010 PowerPoint Presentation
Parallel Programming for Managed Developers with Visual Studio 2010

play fullscreen
1 / 30
Download Presentation
luisa
Views
Download Presentation

Parallel Programming for Managed Developers with Visual Studio 2010

Presentation Transcript

  1. TL26 Parallel Programming for Managed Developers with Visual Studio 2010 Daniel Moth  Parallel Computing Platform Microsoft Corporation http://www.danielmoth.com/Blog

  2. Visual Studio 2010Tools / Programming Models / Runtimes Integrated Tooling Programming Models Programming Models PLINQ Parallel Debugger Toolwindows Task Parallel Library Parallel Pattern Library Agents Library Data Structures Concurrency Runtime Concurrency Runtime Data Structures Task Scheduler Profiler Concurrency Analysis ThreadPool Task Scheduler Resource Manager Resource Manager Operating System Threads Key: Managed Library Native Library Tools

  3. demo What a difference many cores make on the client

  4. AGENDA • Set the scene • Fine-Grained Parallelism 3. Debugger Support • Structured Parallelism • Declarative Data Parallelism

  5. Threading/Concurrency -> Parallelism On Single Core Machine • Don’t block the UI • Thread Affinity • Async Operations • Synchronization Issues On Multi-core Machine • As above... • ... plus Improve Actual Performance • ... plus create new user experiences

  6. demo From Thread-based toTask-based programming model

  7. User Mode Scheduler CLR Thread Pool Global Queue Worker Thread 1 Worker Thread p … Program Thread

  8. User Mode Scheduler For Tasks CLR Thread Pool: Work-Stealing Local Queue Local Queue Global Queue … Worker Thread 1 Worker Thread p … Task 6 Task 3 Task 4 Task 1 Program Thread Task 5 Task 2

  9. demo Task: Rich API

  10. Task-based Programming Summary ThreadPool ThreadPool.QueueUserWorkItem(…); System.Threading.Tasks Continue/Wait/Cancel Taskt = Task.StartNew(…); Taskp = t.ContinueWith(…); t.Wait(2000); t.Cancel(); Starting Task.StartNew(…); Tasks with results Parent/Child var p = Task.StartNew(() => { vart = Task.StartNew(…);}); varf = Future.StartNew(() => C()); … int result = f.Value;

  11. AGENDA CHECKPOINT • Set the scene • Fine-Grained Parallelism 3. Debugger Support • Structured Parallelism • Declarative Data Parallelism

  12. demo New Debugger toolwindows

  13. Debugger Support Support both managed and native • Parallel Tasks • Parallel Stacks Also supports traditional threading

  14. AGENDA CHECKPOINT • Set the scene • Fine-Grained Parallelism 3. Debugger Support • Structured Parallelism • Declarative Data Parallelism

  15. Structured Parallelism Parallel class • static (overloaded) methods • helper methods to create/work with Tasks • encapsulates common patterns

  16. demo Parallel.Invoke/ForEach

  17. AGENDA CHECKPOINT • Set the scene • Fine-Grained Parallelism 3. Debugger Support • Structured Parallelism • Declarative Data Parallelism

  18. Declarative Data Parallelism Parallel LINQ-to-Objects (PLINQ) • Enables LINQ devs to leverage multiple cores • Fully supports all .NET standard query operators • Minimal impact to existing LINQ model var q = from p in people         where p.Name == queryInfo.Name && p.State == queryInfo.State && p.Year >= yearStart && p.Year <= yearEnd orderbyp.Year ascending         select p; .AsParallel()

  19. demo Parallel LINQ

  20. AGENDA CHECKPOINT • Set the scene • Fine-Grained Parallelism 3. Debugger Support • Structured Parallelism • Declarative Data Parallelism

  21. Coordination Data Structures Thread-safe collections ConcurrentStack<T> ConcurrentQueue<T> ConcurrentDictionary<TKey,TValue> Work exchange BlockingCollection<T> IProducerConsumerCollection<T> Initialization LazyInit<T> Phased Operation CountdownEvent Barrier Locks ManualResetEventSlim SemaphoreSlim SpinLock SpinWait

  22. Summary Framework 4.0 • Task Parallel Library • Task + User Mode Work Stealing Scheduler • Parallel.Invoke/For/ForEach • Parallel LINQ • Coordination Data Structures • Debugger toolwindows • Parallel Tasks • Parallel Stacks • Parallel Performance Analyzer (see TL19) Visual Studio 2010 & • Embrace Parallelism and Create New Experiences

  23. Parallel Computing @ PDC2008 Monday (watch them on video) • Microsoft Visual Studio: Bringing out the Best in Multicore Systems • Parallel Programming for C++ Developers in the Next Version of Microsoft Visual Studio Later Today (1:15 PM – 2:30 PM) • Concurrency Runtime Deep Dive: How to Harvest Multicore Computing Resources Thursday Symposium (8:30 AM – 1:30 PM) • Addressing the Hard Problems of Concurrency • Parallel Computing Application Architectures and Opportunities • Future of Parallel Computing (Panel)

  24. Parallel Computing Resources Downloads, Binaries, Code, Forums, Blogs, Videos, Screencasts, Podcasts, Articles, Samples Visual Studio 2010 CTP on your PDC drive • http://msdn.com/concurrency

  25. Evals & Recordings Please fill out your evaluation for this session at: This session will be available as a recording at: www.microsoftpdc.com

  26. Q&A Please use the microphones provided

  27. © 2008 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.

  28. MSFT Parallel Computing Technologies Task Concurrency IFx / CCR • Robotics-based manufacturing assembly line • Silverlight Olympics viewer • Automotive control system • Internet –based photo services WCF Maestro TPL / PPL WF Local Computing Distributed/Cloud Computing • Ultrasound imaging equipment • Media encode/decode • Image processing/ enhancement • Data visualization • Enterprise search, OLTP, collab • Animation / CGI rendering • Weather forecasting • Seismic monitoring • Oil exploration Cluster SOA PLINQ D-PLINQ OpenMP TPL / PPL D-TPL MPI / MPI.Net CDS Data Parallelism

  29. Comprehensive View Of Concurrency Task Parallel Library Parallel Pattern Library OpenMP, Cluster SOA Coordination Data Structures Transactional Memory PLINQ MPI, MPI.net, CCR Native Agents and Messaging Maestro