SlideShare a Scribd company logo
No. 1
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 2
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 3
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 4
Architect Developer Tester
Product
Management
Business
Management
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 5
Most servers
today both have
multi-core and
multi-processor
architecture
You should not
rely on the OS to
do parallel
programming
Parallel
programming is
just not for Super
Geeks any more
(Driver
developers, OS
developers, C++
guys)
All verticals are
starting to
want/need
parallel
programming
Parallel
programming can
be leveraged well
in some cloud
scenarios
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Beijing National Stadium - a.k.a “Bird’s Nest”
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Concurrency
• GOAL: Prevent thread starvation
• concept related to multitasking and asynchronous input-output (I/O)
• existence of multiple threads of execution that may each get a slice of
time to execute before being preempted by another thread
Parallelism
• GOAL: Maximize processor usage across all available cores
• concurrent threads execute at the same time across cores
• focuses on improving the performance of applications that use a lot
of processor power and are not constantly interrupted when multiple
cores are available.
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 9
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
TPL for .net
MPL Express/JFFP
RiverTrail for Javascript
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Decomposition Coordination
Scalable
Sharing
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 12
• Too fine = overhead to manage will become to much
• Too course = parallel opportunities will be lost
Identify tasks at a level of granularity that results in
efficient use of hardware resources.
• They should remain independent of each other, and have enough tasks to
keep the cores busy
Tasks should be as large as possible
• Dedicate some time to understand these components.
Decomposing a problem into tasks requires a good
understanding of the algorithmic and structural aspects
of your application.
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Sean’s General Rule of thumb:
If iteration takes longer than 1 minute, review further.
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 14
Coordination depends on
specifically which parallel
patterns you use to
implement
Application algorithms are
constrained by order of
execution and degree of
parallelism
• Constraints can come from data
flow or control flow.
The Futures pattern uses
Continuation to manage
coordination.
• Make sure that you understand any
coordination, before modifying you
application.
Mapping out dependencies
in a graph or inheritance
tree helps truly understand
the landscape
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 15
Limit your
shared
variables
Use immutable
data when you
can Introduce new steps in
your algorithm that merge
local versions of mutable
state at checkpoints
Adding synchronization
reduces the parallelism of
your application.
Parallel Loop
Parallel Tasks
Parallel Aggregation
Futures
Pipelines
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 17
Do you have sequential loops where there's no
communication among the steps of each
iteration?
Use the Parallel Loop pattern
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Parallel loops apply an independent operation to
multiple inputs simultaneously.
Very similar to for and foreach.
Sequence in the collection will not matter.
Do not replace all for and for each loops with the
parallel equivalent. You will get into trouble
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No – array cannot be divided into parts that can be sorted independently.
No, because the sum of the entire collection is needed, not the sums of
separate parts.
Yes, because each slide can be considered independently.
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 21
Do you have distinct operations with well-
defined control dependencies and are these
operations largely free of serializing
dependencies?
Use the Parallel Task pattern
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
• Sometimes referred to as Fork/Join pattern or the
Master/Worker pattern.
Parallel Tasks allow you to establish parallel
control flow in the style of fork and join.
• Don’t assume that all parallel tasks will immediately run. That is
up to the scheduler.
You can wait for a single task or multiple tasks.
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 24
Do you need to summarize data by applying some
kind of combination operator? Do you have loops
with steps that are not fully independent?
Use the Parallel Aggregation pattern
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Introduces special steps in the algorithm for
merging partial results.
This pattern expresses a reduction operation and
includes map/reduce as one of its variations
Uses unshared, local variables that are merged at
the end of the computation to give the final
result
a.k.a. as The Parallel Reduction pattern because it
combines multiple inputs into a single output
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 28
Does the ordering of steps in your algorithm
depend on data flow constraints?
Use the Futures pattern
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Makes the data flow dependencies between tasks
explicit.
A future is a stand-in for a computational result
that is initially unknown but becomes known
The Futures pattern integrates task parallelism
with the familiar world of arguments and return
values
If a task in the chain is depending on another to
finish, it will block. The core will be available for
other tasks.
a.k.a Task Graph pattern.
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 30
F1 F2
F3
F4
F5
F6
F1
F2
F3
F4
F5
F6
Method Chain Method Chain using Futures
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 32
Does your application perform a sequence of
operations repetitively? Does the order of
processing matter?
Use the Pipeline pattern
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Pipelines consist of components that are
connected by queues, in the style of producers
and consumers.
All the components run in parallel even though
the order of inputs is respected.
Analogous to assembly lines in a factory
Pipelines allow you to use parallelism in cases
where there are too many dependencies to use a
parallel loop
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
No. 34
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Sean Kenney - Solving Parallel Software Challenges with Patterns
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
Concurrency Visualizer
Debugging
Parallel Stacks Windows
Parallel Tasks Windows
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
• Parallel Programming is expected in most software
• Clearly understand the core design aspects
• Decomposition
• Coordination
• Scalable Sharing
• Get to know the 5 key parallel patterns
• Parallel Loop
• Parallel Tasks
• Parallel Aggregation
• Futures
• Pipelines
• Leverage industry tooling to make you experience
easier.
© Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only

