200 likes | 376 Views
The Free Lunch is Over. Getting good at Parallel with .NET 4.0. jtwist@microsoft.com. www.thejoyofcode.com. @ joshtwist. But first…. You could have been at the PDC!. An apology …. The Free Lunch is Over.
E N D
The Free Lunch is Over Getting good at Parallel with .NET 4.0 jtwist@microsoft.com www.thejoyofcode.com @joshtwist
But first… You could have been at the PDC! • An apology…
The Free Lunch is Over …the big theme of the 2004 In-Stat/MDR Fall Processor Forum was multicore devices, as many companies showed new or updated multicore processors. Looking back, it’s not much of a stretch to call 2004 the year of multicore. http://www.gotw.ca/publications/concurrency-ddj.htm Published in March 2005
10,000,000 1,000,000 100,000 10,000 1,000 Clock Speed (MHz) Transistors (000s) 100 Moore’s Law 10 1 0 1990 2010 2000 1995 2005 1975 1980 1985 1970
The free lunch ended in 2005; why am I still eating? Web Servers Many concurrent requests Batch Processing Virtualisation Desktops Low Hanging Fruit Many Processes To Run
But soon… PFX team in Redmond – 128 cores! Our labs – 24 cores New desktops – 8 cores Me – 2 cores
The Free Lunch is Over Concurrency is the next major revolution in how we write software… … The vast majority of programmers today don’t grok concurrency, just as the vast majority of programmers 15 years ago didn’t yet grok objects http://www.gotw.ca/publications/concurrency-ddj.htm
Why? Tools for concurrency before .Net 4 APM (Asynchronous Programming Model) EAP (Event-based Asynchronous Programming) new Thread() ThreadPool & QueueUserWorkItem Sync Primitives: ResetEvents, Semaphores, WaitHandles, Monitors, Slims etc. ThreadStatic & CallContext
Two challenges Logically rethink the processing in your application to support concurrency – tough! Rewrite the application using these basic primitives – tough!
In .Net 4 • Parallel Extensions • Tasks • Parallel • PLINQ • ThreadLocal / Lazy • Visual Studio 2010 Concurrency Debugging Support
Two primary types Task Parallelism Data Parallelism
Task Parallelism New Credit Application Store Request Validate Address Get Credit References Get Internal Credit Data Decide!
Task Parallelism DEMONSTRATION
Two primary types Data Parallelism
Data Parallelism DEMONSTRATION
Some things not covered BlockingCollections and Pipelines FromSynchronizationContext Visual Studio Debugging Tools and much more…
Q&A 1. Your questions? 2. My go!
My questions • Who uses WF (Workflow)? • Version 4? • Those who don’t – why not? • Those who do… • What are your impressions? • Any feedback?
Thank you! Want help from people like me? Ask about PSfD. Questions also accepted by Twitter. Follow me or else. jtwist@microsoft.com www.thejoyofcode.com @joshtwist