You need to write a small application that will handle a huge number of files (40-50 thousand)
To improve performance, multithreading is needed, but how should it be implemented? 40 thousand threads is a bad option.
You need to write a small application that will handle a huge number of files (40-50 thousand)
To improve performance, multithreading is needed, but how should it be implemented? 40 thousand threads is a bad option.
The general rule is that there should be no more threads than cores / processors - this time (otherwise switching will eat all the benefits ... exception - when threads often expect something), and second, if all threads are actively working with the disk, I'm afraid the benefits of multithreading may not be at all - each thread will pull the disk in its own direction. The answer, in fact, is one - experiment, profiling.
Source: https://ru.stackoverflow.com/questions/619838/
All Articles