mpctl.2 (2010 09)
m
mpctl(2) mpctl(2)
The mpctl() call is expected to be used to increase performance in certain applications, but should not
be used to ensure correctness of an application. Specifically, cooperating processes/lightweight processes
should not rely on processor or locality domain assignment in lieu of a synchronization mechanism (such
as semaphores).
Machine Topology Information
Warning: Processor and locality domain IDs are not guaranteed to exist in numerical order. There may
be holes in a sequential list of IDs. Due to the capability of online addition and deletion of processors on
some platforms, IDs obtained via these interfaces may be invalid at a later time. Likewise, the number of
processors and locality domains in the system may also change due to processors being added or deleted.
See the Processor Set Information section to query machine topology within the application’s processor
set.
For processor topology use:
int mpctl(mpc_request_t request, spu_t spu, pid_t pid);
The request argument determines the precise action to be taken by
mpctl() and is one of the following:
MPC_GETNUMSPUS_SYS
This request returns the number of enabled spus (processors) in the system. It
will always be greater than or equal to 1. The spu and pid arguments are
ignored.
MPC_GETFIRSTSPU_SYS
This request returns the ID of the first enabled processor in the system. The spu
and pid arguments are ignored.
MPC_GETNEXTSPU_SYS
This request returns the ID of the next enabled processor in the system after
spu. The pid argument is ignored.
Typically,
MPC_GETFIRSTSPU_SYS
is called to determine the first spu.
MPC_GETNEXTSPU_SYS
is then called in a loop (until the call returns -1) to
determine the IDs of the remaining spus.
MPC_GETCURRENTSPU
This request returns the ID of the processor the caller is currently running on
(NOT the processor assignment of the caller). The spu and pid arguments are
ignored.
Warning: The information returned by this system call may be out-of-date arbi-
trarily soon after the call completes due to the scheduler context switching the
caller onto a different processor.
For locality domain topology use:
int mpctl(mpc_request_t request, ldom_t ldom, pid_t pid);
The request argument determines the precise action to be taken by mpctl() and is one of the following:
MPC_GETNUMLDOMS_SYS
This request returns the number of active locality domains in the system. An
active locality domain has at least one enabled processor in it. The number of
active locality domains in the system will always be greater than or equal to 1.
The ldom and pid arguments are ignored.
MPC_GETFIRSTLDOM_SYS
This request returns the ID of the first active locality domain in the system. The
ldom and pid arguments are ignored.
MPC_GETNEXTLDOM_SYS
This request returns the ID of the next active locality domain in the system after
ldom. The pid argument is ignored.
Typically,
MPC_GETFIRSTLDOM_SYS is called to determine the first locality
domain. MPC_GETNEXTLDOM_SYS is then called in a loop (until the call
returns -1) to determine the IDs of the remaining locality domains.
MPC_GETCURRENTLDOM
This request returns the ID of the ldom that the caller is currently running on
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010