Binds or unbinds the kernel threads of a process to a processor.
bindprocessor Process [ ProcessorNum ] | -q | -u Process{ProcessID [ProcessorNum] | -u ProcessID | -s SmtSetID | -b bindID ProcessorNum | -q }
The bindprocessor command binds or unbinds the kernel threads of a process, or lists available processors. The Process parameter is the process identifier of the process whose threads are to be bound or unbound, and the ProcessorNum parameter is the bind CPU identifier of the processor to be used. If the ProcessorNum parameter is omitted, the process is bound to a randomly selected processor.
If simultaneous multi-threading is enabled, each hardware thread of a physical processor is listed as a separate processor by the bindprocessor command. This allows software threads to be bound to each hardware thread separately. There are two hardware threads on a POWER5 processor, and they are referred to as the primary hardware thread and secondary hardware thread. The SmtSetId parameter is the simultaneous multi-thread set identifier value of a hardware thread and is defined to be 0 for primary hardware threads and 1 for secondary hardware threads. The -s flag can be used to list available processors that are all primary hardware threads or that are all secondary hardware threads. The -b flag lists all the available hardware threads on a single physical processor on which the ProcessorNum parameter is the bind CPU identifier of either the primary hardware thread or the secondary hardware thread on that processor. Refer to Simultaneous Multi-Threading in AIX® Version 7.1 General Programming Concepts: Writing and Debugging Programs for more information.
The bindprocessor command will fail if the target process has a Resource Attachment.
Programs that use processor bindings should become Dynamic Logical Partitioning (DLPAR) aware.
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.
The -q flag of the bindprocessor command lists the available bind CPU identifiers: you can use the logical numbers given as values for the ProcessorNum parameter. The -u flag unbinds the threads of a process, allowing them to run on any processor.
When simultaneous multi-threading is enabled, the -s flag of the bindprocessor command allows you to bind the threads of an application to separate physical processors by listing the processors separately. The -b flag is useful if you want to bind all the threads of an application to the hardware threads of the same physical processor.
Notes:
- The bindprocessor command is meant for multiprocessor systems. Although it will also work on uniprocessor systems, binding has no effect on such systems.
- You need root authority to bind or unbind threads in processes you do not own.
- If you attempt to bind kernel processes such as swapper and sched from the user space, the operation fails with the EPERM error code. You can determine which kernel processes will fail by looking for the SSCHEDPROC flag in the process structure. If the SSCHEDPROC flag is set, binding the kernel process will fail.
Item | Description |
---|---|
-b | Binds all threads of an application to the hardware threads of the same physical processor. |
-q | Displays the processors which are available. |
-s | Binds all threads of an application to separate physical processors by listing the processors separately. |
-u | Unbinds the threads of the specified process. |
bindprocessor -q
For
a four processor system, the output is similar to: The available processors are: 0 1 2 3
bindprocessor 19254 1
bindprocessor -s 0
The available processors are: 0 2 4 5
bindprocessor -s 1
The available processors are: 1 3 6 7
bindprocessor -s 0
The available processors are: 0 1 2 3
bindprocessor -s 1
SmtSetId 1 is not available
bindprocessor -b 0
The available processors are: 0 1
bindprocessor -b 1
Item | Description |
---|---|
/usr/sbin/bindprocessor | Contains the bindprocessor command. |