230 likes | 362 Vues
Dive into the world of parallel programming with Visual Studio 2010! Discover the Task Parallel Library (TPL), multi-core programming strategies, and the integration of C# and C++ for effective parallel architectures. Learn about Lambda expressions, PLINQ, and how to manage concurrency with ease using built-in tools. This presentation covers essential concepts such as parallel loops, race conditions, and essential debugging techniques that can help developers optimize their applications. Join the future of software development with insights gathered from TechEd conferences and experience the power of TPL!
E N D
About Me • Microsoft MVP • Intel Blogger • TechEd Israel, TechEd Europe • Expert C++ Book • http://AsyncOp.com • http://Asaf.Shelly.co.il
Task Parallel Library - TPL • .Net Framework 3.5 • See TechEd 2008 • VS2010 with .Net 4.0 • Language Extensions • Lambda Expressions • C#, VB, F#, C++
From for to Parallel.For for (inti=0; i<100; i++) { int x = i + i; } Parallel.For(0, 100, i => { int x = i + i; });
C++ parallel_for parallel_for(0, 100, [&] i { int x = i + i; });
Visual Studio 2010 • Multi-Core Programming • Tasks • Agents • Parallel Loops • Parallel Algorithms • Parallel Replacement for STL • Seamless Task Usage
Task Oriented Design Open Scan Scan Scan Scan Scan Scan Parallel Extensions Loop Modify Modify Parallel Extensions Loop Write
VS2010 Demo C# Parallel.For
Keep an eye for… • Shared are Globals • Parallel Loops are not loops • Define data as Loop internal • Race Conditions are still here • Locks!! • I/O – Disk, Network, etc.
VS2010 Demo C++ Parallel_For
VS2010 Demo Understanding Lambda and parallel_for
Visual Studio Parallel Debugger • Parallel Task List • Parallel Task Stack • Built-in Profiler
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
Advanced Parallel In VS2010 • Agents – Resource Owners • Task Groups • Task Cancellation • Task Cleanup (CancelIo)
VS2010 Demo New F# Application
Hints for the future • http://msdn.microsoft.com/en-us/devlabs/dd795202.aspx • AXUM – Language for parallel computing • STM.Net - Software Transactional Memory for concurrent memory separation • Spec Explorer – Graphical analysis of software behavior • … and more
A bit nostalgia • TechEd 2008 Israel
Do we really want Parallel Code? 2005 2007 2008 2010 Do users even care? Parallel Computing Vs. Classic Design
Change In Mindset Everything is stopped. Waiting for the photographer Everyone is working independently
Change In Mindset Developers are writing functions Developers are managing tasks
Change In Mindset If you can't Adapt You are left behind If you can't Adapt You are left behind Doing things the way we always have Things are going to be different