SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
Shallow Dive:
 Parallel Fx
      Alex Moore
Software Developer, TDCI
No More Free Lunch


Processors not getting much faster
No More Free Lunch
transistors++
No More Free Lunch
transistors++   speed++
No More Free Lunch
transistors++   speed++
No More Free Lunch
transistors++   speed++


cores++
Elephant in the Room
Elephant in the Room


Parallel / Concurrent Programming is about
           to reach it’s boiling point
Elephant in the Room


    Can’t ignore it much longer
Elephant in the Room


                  There will be language, library, and tool
                         support for this soon.




There will be language, library, tool, and hardware support for this soon.
Concurrency is one of the main themes for C# 4.0, the PFX will probably be part of .Net 4.0,
Visual Studio 2010 will have tools to help better debug concurrent programs, and Intel’s next
Core processor, the i7, will have a whole slew of improvements to help run concurrent and
threaded applications better.
Parallel Extensions to
the .Net Framework
                  PLINQ
     C
     D      Task Parallel Library
     S
                 Scheduler

         System.Threading
How to Express
  Parallelism
How to Express
      Parallelism


Threading sucks
How to Express
       Parallelism

Declarative data parallelism - PLINQ
How to Express
       Parallelism

Declarative data parallelism - PLINQ
Imperative data parallelism - Parallel.For
How to Express
       Parallelism

Declarative data parallelism - PLINQ
Imperative data parallelism - Parallel.For
Imperative task parallelism - Tasks, Futures
PLINQ

from x in set
where x == somevalue
select expensiveFunction(x);
PLINQ

from x in set
where x == somevalue
select expensiveFunction(x);


from x in set.AsParallel()
where x == somevalue
select expensiveFunction(x);
Parallel.For

for( int i = 0; i < 10; i++ )
{ ... }
Parallel.For

for( int i = 0; i < 10; i++ )
{ ... }



Parallel.For( 0, 10, i =>
{ ... } );
Parallel.ForEach

foreach( var x in set ) { ... }
Parallel.ForEach

foreach( var x in set ) { ... }



Parallel.ForEach( set, x => {...});
Tasks

A();
B();
C();

Do_Something();
Tasks

Task t1 = Task.Create( ()=> A(); );
Task t2 = Task.Create( ()=> B(); );
Task t3 = Task.Create( ()=> C(); );

Task.WaitAll(t1, t2, t3);

Do_Something();
Futures

var a = A();
var b = B();
var c = C();



Do_Something(a,b,c);
Futures

var a = Future.Create( ()=> A(); );
var b = Future.Create( ()=> B(); );
var c = Future.Create( ()=> C(); );



Do_Something(a,b,c);
Demos
Box of Sharp Knives




PFX is a big box of sharp knives. Yes they are shiny and you want to grab them but be
careful.
Box of Sharp Knives

          ★ Not a silver bullet for performance




This should not be your first choice for improving performance. Clean “responsible” design
will go a long way when optimizing code, and will help when deciding where to apply
concurrency.
Box of Sharp Knives

          ★ Not a silver bullet for performance

          ✓ Get the CTP
          ✓ Read, Do, and Learn



This should not be your first choice for improving performance. Clean “responsible” design
will go a long way when optimizing code, and will help when deciding where to apply
concurrency.
Questions?
                        Comments ?




Are there any questions ? Comments ?
How to find info
• MSDN Magazine - October ‘08
• Channel 9 - “Parallel Extensions”
• Blogs: Joe Duffy, Herb Sutter
• http://geekswithblogs.net/alexmoore/
  archive/2008/10/22/parallel-extensions-
  links.aspx
Thanks!

Alex Moore
Blog:   geekswithblogs.net/alexmoore
Twitter: @alexmoore

Más contenido relacionado

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Destacado

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Shallow Dive PFX

  • 1. Shallow Dive: Parallel Fx Alex Moore Software Developer, TDCI
  • 2. No More Free Lunch Processors not getting much faster
  • 3. No More Free Lunch transistors++
  • 4. No More Free Lunch transistors++ speed++
  • 5. No More Free Lunch transistors++ speed++
  • 6. No More Free Lunch transistors++ speed++ cores++
  • 8. Elephant in the Room Parallel / Concurrent Programming is about to reach it’s boiling point
  • 9. Elephant in the Room Can’t ignore it much longer
  • 10. Elephant in the Room There will be language, library, and tool support for this soon. There will be language, library, tool, and hardware support for this soon. Concurrency is one of the main themes for C# 4.0, the PFX will probably be part of .Net 4.0, Visual Studio 2010 will have tools to help better debug concurrent programs, and Intel’s next Core processor, the i7, will have a whole slew of improvements to help run concurrent and threaded applications better.
  • 11. Parallel Extensions to the .Net Framework PLINQ C D Task Parallel Library S Scheduler System.Threading
  • 12. How to Express Parallelism
  • 13. How to Express Parallelism Threading sucks
  • 14. How to Express Parallelism Declarative data parallelism - PLINQ
  • 15. How to Express Parallelism Declarative data parallelism - PLINQ Imperative data parallelism - Parallel.For
  • 16. How to Express Parallelism Declarative data parallelism - PLINQ Imperative data parallelism - Parallel.For Imperative task parallelism - Tasks, Futures
  • 17. PLINQ from x in set where x == somevalue select expensiveFunction(x);
  • 18. PLINQ from x in set where x == somevalue select expensiveFunction(x); from x in set.AsParallel() where x == somevalue select expensiveFunction(x);
  • 19. Parallel.For for( int i = 0; i < 10; i++ ) { ... }
  • 20. Parallel.For for( int i = 0; i < 10; i++ ) { ... } Parallel.For( 0, 10, i => { ... } );
  • 22. Parallel.ForEach foreach( var x in set ) { ... } Parallel.ForEach( set, x => {...});
  • 24. Tasks Task t1 = Task.Create( ()=> A(); ); Task t2 = Task.Create( ()=> B(); ); Task t3 = Task.Create( ()=> C(); ); Task.WaitAll(t1, t2, t3); Do_Something();
  • 25. Futures var a = A(); var b = B(); var c = C(); Do_Something(a,b,c);
  • 26. Futures var a = Future.Create( ()=> A(); ); var b = Future.Create( ()=> B(); ); var c = Future.Create( ()=> C(); ); Do_Something(a,b,c);
  • 27. Demos
  • 28. Box of Sharp Knives PFX is a big box of sharp knives. Yes they are shiny and you want to grab them but be careful.
  • 29. Box of Sharp Knives ★ Not a silver bullet for performance This should not be your first choice for improving performance. Clean “responsible” design will go a long way when optimizing code, and will help when deciding where to apply concurrency.
  • 30. Box of Sharp Knives ★ Not a silver bullet for performance ✓ Get the CTP ✓ Read, Do, and Learn This should not be your first choice for improving performance. Clean “responsible” design will go a long way when optimizing code, and will help when deciding where to apply concurrency.
  • 31. Questions? Comments ? Are there any questions ? Comments ?
  • 32. How to find info • MSDN Magazine - October ‘08 • Channel 9 - “Parallel Extensions” • Blogs: Joe Duffy, Herb Sutter • http://geekswithblogs.net/alexmoore/ archive/2008/10/22/parallel-extensions- links.aspx
  • 33. Thanks! Alex Moore Blog: geekswithblogs.net/alexmoore Twitter: @alexmoore