I have a program structured as follows, and it's a massive CPU hog. IO slows down for the whole system, I can hardly move the mouse pointer...
...why? I thought THREAD_MODE_BACKGROUND_BEGIN should prevent this?
#pragma omp parallel
{
SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN);
#pragma omp for
for (...)
{
doTruckLoadsOfComputation();
if (omp_get_thread_num()==0)
doTinyAmountOfIO(); //progress indicator
}
SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_END);
}
UPDATE:
Adding SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
fixes the CPU hogging issue but the question still stands, why wasn't background mode alone sufficient?