[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Commands Reference, Volume 1

bindprocessor Command

Purpose

Binds or unbinds the kernel threads of a process to a processor.

Syntax

bindprocessor Process [ ProcessorNum ] | -q | -u Process

Description

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 logicial processor number of the processor to be used. If the ProcessorNum parameter is omitted, the process is bound to a randomly selected 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.

The -q flag of the bindprocessor command lists the available logical processor numbers: 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.

Notes:
  1. The bindprocessor command is meant for multiprocessor systems. Although it will also work on uniprocessor systems, binding has no effect on such systems.
  2. You need root authority to bind or unbind threads in processes you do not own.

Flags

-q Displays the processors which are available.
-u Unbinds the threads of the specified process.

Examples

  1. To see which processors are available (possible ProcessorNum values), enter:
    bindprocessor -q
    For a four processor system, the output is similar to:
    The available processors are: 0 1 2 3
  2. To bind the threads in process 19254 to processor 1, enter:
    bindprocessor 19254 1

File

/usr/sbin/bindprocessor Contains the bindprocessor command.

Related Information

The cpu_state command, smit command.

The bindprocessor subroutine. exec subroutine, fork subroutine.

Controlling Processor Use in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]