La commande 'bindprocessor' permet de gérer les affectations de processus aux différents processeurs physique du système.

La commande simple 'bindprocessor -q ' donne la liste des processeurs disponibles.

Pour allouer un processus à un processeur spécifique, utiliser la commande suivante :

# bindprocessor 16578 1                                 # Allocation du process 16578 au processeur 1

 

Ci-dessous la documentation officielle IBM.

Purpose

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

Syntax

bindprocessor Process [ ProcessorNum ] | -q | -u Process{ProcessID [ProcessorNum] | -u ProcessID | -s SmtSetID | -b bindID ProcessorNum | -q }

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 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 6.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. Refer to Dynamic Logical Partitioning in AIX Version 6.1 General Programming Concepts: Writing and Debugging Programs for more information.

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:
  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.
  3. 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.

Flags

-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.

Examples

  1. To see which processors are available (possible ProcessorNum values), type:
    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, type:
    bindprocessor 19254 1
  3. To see all the available processors that are primary hardware threads, type:
    bindprocessor -s 0
    For a four-processor system with simultaneous multi-threading enabled, the output is similar to:
    The available processors are: 0 2 4 5
    To see all the available processors that are secondary hardware threads, type:
    bindprocessor -s 1
    The output is similar to:
    The available processors are: 1 3 6 7
    When simultaneous multi-threading is disabled using the smtctl command, or on systems with processors that do not support simultaneous multi-threading, the outputs would be:
    bindprocessor -s 0
    
    The available processors are: 0 1 2 3
    
    bindprocessor -s 1
    
    SmtSetId 1 is not available
  4. To see all the available bind CPU IDs on a physical processor that has a hardware thread with a bind CPU ID of 0, type:
    bindprocessor -b 0
    The output is similar to:
    The available processors are: 0 1
    Again, typing the command:
    bindprocessor -b 1
    will also result in the same output.

File

/usr/sbin/bindprocessor Contains the bindprocessor command.

Related Information

The smit command, smtctl command.

icon phone
Téléphone/Whatsapp : +33 (0)6 83 84 85 74
icon phone