# http://www.coolpython.net/python_senior/concurrent/multiprocess_bind_cpu.html
import psutil
count = psutil.cpu_count()
p = psutil.Process()
cpu_lst = p.cpu_affinity() # [0, 1, 2, 3]
p.cpu_affinity([0, 1]) # 将进程绑定到0和1这两个cpu核上
绑核
Comments 0
Sign in to comment and like
← More postsThat’s all for now. Thanks for reading.
No comments yet.