I have a Windows 11 system configured to run in "Best Performance" mode. I'm running two resource-intensive applications simultaneously: one is a GUI-based app, and the other is a Python script executed from a terminal. Both applications heavily utilize CPU and GPU resources.
I've observed that when the terminal window (where the Python script was started) remains active (in focus), both applications run optimally with stable performance. However, as soon as I switch focus to another window, even something lightweight, the performance of my Python script notably decreases. This is not due to increased resource usage from the GUI or other applications - I have verified this multiple times through resource monitoring.
To address this, I tried to set the Python script's process priority to "real-time" via Task Manager, but this had no noticeable effect on maintaining performance when the terminal loses focus.
- Why does the Python script slow down when its terminal window loses focus?
- How can I prevent Windows 11 from reducing the performance of the script when the terminal window is inactive?