Sunday, June 26, 2011

set a processess CPU affinity


taskset


taskset [options] [mask |list] [pid |command [args] ]
taskset is used to retrieve or set the processor affinity mask of either an existing process, given its PID, or to run a new a process, given its command name, with a specified affinity mask. The Linux scheduler will then honor the given affinity mask, ensuring that the process in question runs only on allowed processors.

Options
-c, --cpu-list
The affinity mask will be provided in list form, for example, "0,2,5-6," not as a bitmask.
-p, --pid
Set or retrieve the mask of the given PID. Do not start a new process.
-h, --help
Display usage information and then exit.
-V, --version
Display version information and then exit.
  How to Set Which Process Runing on Which Cpu Core

             #taskset -c 1 1253
                     
  Find Which Porcess running in Which Cpu core
 
            #ps o pid,psr,cmd -p PID