Exploring the Parallel Programming Library
On top of this core foundation, Delphi offers the more abstract Parallel Programming Library (PPL). This library allows you to express your application logic in a way that is less tied to the actual hardware and the capabilities of the CPU the program is running into. To clarify, the core element of the PPL is the TTask
class; this is conceptually similar to a thread but abstracted from the hardware. For example, if you create 20 threads, you are making requests to the operating system and the CPU. If you create 20 tasks, the PPL will create some threads in a pool, depending on the CPU multicore capabilities, and assign tasks to those threads, without overloading the CPU. Also, reusing threads saves time, as thread creation is a heavy operation at the operating system level.
The very first thing to do in order to use the PPL is to add the System.Threading
unit to the uses
clause of your program. As mentioned, on behalf of the app, the library...