1 / 19

High-level Multithreaded Programming [Part II]

High-level Multithreaded Programming [Part II]. Primo ž Gabrijelčič. Background Information. About Me. Primo ž Gabrijelčič Programmer, consultant, writer, speaker thedelphigeek.com www.glagolite.si/delphi Hacking multithreaded code since 1999. About OmniThreadLibrary.

amal
Download Presentation

High-level Multithreaded Programming [Part II]

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. High-level Multithreaded Programming [Part II] Primož Gabrijelčič

  2. Background Information

  3. About Me • Primož Gabrijelčič • Programmer, consultant, writer, speaker • thedelphigeek.com • www.glagolite.si/delphi • Hacking multithreaded code since 1999

  4. About OmniThreadLibrary • „VCL for multithreading“ • Delphi 2007 – XE3[4] • 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 • ForkJoin • Pipeline • Async [/Await] • Future • Join • ForEach

  7. High-Level Abstractions • ParallelTask • BackgroundWorker • ForkJoin • Pipeline • Async [/Await] • Future • Join • ForEach • Start multiple background tasks [and wait]

  8. Join

  9. High-Level Abstractions • ParallelTask • BackgroundWorker • ForkJoin • Pipeline • Async [/Await] • Future • Join • ForEach Start multiple copies of a single task

  10. ParallelTask

  11. High-Level Abstractions • ParallelTask • BackgroundWorker • ForkJoin • Pipeline • Async [/Await] • Future • Join • ForEach • Background request-processing service

  12. Background Worker

  13. BackgroundWorker Usage • service := Paralell.BackgroundWorker.OnRequestDone(code1).Execute(code2); • workItem := service.CreateWorkItem(data); • service.Schedule(workItem) • service.Terminate; service := nil;

  14. High-Level Abstractions • ParallelTask • BackgroundWorker • ForkJoin • Pipeline • Async [/Await] • Future • Join • ForEach • Divide and conquer

  15. Fork/Join

  16. Fork/Join Usage • computation := Parallel.ForkJoin; • compute1 := computation.Compute(action); • Inside action: computation.Compute(newAction) • compute2 := computation.Compute(action); • compute1.Value / compute1.Await • compute2.Value / compute2.Await

  17. Parting Notes

  18. Keep in Mind • Don’t parallelize everything • Rethink the algorithm • Data flow dictates the abstraction • Measure the improvements • Test, test and test

  19. Code & Video • Will be available shortly at www.omnithreadlibrary.com/webinars

More Related