Movatterモバイル変換


[0]ホーム

URL:


SlideShare a Scribd company logo

Patterns of parallel programming

Download as PPTX, PDF
0 likes2,765 views
Alex Tumanoff
Alex Tumanoff

This document discusses patterns of parallel programming. It begins by explaining why parallel programming is necessary due to limitations of Moore's Law like power consumption and wire delays. It then covers key terms and measures for parallel programming like work, span, speedup and parallelism. Common patterns are overviewed like pipeline, producer-consumer, and Map-Reduce. It warns of dangers like race conditions, deadlocks and starvation. Finally, it provides references for further reading on parallel programming patterns and approaches.

1 of 19
Downloaded 21 times
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Patterns of Parallel  ProgrammingPrepared by Yan Drugalya ydrugalya@gmail.com      @ydrugalya
Agenda•   Why parallel?•   Terms and measures•   Building Blocks•   Patterns overview    – Pipeline and data flow    – Producer-Consumer    – Map-Reduce    – Other
Why Moore's law is not working               anymore•   Power consumption•   Wire delays•   DRAM access latency•   Diminishing returns of more instruction-level    parallelism
Power consumption                                                                                      Sun’s Surface                        10,000                         1,000                                          Rocket NozzlePower Density (W/cm2)                          100                               Nuclear Reactor                           10                            Pentium® processors                                                                               Hot Plate                            1                                   8080                             ‘70             ‘80   ’90               ’00                        ‘10
Wire delays
Diminishing returns• 80’s  – 10 CPI  1 CPI• 90  – 1 CPI  0.5CPI• 00’s: multicore
No matter how fast processors get, softwareconsistently finds new ways to eat up the extraspeed.                                 Herb Sutter
Survival To scale performance, put many processing cores on the  microprocessor chip New Moore’s law edition is about doubling of cores.
Terms & Measures•   Work = T1•   Span = T∞•   Work Law: Tp>=T1/P•   Span Law: Tp>=T∞•   Speedup: Tp/T1    – Linear: θ(P)    – Perfect: P• Parallelism: T1/T∞• Tp<=(T1-T∞)/P + T∞
Definitions• Concurrent  - Several things happenings at the same time• Multithreaded  – Multiple execution contexts• Parallel  – Multiple simultaneous computations• Asynchronous  – Not having to wait
Dangers•   Race Conditions•   Starvations•   Deadlocks•   Livelock•   Optimizing compilers•   …
Data parallelismParallel.ForEach(letters, ch => Capitalize(ch));
Task parallelismParallel.Invoke(() => Average(), () => Minimum() …);
Fork-Join • Additional work may be started only when specific subsets of   the original elements have completed processing • All elements should be given the chance to run even if one   invocation fails (Ping)                               Parallel.Invoke(                                   () => ComputeMean(),            Fork                   () => ComputeMedian(),                                   () => ComputeMode());Compute   Compute   Compute    static void MyParallelInvoke(params Action[] actions) Median    Mean      Mode      {                                    var tasks = new Task[actions.Length];                                    for (int i = 0; i < actions.Length; i++)                                            tasks[i] = Task.Factory.StartNew(actions[i]);            Join                    Task.WaitAll(tasks);                               }
Pipeline pattern             Task<int> T1 = Task.Factory.StartNew(() =>Task 1           { return result1(); });             Task<double> T2 = T1.ContinueWith((antecedent) =>Task 2           { return result2(antecedent.Result); });             Task<double> T3 = T2.ContinueWith((antecedent) =>Task 3           { return result3(antecedent.Result); });
Producer/Consumer    Disk/Net                   Read 1   Read 2    Read 3BlockingCollection<T>       Process   Process   Process
Patterns of parallel programming
Other patterns• Speculative Execution• APM (IAsyncResult, Begin/end pairs)• EAP(Operation/Callback pairs)
References• Patterns for Parallel Programming: Understanding and Applying  Parallel Patterns with the .NET Framework 4• Pluralsight:   – Introduction to Async and Parallel Programming in .NET 4   – Async and Parallel Programming: Application Design• The Free Lunch Is Over: A Fundamental Turn Toward  Concurrency in Software• Chapter 27 Multithreaded Algorithms from Introduction to  algorithms 3rd edition
Ad

