Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

4.5. Examples of Using Tuna

download PDF

Example 4.1. Assigning Tasks to Specific CPUs

The following example uses a system with four or more processors, and shows how to make all ssh threads run on CPU 0 and 1, and all http threads on CPU 2 and 3.
# tuna --cpus=0,1 --threads=ssh\* --move --cpus=2,3 --threads=http\* --move
The above example command performs the following operations sequentially:
  1. Select CPUs 0 and 1.
  2. Select all threads that begin with ssh.
  3. Move the selected threads to the selected CPUs. Tuna sets the affinity mask of threads starting with ssh to the appropriate CPUs. The CPUs can be expressed numerically as 0 and 1, in hex mask as 0x3, or in binary as 11.
  4. Reset the CPU list to 2 and 3.
  5. Select all threads that begin with http.
  6. Move the selected threads to the selected CPUs. Tuna sets the affinity mask of threads starting with http to the appropriate CPUs. The CPUs can be expressed numerically as 2 and 3, in hex mask as 0xC, or in binary as 1100.

Example 4.2. Viewing Current Configurations

The following example uses the --show_threads (-P) parameter to display the current configuration, and then tests if the requested changes were made as expected.
# tuna --threads=gnome-sc\* \
        --show_threads \
        --cpus=0 \
        --move \
        --show_threads \
        --cpus=1 \
        --move \
        --show_threads \
        --cpus=+0 \
        --move \
        --show_threads

                       thread       ctxt_switches
     pid SCHED_ rtpri affinity voluntary nonvoluntary             cmd
   3861   OTHER     0      0,1     33997           58 gnome-screensav
                       thread       ctxt_switches
     pid SCHED_ rtpri affinity voluntary nonvoluntary             cmd
   3861   OTHER     0        0     33997           58 gnome-screensav
                       thread       ctxt_switches
     pid SCHED_ rtpri affinity voluntary nonvoluntary             cmd
   3861   OTHER     0        1     33997           58 gnome-screensav
                       thread       ctxt_switches
     pid SCHED_ rtpri affinity voluntary nonvoluntary             cmd
   3861   OTHER     0      0,1     33997           58 gnome-screensav
The above example command performs the following operations sequentially:
  1. Select all threads that begin with gnome-sc.
  2. Show the selected threads to enable the user to verify their affinity mask and RT priority.
  3. Select CPU 0.
  4. Move the gnome-sc threads to the selected CPU (CPU 0).
  5. Show the result of the move.
  6. Reset the CPU list to CPU 1.
  7. Move the gnome-sc threads to the selected CPU (CPU 1).
  8. Show the result of the move.
  9. Add CPU 0 to the CPU list.
  10. Move the gnome-sc threads to the selected CPUs (CPUs 0 and 1).
  11. Show the result of the move.
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.