cpuset - configure processor sets
requires a target to modify or query. The target may be specified as a command, process id, thread id, or a cpuset id. Using -g the target's set id or mask may be queried. Using -l or -s the target's CPU mask or set id may be set. If no target is specified, operates on itself. Not all combinations of operations and targets are supported. For example, you may not set the id of an existing set or query and launch a command at the same time.
There are two sets applicable to each process and one private mask per thread. Every process in the system belongs to a cpuset. By default processes are started in set 1. The mask or id may be queried using -c Each thread also has a private mask of CPUs it is allowed to run on that must be a subset of the assigned set. And finally, there is a root set, numbered 0, that is immutable. This last set is the list of all possible CPUs in the system and is queried using -r
When running a command it may join a set specified with -s otherwise a new set is created. In addition, a mask for the command may be specified using -l When used in conjunction with -c the mask modifies the supplied or created set rather than the private mask for the thread.
The options are as follows:
cpuset -c -l 0-4 /bin/sh
Query the mask of CPUs the Aq sh pid is allowed to run on:
cpuset -g -p <sh pid>
Restrict /bin/sh to run on CPUs 0 and 2 while its group is still allowed to run on CPUs 0-4:
cpuset -l 0,2 -p <sh pid>
Modify the cpuset /bin/sh belongs to restricting it to CPUs 0 and 2:
cpuset -l 0,2 -c -p <sh pid>
Modify the cpuset all threads are in by default to contain only the first 4 CPUs, leaving the rest idle:
cpuset -l 0-3 -s 1
Print the id of the cpuset /bin/sh is in:
cpuset -g -i -p <sh pid>
Move the pid into the specified cpuset setid so it may be managed with other pids in that set:
cpuset -s <setid> -p <pid>
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |