Multiprocessing and niceness value

心不动则不痛 提交于 2021-02-08 12:22:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!