The plgrp tool
The plgrp utility can display or set the home lgroup and lgroup affinities
for one or more processes, threads, or lightweight processes (LWPs). The system assigns
a home lgroup to each thread on creation. When the system allocates a
CPU or memory resource to a thread, it searches the lgroup hierarchy from
the thread's home lgroup for the nearest available resources to the thread's home.
The system chooses a home lgroup for each thread. The thread's affinity for
its home lgroup is initially set to none, or no affinity. When
a thread sets an affinity for an lgroup in its processor set that
is higher than the thread's affinity for its home lgroup, the system moves
the thread to that lgroup. The system does not move threads that are
bound to a CPU. The system rehomes a thread to the lgroup in
its processor set that has the highest affinity when the thread's affinity for
its home lgroup is removed (set to none).
For a full description of the different levels of lgroup affinity and their
semantics, see the lgrp_affinity_set(3LGRP) manual page.
The plgrp tool supports the following options:
- -a lgroup list
This option displays the affinities of the processes or threads that you specify for the lgroups in the list.
- -Algroup list/none|weak|strong[,...]
This option sets the affinity of the processes or threads that you specify for the lgroups in the list. You can use a comma separated list of lgroup/affinity assignments to set several affinities at once.
- -F
This option takes control of the target process. This option overrides the control of any other process. See the proc(1) manual page.
- -h
This option returns the home lgroup of the processes or threads that you specify. This is the default behavior of the plgrp tool when you do not specify any options.
- -H lgroup list
This option sets the home lgroup of the processes or threads that you specify. This option sets a strong affinity for the listed lgroup. If you specify more than one lgroup, the plgrp utility will attempt to home the threads to the lgroups in a round robin fashion.
Specifying Lgroups
The value of the lgroup list variable is a comma separated list of one
or more of the following attributes:
The all keyword represents all of the lgroup IDs in the system. The
root keyword represents the ID of the root lgroup. The leaves keyword represents
the IDs of all of the leaf lgroups. A leaf lgroup is an
lgroup that does not have any children.
Specifying Process and Thread Arguments
The plgrp utility takes one or more space-separated processes or threads as arguments.
You can specify processes and threads in a the same syntax that the
proc(1) tools use. You can specify a process ID as an integer, with
the syntax pid or /proc/pid. You can use shell expansions with the /proc/pid
syntax. When you give a process ID alone, the arguments to the plgrp
utility include all of the threads of that process.
You can specify a thread explicitly by specifying the process ID and thread
ID with the syntax pid/lwpid. You can specify multiple threads of a process
by defining ranges with can be selected at once by using the -
character to define a range, or with a comma-separated list. To specify threads
1, 2, 7, 8, and 9 of a process whose process ID is
pid, use the syntax pid/1,2,7-9.