Recommended

PPTX
Sql saturday azure storage by Anton Vidishchev
Alex Tumanoff
 
PDF
LOAD BALANCING ALGORITHM TO IMPROVE RESPONSE TIME ON CLOUD COMPUTING
ijccsa
 
PPT
Load Balancing In Cloud Computing newppt
Utshab Saha
 
PDF
Terror & Hysteria: Cost Effective Scaling of Time Series Data with Cassandra ...
DataStax
 
PPTX
Slide #1:Introduction to Apache Storm
Md. Shamsur Rahim
 
PPTX
Multi-tenant Apache Storm as a service
Robert Evans
 
PPTX
IMC Summit 2016 Breakout - Girish Kathalagiri - Decision Making with MLLIB, S...
In-Memory Computing Summit
 
PPTX
System Design & Scalability
John DiFini
 
PDF
MapR Tutorial Series
selvaraaju
 
PDF
Storm: Distributed and fault tolerant realtime computation
Ferran Galí Reniu
 
PDF
Apache Storm
Nguyen Quang
 
PPTX
GoodFit: Multi-Resource Packing of Tasks with Dependencies
DataWorks Summit/Hadoop Summit
 
PDF
Prometheus and Thanos
CloudOps2005
 
PPTX
Storm
Pouyan Rezazadeh
 
PPTX
Multi-Tenant Storm Service on Hadoop Grid
DataWorks Summit
 
PPTX
Resource Aware Scheduling in Apache Storm
DataWorks Summit/Hadoop Summit
 
PDF
Distributed real time stream processing- why and how
Petr Zapletal
 
PDF
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
GeeksLab Odessa
 
PPTX
Apache Storm Internals
Humoyun Ahmedov
 
PDF
Apache Storm Tutorial
Farzad Nozarian
 
PPT
Real-Time Streaming with Apache Spark Streaming and Apache Storm
Davorin Vukelic
 
PPTX
Spark vs storm
Trong Ton
 
PDF
One Grid to rule them all: Building a Multi-tenant Data Cloud with YARN
DataWorks Summit
 
PPTX
NYC Hadoop Meetup - MapR, Architecture, Philosophy and Applications
Jason Shao
 
PPTX
Cassandra and Storm at Health Market Sceince
P. Taylor Goetz
 
PDF
Kubernetes Observability with Prometheus by Example
Thomas Riley
 
PPTX
Hadoop performance optimization tips
Subhas Kumar Ghosh
 
PDF
Real-time Big Data Processing with Storm
viirya
 
PPTX
Object-2-Object mapping, как приправа к вашему проекту
Alex Tumanoff
 

More Related Content

What's hot(20)

PDF
MapR Tutorial Series
selvaraaju
 
PDF
Storm: Distributed and fault tolerant realtime computation
Ferran Galí Reniu
 
PDF
Apache Storm
Nguyen Quang
 
PPTX
GoodFit: Multi-Resource Packing of Tasks with Dependencies
DataWorks Summit/Hadoop Summit
 
PDF
Prometheus and Thanos
CloudOps2005
 
PPTX
Storm
Pouyan Rezazadeh
 
PPTX
Multi-Tenant Storm Service on Hadoop Grid
DataWorks Summit
 
PPTX
Resource Aware Scheduling in Apache Storm
DataWorks Summit/Hadoop Summit
 
PDF
Distributed real time stream processing- why and how
Petr Zapletal
 
PDF
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
GeeksLab Odessa
 
PPTX
Apache Storm Internals
Humoyun Ahmedov
 
PDF
Apache Storm Tutorial
Farzad Nozarian
 
PPT
Real-Time Streaming with Apache Spark Streaming and Apache Storm
Davorin Vukelic
 
PPTX
Spark vs storm
Trong Ton
 
PDF
One Grid to rule them all: Building a Multi-tenant Data Cloud with YARN
DataWorks Summit
 
PPTX
NYC Hadoop Meetup - MapR, Architecture, Philosophy and Applications
Jason Shao
 
PPTX
Cassandra and Storm at Health Market Sceince
P. Taylor Goetz
 
PDF
Kubernetes Observability with Prometheus by Example
Thomas Riley
 
