...

/

Thread Pooling

Thread Pooling

Utilize existing background threads instead of spinning new ones.

We'll cover the following...

Introduction

Having multiple threads expedites application execution, in theory. The program would use the CPU’s multiple cores. However, the practical benefit of multithreading depends on a number of factors. First of all, creating and starting a thread is a taxing operation. If our program is constantly instantiating the Thread class in an effort to parallelize the execution of several methods, run a single method several times in parallel, or perform some long-running jobs in the background, we can be sure that performance will be affected (not always in a good way). Secondly, constant context switching negatively affects performance.

When we need ...