mpctl.2 (2010 09)
m
mpctl(2) mpctl(2)
MPC_LDOMCORES Returns the number of enabled processor cores assigned to the current processor
set in the locality domain; this value will always be greater than or equal to 0.
The pid argument is ignored.
Processor and Locality Domain Binding
Each process shall have a processor and locality domain binding. Each LWP (lightweight process) shall
have a processor and locality domain binding. The binding assignments for a lightweight process do not
have to match the binding assignments for the process.
Setting the processor or locality domain binding on the process of a multithreaded process, causes all
LWPs (lightweight processes) in the target process to have their binding assignments changed to what is
specified. However, if any LWP belongs to a different processor set such that the specified processor or
locality domain does not contribute to that processor set, the binding assignment for such an LWP is not
changed.
When a process creates another process (via
fork()
or vfork()), the child process will inherit the
parent process’s binding assignments (NOT the binding assignments of the creating LWP). The initial
LWP in the child process shall inherit its binding assignments from the child process. LWPs other than
the initial LWP shall inherit their binding assignments from the creating LWP (unless specified otherwise
in the LWP create attributes).
Processor binding and locality domain binding are mutually exclusive -- only one can be in effect at any
time. If locality domain binding is in effect, the target is allowed to execute on any processor within that
locality domain in its processor set.
Setting the processor or locality domain binding will fail if the target processor or locality domain is not in
the processor set of the specified process or LWP.
WARNING: Due to the capability of online addition and deletion of processors on some platforms, proces-
sors may go away. If this occurs, any processes or LWPs bound to a departing processor will be rebound
to a different processor with the same binding type. If the last processor in a locality domain is removed,
any processes or LWPs bound to a departing locality domain will be rebound to a different locality
domain.
For processor binding use:
int mpctl(mpc_request_t request, spu_t spu, pid_t pid);
int mpctl(mpc_request_t request, spu_t spu, lwpid_t lwpid);
The request argument determines the precise action to be taken by mpctl() and is one of the following:
MPC_SETPROCESS
This call is advisory . This request asynchronously assigns process pid to proces-
sor spu . The new processor assignment is returned.
The pid
MPC_SELFPID may be used to refer to the calling process.
The spu
MPC_SPUNOCHANGE may be passed to read the current assignment.
The spu MPC_SPUFLOAT may be used to break any specific-processor assign-
ment. This allows the process to float to any processor.
NOTE: This call is advisory . If the scheduling policy for a process conflicts with
this processor assignment, the scheduling policy takes precedence. For example,
when a processor is ready to choose another process to execute, and the highest
priority
SCHED_FIFO process is bound to a different processor, that process will
execute on the selecting processor rather than waiting for the specified processor
to which it was bound.
If the process specified by pid is a multithreaded process, all LWPs (lightweight
processes) in the target process with the same processor set binding as the target
process will have their processor assignment changed to what is specified. The
processor set binding takes precedence over processor or locality domain bind-
ing.
MPC_SETPROCESS_FORCE
This call is identical to MPC_SETPROCESS except that the processor binding
will take precedence over the scheduling policy. This call is synchronous. For
example, when a processor is ready to choose another process to execute, and the
highest priority SCHED_FIFO process is bound to a different processor, that
6 Hewlett-Packard Company − 6 − HP-UX 11i Version 3: September 2010