PPTX
Hadoop performance optimization tips
Subhas Kumar Ghosh
 
PDF
Real-time Big Data Processing with Storm
viirya
 
MapR Tutorial Series
selvaraaju
 
Storm: Distributed and fault tolerant realtime computation
Ferran Galí Reniu
 
Apache Storm
Nguyen Quang
 
GoodFit: Multi-Resource Packing of Tasks with Dependencies
DataWorks Summit/Hadoop Summit
 
Prometheus and Thanos
CloudOps2005
 
Multi-Tenant Storm Service on Hadoop Grid
DataWorks Summit
 
Resource Aware Scheduling in Apache Storm
DataWorks Summit/Hadoop Summit
 
Distributed real time stream processing- why and how
Petr Zapletal
 
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
GeeksLab Odessa
 
Apache Storm Internals
Humoyun Ahmedov
 
Apache Storm Tutorial
Farzad Nozarian
 
Real-Time Streaming with Apache Spark Streaming and Apache Storm
Davorin Vukelic
 
Spark vs storm
Trong Ton
 
One Grid to rule them all: Building a Multi-tenant Data Cloud with YARN
DataWorks Summit
 
NYC Hadoop Meetup - MapR, Architecture, Philosophy and Applications
Jason Shao
 
Cassandra and Storm at Health Market Sceince
P. Taylor Goetz
 
Kubernetes Observability with Prometheus by Example
Thomas Riley
 
Hadoop performance optimization tips
Subhas Kumar Ghosh
 
Real-time Big Data Processing with Storm
viirya
 

Viewers also liked(10)

PPTX
Object-2-Object mapping, как приправа к вашему проекту
Alex Tumanoff
 
PPTX
Bdd by Dmitri Aizenberg
Alex Tumanoff
 
PPTX
Navigation map factory by Alexey Klimenko
Alex Tumanoff
 
PPTX
Microsoft Office 2013 новая модель разработки приложений
Alex Tumanoff
 
PPTX
Deep Dive C# by Sergey Teplyakov
Alex Tumanoff
 
PPTX
Anti patterns
Alex Tumanoff
 
PPT
"Drools: декларативная бизнес-логика в Java-приложениях" by Дмитрий Контрерас...
Alex Tumanoff
 
PPTX
Async clinic by by Sergey Teplyakov
Alex Tumanoff
 
PPTX
Mono
Yan Drugalya
 
Object-2-Object mapping, как приправа к вашему проекту
Alex Tumanoff
 
Bdd by Dmitri Aizenberg
Alex Tumanoff
 
Navigation map factory by Alexey Klimenko
Alex Tumanoff
 
Microsoft Office 2013 новая модель разработки приложений
Alex Tumanoff
 
Deep Dive C# by Sergey Teplyakov
Alex Tumanoff
 
Anti patterns
Alex Tumanoff
 
"Drools: декларативная бизнес-логика в Java-приложениях" by Дмитрий Контрерас...
Alex Tumanoff
 
Async clinic by by Sergey Teplyakov
Alex Tumanoff
 
Ad

Similar to Patterns of parallel programming(20)

PPTX
Multicore programmingandtpl
Yan Drugalya
 
PDF
Arc 300-3 ade miller-en
lonegunman
 
PPTX
Multicore programmingandtpl(.net day)
Yan Drugalya
 
PPTX
Thinking in parallel ab tuladev
Pavel Tsukanov
 
PDF
Parallel Programming in .NET
SANKARSAN BOSE
 
PPTX
20090720 smith
Michael Karpov
 
PDF
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
foegeartemfz
 
PPTX
Architecting Solutions for the Manycore Future
Talbott Crowell
 
PPT
Overview Of Parallel Development - Ericnel
ukdpe
 
PPTX
Tech Ed09 India Ver M New
rsnarayanan
 
PPTX
Retargeting Embedded Software Stack for Many-Core Systems
Sumant Tambe
 
PPT
Parallel architecture
Mr SMAK
 
PPTX
Natural Laws of Software Performance
Gibraltar Software
 
PPTX
Overview Of Parallel Development - Ericnel
ukdpe
 
PPTX
Unit 1 deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep.pptx
chingcho417
 
PDF
Tim - FSharp
d0nn9n
 
