We have used the
BackgroundWorker component combined with the
Thread class to provide fast execution and UI feedback. Now, we will combine multiple
Thread class instances with many
BackgroundWorker components to create an application that runs as fast as possible on modern computer architectures. In fact, it will inspect the computer it is running on and create an encryption thread for each processing core the computer has. This will maximize the performance without creating extra threads that will not further improve performance.
We will work with dynamic lists and the
Environment.ProcessorCount property to create threads on the fly according to the number of cores on the machine. However, we need some technique to ...