More Related Content

PPTX
My Oracle Support
PPTX
Bit sosem 2016-wieners-sitzung-03_algorithmen
PDF
HTML5 im Überblick - semantisches HTML, Geolocation, Offline-Webanwendungen, ...
PPTX
Bit sosem 2016-wieners-sitzung-08_semantic-web
PDF
1998 - Thesis JL Pacherie Parallel perators
PDF
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
PDF
Arc 300-3 ade miller-en
PPTX
Solution Patterns for Parallel Programming
My Oracle Support
Bit sosem 2016-wieners-sitzung-03_algorithmen
HTML5 im Überblick - semantisches HTML, Geolocation, Offline-Webanwendungen, ...
Bit sosem 2016-wieners-sitzung-08_semantic-web
1998 - Thesis JL Pacherie Parallel perators
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
Arc 300-3 ade miller-en
Solution Patterns for Parallel Programming

Similar to Sean Kenney - Solving Parallel Software Challenges with Patterns (20)

PPTX
Coding For Cores - C# Way
PPT
Overview Of Parallel Development - Ericnel
PPT
Parallel Computing 2007: Overview
PDF
Our Concurrent Past; Our Distributed Future
PPTX
Parallel programming in .NET
PDF
Parallel Computing - Lec 5
PPTX
Patterns of parallel programming
PPTX
Concurrency in c#
PPTX
20090720 smith
PPTX
Parallel Algorithms Advantages and Disadvantages
PPTX
Thinking in parallel ab tuladev
PDF
Concurrency and parallel in .net
PDF
Top 5 performance problems in .net applications application performance mon...
PPT
Parallel Extentions to the .NET Framework
PPTX
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
PPTX
Parallel? Sleep well!
PDF
Concurrent Programming On Windows Joe Duffy
PPTX
Parallel Programming In Modern World .NET Technics
PPTX
Parallel programming in modern world .net technics shared
PPTX
Architecting Solutions for the Manycore Future
Coding For Cores - C# Way
Overview Of Parallel Development - Ericnel
Parallel Computing 2007: Overview
Our Concurrent Past; Our Distributed Future
Parallel programming in .NET
Parallel Computing - Lec 5
Patterns of parallel programming
Concurrency in c#
20090720 smith
Parallel Algorithms Advantages and Disadvantages
Thinking in parallel ab tuladev
Concurrency and parallel in .net
Top 5 performance problems in .net applications application performance mon...
Parallel Extentions to the .NET Framework
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel? Sleep well!
Concurrent Programming On Windows Joe Duffy
Parallel Programming In Modern World .NET Technics
Parallel programming in modern world .net technics shared
Architecting Solutions for the Manycore Future
Ad