PPTX
Introduction to Parallel Computing
Roshan Karunarathna
 
PPT
Google: Cluster computing and MapReduce: Introduction to Distributed System D...
tugrulh
 
PDF
chap2_slidesforparallelcomputingananthgarama
doomzday27
 
PDF
Report on High Performance Computing
Prateek Sarangi
 
Multicore programmingandtpl
Yan Drugalya
 
Arc 300-3 ade miller-en
lonegunman
 
Multicore programmingandtpl(.net day)
Yan Drugalya
 
Thinking in parallel ab tuladev
Pavel Tsukanov
 
Parallel Programming in .NET
SANKARSAN BOSE
 
20090720 smith
Michael Karpov
 
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
foegeartemfz
 
Architecting Solutions for the Manycore Future
Talbott Crowell
 
Overview Of Parallel Development - Ericnel
ukdpe
 
Tech Ed09 India Ver M New
rsnarayanan
 
Retargeting Embedded Software Stack for Many-Core Systems
Sumant Tambe
 
Parallel architecture
Mr SMAK
 
Natural Laws of Software Performance
Gibraltar Software
 
Overview Of Parallel Development - Ericnel
ukdpe
 
Unit 1 deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep.pptx
chingcho417
 
Tim - FSharp
d0nn9n
 
Introduction to Parallel Computing
Roshan Karunarathna
 
Google: Cluster computing and MapReduce: Introduction to Distributed System D...
tugrulh
 
chap2_slidesforparallelcomputingananthgarama
doomzday27
 
Report on High Performance Computing
Prateek Sarangi
 
Ad

More from Alex Tumanoff(20)

PPTX
Sql server 2019 New Features by Yevhen Nedaskivskyi
Alex Tumanoff
 
PPTX
Odessa .net-user-group-sql-server-2019-hidden-gems by Denis Reznik
Alex Tumanoff
 
PPTX
Azure data bricks by Eugene Polonichko
Alex Tumanoff
 
PPTX
Sdlc by Anatoliy Anthony Cox
Alex Tumanoff
 
PPTX
Kostenko ux november-2014_1
Alex Tumanoff
 
PPTX
Java 8 in action.jinq.v.1.3
Alex Tumanoff
 
PPTX
Spring.new hope.1.3
Alex Tumanoff
 
PPTX
Serialization and performance by Sergey Morenets
Alex Tumanoff
 
PPTX
Игры для мобильных платформ by Алексей Рыбаков
Alex Tumanoff
 
PDF
Android sync adapter
Alex Tumanoff
 
PPTX
Неформальные размышления о сертификации в IT
Alex Tumanoff
 
PPTX
Разработка расширений Firefox
Alex Tumanoff
 
PPTX
"AnnotatedSQL - провайдер с плюшками за 5 минут" - Геннадий Дубина, Senior So...
Alex Tumanoff
 
PPTX
Lambda выражения и Java 8
Alex Tumanoff
 
PPTX
XP практики в проектах с тяжелой наследственностью
Alex Tumanoff
 
PPTX
Первые шаги во фрилансе
Alex Tumanoff
 
PPTX
Spring Web Flow. A little flow of happiness.
Alex Tumanoff
 
PPTX
Какой фреймворк нам нужен для Web? Денис Цыплаков
Alex Tumanoff
 
PDF
Distilled mongo db by Boris Trofimov
Alex Tumanoff
 
PPT
Enterprise or not to enterprise
Alex Tumanoff
 
Sql server 2019 New Features by Yevhen Nedaskivskyi
Alex Tumanoff
 
Odessa .net-user-group-sql-server-2019-hidden-gems by Denis Reznik
Alex Tumanoff
 
Azure data bricks by Eugene Polonichko
Alex Tumanoff
 
Sdlc by Anatoliy Anthony Cox
Alex Tumanoff
 
Kostenko ux november-2014_1
Alex Tumanoff
 
Java 8 in action.jinq.v.1.3
Alex Tumanoff
 
Spring.new hope.1.3
Alex Tumanoff
 
Serialization and performance by Sergey Morenets
Alex Tumanoff
 
Игры для мобильных платформ by Алексей Рыбаков
Alex Tumanoff
 
