![Page 1: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/1.jpg)
Parallel Programming with OmniThreadLibraryPrimož Gabrijelčič
![Page 2: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/2.jpg)
Primož Gabrijelčič
programmer, consultant, speaker, trainer
Delphi / Smart Mobile Studio
Email: [email protected]: @thedelphigeekSkype: gabr42
The Delphi Geek – http://www.thedelphigeek.comSmart Programmer – http://www.smartprogrammer.org
![Page 3: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/3.jpg)
![Page 4: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/4.jpg)
What is OmniThreadLibrary?
![Page 5: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/5.jpg)
OmniThreadLibrary is …
• … VCL for multithreading• … released under an open license• … actively developed• … frequently used• … available in Delphis from 2007 to XE3– Windows 32- or 64-bit, VCL only
![Page 6: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/6.jpg)
How do I learn more?
![Page 7: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/7.jpg)
OmniThreadLibrary on the web
• Home: otl.17slon.com• Code: omnithreadlibrary.googlecode.com• Book: leanpub.com/omnithreadlibrary• Wiki: otl.17slon.com/book• Support: otl.17slon.com/forum
![Page 8: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/8.jpg)
How do I execute long operation in background
and run some code in the main thread after the
long operation has finished?
![Page 9: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/9.jpg)
Async/Await
Initialization
Cleanup
Long operation
![Page 10: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/10.jpg)
How do I run long calculation in background and
process the result in the main thread?
![Page 11: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/11.jpg)
Future
Use result
Long calculation
![Page 12: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/12.jpg)
How do I run same background operation in
multiple simultaneous copies processing an
input?
![Page 13: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/13.jpg)
Background Worker
Data
Process
Result
Process Process
Process Process
![Page 14: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/14.jpg)
How do I parallelize a process that executes in
multiple stages?
![Page 15: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/15.jpg)
Pipeline
Data
Stage 1
Result
Stage 2Stage 3Stage 4
![Page 16: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/16.jpg)
How do I work with databases in multithreaded
environment?
![Page 17: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/17.jpg)
Databases
GUI
Database AccessFrame
Frame
![Page 18: Parallel Programming with OmniThreadLibrary Primož Gabrijelčič](https://reader035.vdocuments.us/reader035/viewer/2022062221/56649c925503460f9494e0f4/html5/thumbnails/18.jpg)
Questions?