More from iasaglobal (20)

PDF
Adam boczek 2015 agile architecture in 10 steps v1.0
PDF
Adam boczek 2015 agile architecture in 10 steps v1.0
PDF
Adam boczek 2013 bitkom software summit agile architecture v1.3
PDF
Essentials of enterprise architecture tools
PDF
Understanding business strategy cutting edge paradigm
PDF
Information and data relevance to business
PDF
Case study value of it strategy in hi tech industry
PDF
Max Poliashenko - Enterprise Product Architecture
PDF
Michael Gonzalez - Do The Sum of The Parts Equal the Whole
PDF
Michael Jay Freer - Information Obfuscation
PDF
Creating Enterprise Value from Business Architecture
PDF
Scott Whitmire - Just What is Architecture Anyway
PDF
Board of Education Vision 2013-2014
PDF
Sheila Jeffrey - Well Behaved Data - It's a Matter of Principles
PDF
Stephen Cohen - The Impact of Ethics on the Architect
PDF
William Martinez - Evolution Game
PDF
Paul Preiss - Enterprise Architecture in Transformation
PDF
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
PDF
Roger Sessions - The Snowman Architecture
PDF
Strategic Portfolio Management for IT
Adam boczek 2015 agile architecture in 10 steps v1.0
Adam boczek 2015 agile architecture in 10 steps v1.0
Adam boczek 2013 bitkom software summit agile architecture v1.3
Essentials of enterprise architecture tools
Understanding business strategy cutting edge paradigm
Information and data relevance to business
Case study value of it strategy in hi tech industry
Max Poliashenko - Enterprise Product Architecture
Michael Gonzalez - Do The Sum of The Parts Equal the Whole
Michael Jay Freer - Information Obfuscation
Creating Enterprise Value from Business Architecture
Scott Whitmire - Just What is Architecture Anyway
Board of Education Vision 2013-2014
Sheila Jeffrey - Well Behaved Data - It's a Matter of Principles
Stephen Cohen - The Impact of Ethics on the Architect
William Martinez - Evolution Game
Paul Preiss - Enterprise Architecture in Transformation
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Roger Sessions - The Snowman Architecture
Strategic Portfolio Management for IT
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Monthly Chronicles - July 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
Electronic commerce courselecture one. Pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
The AUB Centre for AI in Media Proposal.docx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Monthly Chronicles - July 2025

