27 Shared memory Read / Modify / Write Increment / Decrement Simultaneously reading and writing into a listTList, TStringList, TList<T>, …Arrays are usually fineDon’t access same element from two threadsElement size >= SizeOf(pointer)
34 OmniThreadLibrary is … … VCL for multithreadingSimplifies programming tasksComponentizes solutionsAllows access to the bare metal… trying to make multithreading possible for mere mortals… providing well-tested components packed in reusable classes with high-level parallel programming support
35 Project Status http://www.omnithreadlibrary.com Delphi 2007 → OpenBSD licenseActively usedhttps://leanpub.com/omnithreadlibraryGoogle+ community
47 Future Wikipedia Start background calculation, wait on result. “They (futures) describe an object that acts as a proxy for a result that is initially not known, usually because the computation of its value has not yet completed.”Start background calculation, wait on result.
48 future Future:= Parallel.Future<type> (calculation); Value := Future.Value;
60 Words of wisdom“New programmers are drawn to multithreading like moths to flame, with similar results.”- Danny Thorpe
61 Keep in mind Never use VCL from a background thread! Don’t parallelize everythingDon’t create thousands of threadsRethink the algorithmProve the improvementsTest, test and test
62 Be afraid Designing parallel solutions is hard Writing multithreaded code is hardTesting multicore applications is hardDebugging multithreading code is pure insanityDebugging high-level abstractions is just hard