Let's say you want to run firefox using one CPU. You'd run something like this:
taskset 0x00000001 firefox
For allowing firefox to use 2 CPUs replace 0x00000001 with 0x00000003
For allowing firefox to use all CPUs replace 0x00000001 with 0xFFFFFFFF
Taskset is really helpful when you want to put a limit on less important process, so that your important processes don't hang up while working
Command Format:
taskset -p [mask] [pid]
Options
-p, --pid
operate on an existing PID and not launch a new task
-c, --cpu-list
specifiy a numerical list of processors instead of a bitmask. The list may contain multiple items, separated by comma, and ranges. For example, 0,5,7,9-11.
-h, --help
display usage information and exit
-V, --version
output version information and exit
Mask: specifies CPUs assigned. values: 0x00000001, 0x00000003, 0xFFFFFFFF
- You can also retrieve the CPU affinity of an existing task:
- taskset -p [pid]
http://linux.die.net/man/1/taskset
http://www.serverwatch.com/tutorials/article.php/3915931/Using-Taskset-for-Priority-Tasks.htm
No comments:
Post a Comment