1. 程式人生 > >實現Linux 程序繫結CPU 技術

實現Linux 程序繫結CPU 技術

快速繫結ceph osd 到CPU 核上

import os,sys,time
import commands
count=0
pids = commands.getoutput(""" ps -ef |grep ceph-osd|grep -v grep|awk '{print $2}' """)
for i in pids.split("\n"):
    count += 1
    os.system("taskset -cp %s %s" %(count,i))
    print "taskset -cp %s %s" %(count,i)