Binds kernel threads to a processor.
#include <sys/processor.h>
int bindprocessor (What, Who, Where) int What; int Who; cpu_t Where;
The bindprocessor subroutine binds a single kernel thread, or all kernel threads in a process, to a processor, forcing the bound threads to be scheduled to run on that processor. It is important to understand that a process itself is not bound, but rather its kernel threads are bound. Once kernel threads are bound, they are always scheduled to run on the chosen processor, unless they are later unbound. When a new thread is created, it has the same bind properties as its creator. This applies to the initial thread in the new process created by the fork subroutine: the new thread inherits the bind properties of the thread which called fork. When the exec subroutine is called, thread properties are left unchanged.
What | Specifies whether a process or a thread is being bound to a processor. The What parameter can take one of the following values: |
Who | Indicates a process or thread identifier, as appropriate for the What parameter, specifying the process or thread which is to be bound to a processor. |
Where | If the Where parameter is a logical processor identifier, it specifies the processor to which the process or thread is to be bound. A value of PROCESSOR_CLASS_ANY unbinds the specified process or thread, which will then be able to run on any processor.
The sysconf subroutine can be used to retrieve information about the number of processors in the system. |
On successful completion, the bindprocessor subroutine returns 0. Otherwise, a value of -1 is returned, and the errno global variable is set to indicate the error.
The bindprocessor subroutine is unsuccessful if one of the following is true:
The bindprocessor subroutine is part of the Base Operating System (BOS) Runtime.
The bindprocessor command.
The exec subroutine, fork subroutine, sysconf subroutine, thread_self subroutine.
Controlling Processor Use in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.