Parallel Programming in Visual Studio 2010 Sasha Goldshtein Senior Consultant, Sela Group
Agenda Overview and Roadmap Architecture, Design Patterns Explicit and Implicit Parallelism Synchronization Mechanisms Coordination Data Structures Debugging and Profiling Other Technologies
Overview and Roadmap Shipping in.NET 4.0 – Task Parallel Library – Parallel LINQ – Task Scheduler Shipping in Visual Studio 2010 – Debugging and profiling enhancements – Don’t forget the native tools (ConcRT) Disclaimer: This is Beta software Visual Studio 2010 & Framework 4.0
Architecture Pipeline Partitioning Grid
Explicit Parallelism Task.Factory.StartNew Parent-child relationships Continuations Futures Exception handling Cancellation
Implicit Parallelism Parallel.For, Parallel.ForEach Parallel.Invoke Custom partitioner
Very Implicit Parallelism Parallel LINQ Ordered vs. Unordered foreach vs. ForAll Cancellation
Synchronization Mechanisms Barrier CountdownEvent ManualResetEventSlim SemaphoreSlim SpinLock SpinWait Lazy initialization
Coordination Data Structures Lock-free data structures Concurrent queue Concurrent stack, dictionary Concurrent bag (work-stealing) ThreadLocal
Concurrency Design Patterns Worker patterns – Producer-consumer (BlockingCollection ) – Completion port / thread pool (Task) – Automatic pipelining / partitioning – APM coordination (Task.Factory.FromAsync) Smart collections patterns – Safe/unsafe, read/write – Cyclic buffer
Debugging in Visual Studio 2010 Parallel Stacks Parallel Tasks
Profiling in Visual Studio 2010 Core utilization Thread blocking, Thread migration
Incubation and Other Technologies STM.NET Axum (ex. Maestro) CHESS Windows core support Windows 7 User-Mode Scheduler
Summary The next generation parallel technologies and tools are here Download Visual Studio 2010 Beta 1
Additional Resources msdn.com/concurrency code.msdn.microsoft.com/ParExtSamples msdn.microsoft.com/en- us/library/dd460693(VS.100).aspx channel9.msdn.com/tags/Parallel+Extensions/
Thank You! Sasha Goldshtein Senior Consultant, Sela Group