Threads are a first-class citizen concept of modern operating systems and their model has been used for decades to implement the concurrent execution of different sets of instructions. In a very simplistic way, you can think of threads as independently executed lists of instructions—there is a sequence in each list but they are independent of each other.
In this section, we will learn about the TThread class. We will also understand the thread's lifespan. We are going to familiarize ourselves a bit with the Parallel Programming Library, along with synchronization.
Other conceptualizations may render threads as independent agents executing their own program within the main program. In the end, they represent a way to organize code execution in order to do the following:
- Take advantage of full hardware resources (modern CPUs have multiple processors/cores)
- Deal with UI responsiveness
- Deal with asynchronous operations (those operations have...