
# mount -t cpuset none /dev/cpusetThen under /dev/cpuset you can find a tree that corresponds to the tree of the cpusets in the system. For instance, /dev/cpuset/ is the cpuset that holds the whole system.
# cd /dev/cpuset/ # mkdir my_cpusetNow you want to do something with this cpuset.
# cd my_cpusetIn this directory you can find several files:
# ls cpu_exclusive cpus mem_exclusive mems notify_on_release placement tasks virtualizeReading them will give you information about the state of this cpuset: the CPUs it can use, the processes that are using it, its properties... And Writing to these files you can manipulate the cpuset.
# echo 1 > notify_on_release(Be sure to read this note about echo).
# echo 0-7 > cpusNow attach your shell to this cpuset:
# echo $$ > tasksYou can also create cpusets inside your cpuset by using mkdir in this directory.
# mkdir my_sub_csTo remove a cpuset, juste use rmdir:
# rmdir my_sub_csNote that this will fail is the cpuset is in use (has cpusets inside, or has processes attached).
# echo 1-4 > cpus -> set cpus list to cpus 1,2,3,4 # echo 1,2,3,4 > cpus -> set cpus list to cpus 1,2,3,4
# echo 1 > cpu_exclusive -> set flag 'cpu_exclusive' # echo 0 > cpu_exclusive -> unset flag 'cpu_exclusive' # echo 1 > notify_on_release -> set flag 'notify_on_release'
# echo PID > tasksNote you can only attach ONE task at a time. If you have several tasks to attach, you have to do it one after another:
# echo PID1 > tasks # echo PID2 > tasks...
# echo PIDn > tasks
echo()
{
/bin/echo | cat
}
Thu Jan 8 15:36:43 CET 2004