7

Using an I9-12900KS intel cpu, 128gb ram, Asus Z690 mainboard. Originally Win 10 then upgraded to Win 11 hoping to fix problem.

When I run heavy computational tasks and keep the application in the foreground, everything is great, performance is as expected, cpu load is high, fans are whirring. As soon as I switch to a different application (while waiting for the comp. task), cpu usage drops to half and performance is similarly reduced. It stays like this until I switch back to the computational app, when performance increases again.

I've tried adjusting processor scheduling to support background processes, updating drivers, updating windows, and monitoring the process priority in task manager.

I would like to fix this behaviour in general, the computational tasks can involve thousands of spawned processes if it runs for a long time, adjusting individual processes by hand is not desirable :)

Charlie
  • 191

3 Answers3

10

The problem relates to Windows handling of the efficiency cores -- apparently it unloads non foreground tasks to e-cores only. This can be disabled on a per executable basis using the following command line tool:

powercfg /powerthrottling disable /path "c:\myprogram\myprogram.exe"
Charlie
  • 191
1

The default setting in Windows is to favor foreground tasks over background ones. This might be more dramatic on Windows 11 running on a modern CPU, since Windows 11 can choose between cores that are for Efficiency or for Economy. In this case, lower priority might mean the allocation of a slower CPU core.

You may want to modify how background and foreground are tasks are handled.

This is done in the registry at key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PriorityControl, and especially the item named Win32PrioritySeparation.

You may find a detailed description of this 6-bit item in the article Win32PrioritySeparation. But in short, the field's 6 bits are divided to three 2-bit fields : 112233.

Field 11:

Value Meaning
00 or 11 Shorter intervals (Windows 2000 Professional), Longer intervals (Windows 2000 Server)
01 Longer intervals
10 Shorter intervals

Field 22:

Value Meaning
00 or 11 Variable-length intervals (Windows 2000 Professional), Fixed-length intervals (Windows 2000 Server)
01 Variable-length intervals
10 Fixed-length intervals

Field 33:

Value Meaning
00 Equal and fixed. The threads of foreground processes get the same amount of processor time as the threads of background processes and as the threads of processes with a priority class of Idle. Also, the processor interval is fixed. This value overrides the specification of a variable-length interval in the middle two bits.
01 2 : 1. The threads of foreground processes twice as much processor time than the threads of background processes each time they are scheduled for the processor.
10 or 11 3 : 1. The threads of foreground processes three times as much processor time than the threads of background processes each time they are scheduled for the processor.

In another Win32PrioritySeparation post, a user has compiled all the hexadecimal values that are possible as a combination of these three fields:

2A Hex = Short, Fixed , High foreground boost.
29 Hex = Short, Fixed , Medium foreground boost.
28 Hex = Short, Fixed , No foreground boost.

26 Hex = Short, Variable , High foreground boost. 25 Hex = Short, Variable , Medium foreground boost. 24 Hex = Short, Variable , No foreground boost.

1A Hex = Long, Fixed, High foreground boost. 19 Hex = Long, Fixed, Medium foreground boost. 18 Hex = Long, Fixed, No foreground boost.

16 Hex = Long, Variable, High foreground boost. 15 Hex = Long, Variable, Medium foreground boost. 14 Hex = Long, Variable, No foreground boost.

You would probably favor 18 hex, meaning long intervals, fixed size (no advantage for foreground), No foreground boost.

After changing this registry item, I would counsel a reboot. Note the old value, in case you wish to undo the change.

harrymc
  • 498,455
-1

You can go into the Task Manager -> Details page and right-click your process. With 'Set priority' you can set it to real time, which should fix the performance drain. However, you do have to do this every time you start the program.

Vincent
  • 17