HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)
p
pthread_processor_bind_np(3T) pthread_processor_bind_np(3T)
(Pthread Library)
pset This parameter gives the value of the processor set for certain requests.
REMARKS
Much of the functionality of this capability is highly dependent on the underlying hardware. An applica-
tion that uses these functions should not be expected to be portable across architectures or implementa-
tions.
Some hardware platforms support online addition and deletion of processors. Due to this capability, pro-
cessors and locality domains may be added or deleted while the system is running. Applications should be
written to handle processor IDs and locality domain IDs that dynamically appear or disappear (for exam-
ple, sometime after obtaining the IDs of all the processors in the system an application may try to bind a
thread to one of those processors - these functions will return an error if that processor had been deleted).
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 plat-
forms, processor and locality domain 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.
Processor sets restrict application execution to a designated group of processors. These functions return
information about processors and locality domains available to the calling application. Refer to mpctl(2)
for system-wide topology information.
DESCRIPTION
These functions provide a means of determining how many processors and locality domains are available
to the applications and assigning threads to run on specific processors or locality domains.
A locality domain consists of a related collection of processors, memory, and peripheral resources that
comprise a fundamental building block of the system. All processors and peripheral devices in a given
locality domain have equal latency to the memory contained within that locality domain.
Processor sets furnish an alternative application scheduling allocation domain. A processor set comprises
an isolated group of processors for exclusive use by applications assigned to the processor set. (See
pset_create (2) for details). Use sysconf() with _SC_PSET_SUPPORT
name to see if the processor set
functionality is enabled and available on the system.
Topology Information
The
pthread_num_processors_np()
function returns the number of processors in the processor set
of the calling thread.
The
pthread_num_ldoms_np()
function returns the number of locality domains in the processor set
of the calling thread.
The
pthread_num_ldomprocs_np()
function returns the number of processors contributed by the
locality domain ldom to the processor set of the calling thread. It may be less than the total number of
processors in the ldom. The number of processors is returned in the answer parameter.
The
pthread_processor_id_np() function obtains the processor ID of a specific processor on the
system. The processor ID is returned in answer. The request parameter determines the precise action to
be taken and is one of the following:
PTHREAD_GETFIRSTSPU_NP
This request stores in the answer parameter the ID of the first processor in the processor set of
the calling thread. The spu argument is ignored.
PTHREAD_GETNEXTSPU_NP
This request stores in the answer parameter the ID of the next processor in the processor set of
the calling thread after spu.
Typically,
PTHREAD_GETFIRSTSPU_NP is called to determine the first spu.
PTHREAD_GETNEXTSPU_NP is then called in a loop (until the call returns [EINVAL]) to
determine the IDs of the remaining spus.
PTHREAD_GETCURRENTSPU_NP
This request stores in the answer parameter the ID of the processor the thread is currently
running on. The spu argument is ignored. Note: This option returns the current processor on
which the caller is executing, NOT the processor assignment of the caller.
HP-UX 11i Version 2: September 2004 − 2 − Hewlett-Packard Company Section 3−−819