|HP-UX Reference > P
HP-UX 11i Version 3: February 2007
pthread_launch_policy_np() — setting thread launch policies
int pthread_launch_policy_np( int request, int *answer, pthread_t tid );
Each process shall have a launch policy. Each thread shall have a launch policy. The launch policy for a thread does not have to match the launch policy for the process. The launch policy determines the locality domain where the newly created process or thread will be launched in a ccNUMA system. The locality domains covered by a process's or thread's processor set are the available locality domains.
The pthread_launch_policy_np() function sets a thread launch policy for a specific thread. The thread specified by tid is the target thread whose launch policy is changed. The value PTHREAD_SELFTID_NP can be used to refer to the calling thread.
pthread_launch_policy_np() is currently not supported for PTHREAD_SCOPE_PROCESS threads. If pthread_launch_policy_np() is used on a PTHREAD_SCOPE_PROCESS thread, it is silently ignored and zero is returned for successful completion.
When a process creates another process (via fork() or vfork()), the child process will inherit the parent process's launch policy. The initial thread in the child process will inherit the launch policy of the creating thread (and not that of its process). Other threads in a multi-threaded process inherit their launch policy from the creating thread.
For all launch policies, the target thread is bound to the locality domain on which it was launched. The target is allowed to execute on any processor within that locality domain.
When setting a launch policy, if the target already has processor or locality domain binding, the existing binding will not be overwritten. Instead the locality domain in which the target is bound (whether locality domain binding or processor binding) will be used as the starting locality domain for implementing the launch policy.
Refer to mpctl(2) man page for further details on launch policies.
Note: locality domains are tightly tied to the physical components of the underlying system. As a result, the performance observed when using launch policies based on locality domains may vary from system to system. For example, a system which contains 4 locality domains, each containing 32 processors, may exhibit different performance behaviors from a system that contains 32 locality domains with 4 processors per domain. The launch policy that provides optimal performance on one system may not provide optimal performance on a different system for the same application.
The request parameter specifies the action to take and may be one of the following:
Upon successful completion, pthread_launch_policy_np() returns zero. Otherwise, an error number is returned to indicate the error (the errno variable is not set).
If any of the following occur, the pthread_launch_policy_np() function returns the corresponding error number:
pthread_launch_policy_np() is currently not supported for PTHREAD_SCOPE_PROCESS threads. If pthread_launch_policy_np() is used on a PTHREAD_SCOPE_PROCESS thread, it is silently ignored and zero is returned for successful completion. If the request parameter is PTHREAD_GET_POLICY_NP, answer is set to PTHREAD_POLICY_NONE_NP. For all other request values, answer parameter is ignored. Applications dependent on the complete implementation of pthread_launch_policy_np() should use PTHREAD_SCOPE_SYSTEM threads.