High-level%20Multithreaded%20Programming%20[Part%20III] - PowerPoint PPT Presentation

About This Presentation
Title:

High-level%20Multithreaded%20Programming%20[Part%20III]

Description:

HIGH-LEVEL MULTITHREADED PROGRAMMING [PART III] Primo Gabrijel i BACKGROUND INFORMATION About Me Primo Gabrijel i Programmer, consultant, writer, speaker ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 21
Provided by: omnit2
Category:

less

Transcript and Presenter's Notes

Title: High-level%20Multithreaded%20Programming%20[Part%20III]


1
High-level Multithreaded Programming Part III
  • Primož Gabrijelcic

2
Background Information
3
About Me
  • Primož Gabrijelcic
  • Programmer, consultant, writer, speaker
  • thedelphigeek.com
  • www.glagolite.si/delphi
  • Hacking multithreaded code since 1999

4
About OmniThreadLibrary
  • VCL for multithreading
  • Delphi 2007 XE34
  • Open source OpenBSD license
  • www.omnithreadlibrary.com
  • omnithreadlibrary.googlecode.com
  • Win32/Win64

5
About the Webinars
  • Code and video www.omnithreadlibrary.com/webinars
  • Code free, video 10
  • 20 free books, courtesy of the De Novo Software,
    www.denovosoftware.com

6
High-Level Abstractions
  • ParallelTask
  • BackgroundWorker
  • Pipeline
  • ForkJoin
  • Async /Await
  • Future
  • Join
  • ForEach

7
Which abstraction to use?
  • Consider data flow!

8
High-Level Abstractions
  • ParallelTask
  • BackgroundWorker
  • ForkJoin
  • Pipeline
  • Async /Await
  • Future
  • Join
  • ForEach

Parallel iteration over data
9
ForEach
10
Iterate over
  • Integer range
  • Enumerable collection (TStringList )
  • Thread-safe enumerable collection (OTL)
  • Blocking collection (IOmniBlockingCollection)
  • Anything
  • Custom enumerator function
  • Main program writing into a blocking collection

11
Special features
  • Synchronized access to data
  • Data prefetching
  • Work stealing
  • Optional output ordering
  • Aggregation

12
Aggregation
  • aggregate initial value
  • for each value in source
  • Execute(value, result)
  • if not result.IsEmpty then
  • Agreggator(aggregate, value)

13
Demos
  • 35_ParallelFor
  • 36_ParallelAggregate
  • 38_OrderedFor

14
High-Level Abstractions
  • ParallelTask
  • BackgroundWorker
  • ForkJoin
  • Pipeline
  • Async /Await
  • Future
  • Join
  • ForEach

Parallelization of multistage operations
15
Pipeline
16
Example
17
Web Spider
18
Parting Notes
19
Keep in Mind
  • Dont parallelize everything
  • Rethink the algorithm
  • Data flow dictates the abstraction
  • Measure the improvements
  • Test, test and test

20
Code
  • Will be available shortly at
  • www.omnithreadlibrary.com/webinars
Write a Comment
User Comments (0)
About PowerShow.com