Android sync adapter
Alex Tumanoff
 
Неформальные размышления о сертификации в IT
Alex Tumanoff
 
Разработка расширений Firefox
Alex Tumanoff
 
"AnnotatedSQL - провайдер с плюшками за 5 минут" - Геннадий Дубина, Senior So...
Alex Tumanoff
 
Lambda выражения и Java 8
Alex Tumanoff
 
XP практики в проектах с тяжелой наследственностью
Alex Tumanoff
 
Первые шаги во фрилансе
Alex Tumanoff
 
Spring Web Flow. A little flow of happiness.
Alex Tumanoff
 
Какой фреймворк нам нужен для Web? Денис Цыплаков
Alex Tumanoff
 
Distilled mongo db by Boris Trofimov
Alex Tumanoff
 
Enterprise or not to enterprise
Alex Tumanoff
 

Patterns of parallel programming

  • 1.Patterns of Parallel ProgrammingPrepared by Yan Drugalya ydrugalya@gmail.com @ydrugalya
  • 2.Agenda• Why parallel?• Terms and measures• Building Blocks• Patterns overview – Pipeline and data flow – Producer-Consumer – Map-Reduce – Other
  • 3.Why Moore's law is not working anymore• Power consumption• Wire delays• DRAM access latency• Diminishing returns of more instruction-level parallelism
  • 4.Power consumption Sun’s Surface 10,000 1,000 Rocket NozzlePower Density (W/cm2) 100 Nuclear Reactor 10 Pentium® processors Hot Plate 1 8080 ‘70 ‘80 ’90 ’00 ‘10
  • 6.Diminishing returns• 80’s – 10 CPI  1 CPI• 90 – 1 CPI  0.5CPI• 00’s: multicore
  • 7.No matter how fast processors get, softwareconsistently finds new ways to eat up the extraspeed. Herb Sutter
  • 8.Survival To scale performance, put many processing cores on the microprocessor chip New Moore’s law edition is about doubling of cores.
  • 9.Terms & Measures• Work = T1• Span = T∞• Work Law: Tp>=T1/P• Span Law: Tp>=T∞• Speedup: Tp/T1 – Linear: θ(P) – Perfect: P• Parallelism: T1/T∞• Tp<=(T1-T∞)/P + T∞
  • 10.Definitions• Concurrent - Several things happenings at the same time• Multithreaded – Multiple execution contexts• Parallel – Multiple simultaneous computations• Asynchronous – Not having to wait
  • 11.Dangers• Race Conditions• Starvations• Deadlocks• Livelock• Optimizing compilers• …
  • 13.Task parallelismParallel.Invoke(() => Average(), () => Minimum() …);
  • 14.Fork-Join • Additional work may be started only when specific subsets of the original elements have completed processing • All elements should be given the chance to run even if one invocation fails (Ping) Parallel.Invoke( () => ComputeMean(), Fork () => ComputeMedian(), () => ComputeMode());Compute Compute Compute static void MyParallelInvoke(params Action[] actions) Median Mean Mode { var tasks = new Task[actions.Length]; for (int i = 0; i < actions.Length; i++) tasks[i] = Task.Factory.StartNew(actions[i]); Join Task.WaitAll(tasks); }
  • 15.Pipeline pattern Task<int> T1 = Task.Factory.StartNew(() =>Task 1 { return result1(); }); Task<double> T2 = T1.ContinueWith((antecedent) =>Task 2 { return result2(antecedent.Result); }); Task<double> T3 = T2.ContinueWith((antecedent) =>Task 3 { return result3(antecedent.Result); });
  • 16.Producer/Consumer Disk/Net Read 1 Read 2 Read 3BlockingCollection<T> Process Process Process
  • 18.Other patterns• Speculative Execution• APM (IAsyncResult, Begin/end pairs)• EAP(Operation/Callback pairs)
  • 19.References• Patterns for Parallel Programming: Understanding and Applying Parallel Patterns with the .NET Framework 4• Pluralsight: – Introduction to Async and Parallel Programming in .NET 4 – Async and Parallel Programming: Application Design• The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software• Chapter 27 Multithreaded Algorithms from Introduction to algorithms 3rd edition

[8]ページ先頭

©2009-2025 Movatter.jp