If you want to achieve high performance in computing, you will need to run tasks concurrently. Whether you are running complex computations that take days, such as machine learning training, or you are running a web server that needs to respond to thousands of requests per second, you will need to do more than one thing at the same time.
Thankfully, as we have already seen, our processors and operating systems are prepared for concurrency, and in fact, multithreading is a great way to achieve it. The main issue is that as we saw in the previous chapter, we should not be using more threads than logical CPUs in our computer.
We can, of course, but some threads will be waiting for others to execute, and the kernel will be orchestrating how much time each thread gets in the CPU. This will consume even more resources and make the overall process slower. It can sometimes be useful, though, to have more threads than the number of cores. Maybe some of them...