I want to limit my programs' access to computer resources to prevent it from hanging so I can continue working on other things while programs are running in the background. I'm looking for a generic way to do this regardless of what my scripts look like. I have seen that for those who work on Linux there are the options nice
and cpulimit
, but I work on win7 (switching to Linux is not an option since I am not the one who decides the configuration of the pc that I use).
What options do I have working on windows to achieve a result equivalent to nice
y cpulimit
on win7?
I have developed a function based on several examples that I have seen on different websites.
It can be used interchangeably if you work on Windows or on Linux.
In addition, I have implemented the option of being able to set the priority level through the parameters passed to the function, so that the priority can not only be reduced, but also increased. The default value of the parameters is the one that corresponds to "normal" priority
EDIT: Attached link to a website with other similar examples ,