Sean Kenney - Solving Parallel Software Challenges with Patterns

  • 2. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 2
  • 3. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 3
  • 4. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 4 Architect Developer Tester Product Management Business Management
  • 5. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 5 Most servers today both have multi-core and multi-processor architecture You should not rely on the OS to do parallel programming Parallel programming is just not for Super Geeks any more (Driver developers, OS developers, C++ guys) All verticals are starting to want/need parallel programming Parallel programming can be leveraged well in some cloud scenarios
  • 6. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Beijing National Stadium - a.k.a “Bird’s Nest”
  • 7. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
  • 8. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Concurrency • GOAL: Prevent thread starvation • concept related to multitasking and asynchronous input-output (I/O) • existence of multiple threads of execution that may each get a slice of time to execute before being preempted by another thread Parallelism • GOAL: Maximize processor usage across all available cores • concurrent threads execute at the same time across cores • focuses on improving the performance of applications that use a lot of processor power and are not constantly interrupted when multiple cores are available.
  • 9. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 9
  • 10. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only TPL for .net MPL Express/JFFP RiverTrail for Javascript
  • 11. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Decomposition Coordination Scalable Sharing
  • 12. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 12 • Too fine = overhead to manage will become to much • Too course = parallel opportunities will be lost Identify tasks at a level of granularity that results in efficient use of hardware resources. • They should remain independent of each other, and have enough tasks to keep the cores busy Tasks should be as large as possible • Dedicate some time to understand these components. Decomposing a problem into tasks requires a good understanding of the algorithmic and structural aspects of your application.
  • 13. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Sean’s General Rule of thumb: If iteration takes longer than 1 minute, review further.
  • 14. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 14 Coordination depends on specifically which parallel patterns you use to implement Application algorithms are constrained by order of execution and degree of parallelism • Constraints can come from data flow or control flow. The Futures pattern uses Continuation to manage coordination. • Make sure that you understand any coordination, before modifying you application. Mapping out dependencies in a graph or inheritance tree helps truly understand the landscape
  • 15. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 15 Limit your shared variables Use immutable data when you can Introduce new steps in your algorithm that merge local versions of mutable state at checkpoints Adding synchronization reduces the parallelism of your application.
  • 16. Parallel Loop Parallel Tasks Parallel Aggregation Futures Pipelines
  • 17. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 17 Do you have sequential loops where there's no communication among the steps of each iteration? Use the Parallel Loop pattern
  • 18. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Parallel loops apply an independent operation to multiple inputs simultaneously. Very similar to for and foreach. Sequence in the collection will not matter. Do not replace all for and for each loops with the parallel equivalent. You will get into trouble
  • 19. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
  • 20. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No – array cannot be divided into parts that can be sorted independently. No, because the sum of the entire collection is needed, not the sums of separate parts. Yes, because each slide can be considered independently.
  • 21. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 21 Do you have distinct operations with well- defined control dependencies and are these operations largely free of serializing dependencies? Use the Parallel Task pattern
  • 22. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only • Sometimes referred to as Fork/Join pattern or the Master/Worker pattern. Parallel Tasks allow you to establish parallel control flow in the style of fork and join. • Don’t assume that all parallel tasks will immediately run. That is up to the scheduler. You can wait for a single task or multiple tasks.
  • 23. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
  • 24. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 24 Do you need to summarize data by applying some kind of combination operator? Do you have loops with steps that are not fully independent? Use the Parallel Aggregation pattern
  • 25. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Introduces special steps in the algorithm for merging partial results. This pattern expresses a reduction operation and includes map/reduce as one of its variations Uses unshared, local variables that are merged at the end of the computation to give the final result a.k.a. as The Parallel Reduction pattern because it combines multiple inputs into a single output
  • 26. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
  • 27. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
  • 28. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 28 Does the ordering of steps in your algorithm depend on data flow constraints? Use the Futures pattern
  • 29. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Makes the data flow dependencies between tasks explicit. A future is a stand-in for a computational result that is initially unknown but becomes known The Futures pattern integrates task parallelism with the familiar world of arguments and return values If a task in the chain is depending on another to finish, it will block. The core will be available for other tasks. a.k.a Task Graph pattern.
  • 30. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 30 F1 F2 F3 F4 F5 F6 F1 F2 F3 F4 F5 F6 Method Chain Method Chain using Futures
  • 31. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
  • 32. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 32 Does your application perform a sequence of operations repetitively? Does the order of processing matter? Use the Pipeline pattern
  • 33. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Pipelines consist of components that are connected by queues, in the style of producers and consumers. All the components run in parallel even though the order of inputs is respected. Analogous to assembly lines in a factory Pipelines allow you to use parallelism in cases where there are too many dependencies to use a parallel loop
  • 34. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only No. 34
  • 35. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only
  • 37. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only Concurrency Visualizer Debugging Parallel Stacks Windows Parallel Tasks Windows
  • 38. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only • Parallel Programming is expected in most software • Clearly understand the core design aspects • Decomposition • Coordination • Scalable Sharing • Get to know the 5 key parallel patterns • Parallel Loop • Parallel Tasks • Parallel Aggregation • Futures • Pipelines • Leverage industry tooling to make you experience easier.
  • 39. © Copyright 2012 Avanade Inc. All Rights Reserved. Confidential For Internal Use Only