问题
Does anyone know of an easy way to set the niceness value of a Process or Pool when it is created in multiprocessing?
回答1:
os.nice(increment)
Add increment to the process’s “niceness”. Return the new niceness. Availability: Unix.
From http://docs.python.org/library/os.html#os.nice.
Is there a reason you can't call this in the child process?
回答2:
Try importing the ctypes module and looking for pthread_schedparam() or SetThreadPriority() (Linux / Windows).
来源:https://stackoverflow.com/questions/2181209/multiprocessing-and-niceness-value