How to increase Python’s CPU usage

cpu usagepython

I use Python to execute some algorithms and no matter which Python I use, and I have tried many versions, the CPU usage goes to 25% max. Why doesn't Python take advantage of the rest of my CPU resources? I changed the priority of the service from normal to high and later to real time, with restarts in between, but nothing changed.

Is there a way to make Python use 50% or even more of my CPU ?

Best Answer

Quite simply, you're running a single threaded application in a system with 4 logical cores - as such, you have one process, using all of the core.

You will (and this is non trivial) need to rewrite the algorithm to be multi-threaded, or see if you can just run 2 or more instances, on specific cores to use more of your CPU. There's no other way.

Related Question