cpuset cpuset_getid cpuset_setid - manage CPU affinity sets
Lb libc
Sets are referenced by a number of type cpuset_id_t . Each thread has a root set, an assigned set, and an anonymous mask. Only the root and assigned sets are numbered. The root set is the set of all CPUs available in the system or in the system partition the thread is running in. The assigned set is a subset of the root set and is administratively assignable on a per-process basis. Many processes and threads may be members of a numbered set.
The anonymous set is a further thread-specific refinement on the assigned set. It is intended that administrators will manipulate numbered sets using cpuset(1) while application developers will manipulate anonymous sets using cpuset_setaffinity2.
To select the correct set a value of type cpulevel_t is used. The following values for Fa level are supported:
The Fa which argument determines how the value of Fa id is interpreted and is of type cpuwhich_t . The Fa which argument may have the following values:
An Fa id of '-1' may be used with a Fa which of CPU_WHICH_TID CPU_WHICH_PID or CPU_WHICH_CPUSET to mean the current thread, process, or current thread's cpuset. All cpuset syscalls allow this usage.
A Fa level argument of CPU_LEVEL_WHICH combined with a Fa which argument other than CPU_WHICH_CPUSET refers to the anonymous mask of the object. This mask does not have an id and may only be manipulated with cpuset_setaffinity2.
cpuset ();
creates a new set containing the same CPUs as the root set of the current
process and stores its id in the space provided by
Fa setid .
On successful completion the calling process joins the set and is the
only member.
Children inherit this set after a call to
fork(2).
cpuset_setid ();
attempts to set the id of the object specified by the
Fa which
argument.
Currently
CPU_WHICH_PID
is the only acceptable value for which as
threads do not have an id distinct from their process and the API does
not permit changing the id of an existing set.
Upon successful completion all of the threads in the target process will
be running on CPUs permitted by the set.
cpuset_getid ();
retrieves a set id from the object indicated by
Fa which
and stores it in the space pointed to by
Fa setid .
The retrieved id may be that of either the root or assigned set
depending on the value of
Fa level .
Fa level
should be
CPU_LEVEL_CPUSET
or
CPU_LEVEL_ROOT
to get the set id from
the process or thread specified by the
Fa id
argument.
Specifying
CPU_LEVEL_WHICH
with a process or thread is unsupported since
this references the unnumbered anonymous mask.
The actual contents of the sets may be retrieved or manipulated using cpuset_getaffinity2 and cpuset_setaffinity2. See those manual pages for more detail.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |