Is it possible for a python script to limit the cpu power allocated to it.
Right now, I have a script (using only one core) that is using 100% of one cpu's core. I need it to use less than that amount.
I don't know if there is an equivalent to php's memory_limit in python? or if is there a library to manage memory allocation (using sleep isnt a very elegant solution?
Thanks.
解决方案
Maybe try Python's "resource" package ?
The resource package is basically a wraparound of "setrlimit" in UNIX. So you can set constrains for CPU/Memory usage, etc.
Thanks @Stephane for pointing it out, this is actually my first answer ever.