Title: Parallel Fx Library for .NET 3.5
1Parallel Fx Library for .NET 3.5 Multi-Core
Programming
2The Man, The Myth, The Legend
Who is this guy?
Warning!
3A New Programming Model is Needed
Multi-Core
Moores Law
Single Core
Performance
Time
4Inside a Multi-Core Processor
One Processor
With multiple execution Cores
5Parallel Programming Makes a Difference
Task 3 Core 1
Task 4 Core 1
Parallel programming with 2 cores
Task 1
Task 5 Core 2
Task 2 Core 2
Degree of Parallel Programming
Sequential app with threads
Task 2
Task 4
Task 1
Task 3
Sequential app
Task 1
Task 2
Task 3
Task 4
Execution Time
6How is Microsoft Addressing this Problem?
Parallel Computing Initiative
The Manycore Shift Whitepaper
7The Elements of Parallel Programming
Software you need Parallel Fx Library (Dec 07
CTP) Parallel Fx Concepts Declarative Data
Parallelism Imperative Data Parallelism Imperativ
e Task Parallelism Namespaces System.Linq System
.Linq.Parallel System.Threading System.Threading.T
asks
.NET Framework 3.5 VS 2008
General Concepts Problem Identification
Threads Thread Safety Locking Synchronization Rac
e Conditions Deadlock
8Project Sybil
So, does all this stuff work?
9Code Sample Parallel.For()
for (int i 0 i lt 10000000 i)
DataArrayi Rand.Next()
stopWatch.Start() for (int i 0 i
lt 10000000 i)
DataArrayi DataArrayi / 3
DataArrayi DataArrayi 6
DataArrayi DataArrayi / 3
DataArrayi DataArrayi 5
DataArrayi DataArrayi / 3
DataArrayi DataArrayi
DataArrayi DataArrayi / 3
DataArrayi DataArrayi 6
DataArrayi DataArrayi / 3
DataArrayi DataArrayi 5
DataArrayi DataArrayi / 3
DataArrayi DataArrayi
stopWatch.Stop()
for (int i 0 i lt 10000000 i)
DataArrayi Rand.Next()
stopWatch.Start()
Parallel.For(0, 10000000, delegate(int i)
DataArrayi
DataArrayi / 3 DataArrayi
DataArrayi 6 DataArrayi
DataArrayi / 3 DataArrayi
DataArrayi 5 DataArrayi
DataArrayi / 3 DataArrayi
DataArrayi DataArrayi
DataArrayi / 3 DataArrayi
DataArrayi 6 DataArrayi
DataArrayi / 3 DataArrayi
DataArrayi 5 DataArrayi
DataArrayi / 3 DataArrayi
DataArrayi )
stopWatch.Stop()
10Shift Happens
Most applications running slow Hardware
unused Applications must change You must
learn You are responsible
11Resources
MS Parallel Development Center Manycore
Whitepaper Book "Multi-core programming -
Increasing Performance Through Software
Multithreading" Intel Go Videos MSDN
Article Optimized managed code for multicore
machines
12The End