How to limit CPU usage in Python

Jerry Hill malaclypse2 at gmail.com
Thu Sep 27 13:07:56 EDT 2012


On Thu, Sep 27, 2012 at 12:58 PM, Prasad, Ramit
<ramit.prasad at jpmorgan.com> wrote:
> On *nix you should just set the appropriate nice-ness and then
> let the OS handle CPU scheduling. Not sure what you would do
> for Windows--I assume OS X is the same as *nix for this context.

On windows, you can also set the priority of a process, though it's a
little different from the *nix niceness level.  See
http://code.activestate.com/recipes/496767/ for a recipe using
pywin32.  I believe the psutil module handles this too, but I don't
think it manages to abstract away the platform differences.

-- 
Jerry



More information about the Python-list mailing list