Suchen

Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

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

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

© 2024 Red Hat, Inc.