June 2019
Intermediate to advanced
218 pages
5h 19m
English
Threads are sequences of computation that can run independently on a CPU core, simultaneously with other such sequences. So, one of the first questions we need to ask ourselves is: how many threads should we have? Unlike tasks, which are lightweight, threads need to store some state when they are switched. Thus, while you can have hundreds or thousands of tasks in your program, you should only have a limited number of threads. The general advice is that the number of threads should correspond directly to the number of CPU cores you have.
Read now
Unlock full access