DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
volatile auto x = 1;
for (auto i = 0; i < 800000000 / MAX_THREADS;
It all depends on what your threads are doing.
Your computer can only concurrently run as many threads as there are cores in the system. This includes virtual cores via features like Hyper-threading.
If your threads are CPU-bound, (meaning they spend the vast majority of their time doing calculations on data that is in memory), you will see little improvement by increasing the number of threads above the number of cores. You actually lose efficiency with more threads running, because of the added overhead of having to context-swtich the threads on and off the CPU cores.
Where (#threads > #cores) will help, is when your threads are I/O-bound, meaning they spend most of their time waiting on I/O, (hard disk, network, other hardware, etc.) In this case, a thread that is blocked waiting on I/O to complete will be pulled off the CPU, and a thread that is actually ready to do something will be put on instead.
The way to get highest efficiency is to always keep the CPU busy with a thread that's actually doing something. (Not waiting on something, and not context-switching to other threads.)