[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes | ||
fr:slackbook:process_control [2012/09/29 03:58 (UTC)] – créée escaflown | fr:slackbook:process_control [2012/12/16 22:57 (UTC)] – [top] Initial translation ellendhel | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
<!-- Add your text below. Start with a Headline (see button bar above). --> | <!-- Add your text below. Start with a Headline (see button bar above). --> | ||
- | ====== | + | ====== |
+ | Les systèmes Slackware exécutent souvent des centaines ou des milliers de programmes, et chacun d' | ||
===== ps ===== | ===== ps ===== | ||
+ | La première étape dans la gestion des processus est de savoir quels sont en cours d' | ||
+ | < | ||
+ | darkstar:~$ ps | ||
+ | PID TTY TIME CMD | ||
+ | 12220 pts/4 00:00:00 bash | ||
+ | 12236 pts/4 00:00:00 ps | ||
+ | </ | ||
+ | |||
+ | Vous pouvez voir ici quels processus sont exécutés dans votre shell courant ou votre terminal et peu d' | ||
+ | |||
+ | Visualiser uniquement ses propres processus n'est pas très amusant, jetons donc un œil sur tous les processus du système avec l' | ||
+ | |||
+ | < | ||
+ | darkstar:~$ ps -e | ||
+ | PID TTY TIME CMD | ||
+ | 1 ? 00:00:00 init | ||
+ | 2 ? 00:00:00 kthreadd | ||
+ | 3 ? 00:00:00 migration/0 | ||
+ | 4 ? 00:00:00 ksoftirqd/0 | ||
+ | 7 ? 00:00:11 events/0 | ||
+ | 9 ? 00:00:01 work_on_cpu/ | ||
+ | 11 ? 00:00:00 khelper | ||
+ | 102 ? 00:00:02 kblockd/0 | ||
+ | 105 ? 00:01:19 kacpid | ||
+ | 106 ? 00:00:01 kacpi_notify | ||
+ | ... beaucoup de lignes supprimées ... | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | Ceci est différent de l' | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | darkstar:~$ ps aux | ||
+ | USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root | ||
+ | root 11 0.0 0.0 0 0 ? S Apr05 0:00 [khelper] | ||
+ | ... beaucoup de lignes supprimées .... | ||
+ | </ | ||
+ | |||
+ | Comme vous pouvez le voir, la syntaxe BSD offre beaucoup plus d' | ||
+ | |||
+ | Pour obtenir un résultat spécifique, | ||
+ | |||
+ | < | ||
+ | darkstar:~$ ps -o cmd -o etime $$ | ||
+ | CMD | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Dans le résultat nous trouvons le nom de la commande (cmd) pour ce PID et le temps écoulé (etime). Le PID dans cet exemple est une variable du shell pour le PID du shell courant. Vous pouvez donc voir dans cet exemple que le processus de ce shell existe depuis 12 minutes et 22 secondes. | ||
+ | |||
+ | En utilisant la commande // | ||
+ | |||
+ | < | ||
+ | darkstar:~$ ps -o cmd -o rss -o vsz $(pgrep httpd) | ||
+ | CMD | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Dans cet exemple, un shell interne est exécuté, utilisant // | ||
+ | |||
+ | Et enfin, //**ps**// peut aussi créer une arborescence des processus. Ceci vous montre quels processus ont des processus enfants. Tuer le parent d'un processus enfant tuera aussi ce dernier. Nous pouvons faire cela avec l' | ||
+ | |||
+ | < | ||
+ | darkstar:~$ ps -ejH | ||
+ | ... beaucoup de lignes supprimées ... | ||
+ | | ||
+ | 29947 29947 3660 tty1 | ||
+ | 29963 29947 3660 tty1 | ||
+ | 29964 29964 29964 tty7 | ||
+ | 29972 29972 3660 tty1 | ||
+ | 29977 29972 3660 tty1 | ||
+ | 29988 29972 3660 tty1 | ||
+ | 29997 29972 3660 tty1 | ||
+ | 29999 29972 3660 tty1 | ||
+ | ... beaucoup de lignes supprimées ... | ||
+ | </ | ||
+ | |||
+ | Comme vous pouvez le voir, // | ||
+ | |||
+ | Comme c'est le cas avec beaucoup de programmes, il existe souvent plusieurs outils pour faire le travail. | ||
+ | |||
+ | < | ||
+ | darkstar:~$ pstree | ||
+ | init-+-atd | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ===== kill et killall ===== | ||
+ | |||
+ | Gérer des processus ne limite pas à savoir quels sont actifs, mais également communiquer avec eux pour changer leur comportement. La façon la plus courante de gérer un programme est de le tuer. De fait, l' | ||
+ | |||
+ | La manière dont un processus réagit en recevant un signal peut varier. La plupart des programmes s' | ||
+ | |||
+ | Afin d' | ||
+ | |||
+ | < | ||
+ | darkstar:~$ kill -l | ||
+ | 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL | ||
+ | 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE | ||
+ | 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 | ||
+ | 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT | ||
+ | ... many more lines omitted ... | ||
+ | darkstar:~$ kill 1234 # SIGTERM | ||
+ | darkstar:~$ kill -s 9 1234 # SIGKILL | ||
+ | darkstar:~$ kill -s 1 1234 # SIGHUP | ||
+ | darkstar:~$ kill -s HUP 1234 # SIGHUP | ||
+ | </ | ||
+ | |||
+ | Parfois, vous souhaiterez terminer tous les processus portant un certain nom. Vous pouvez tuer les processus par leur nom avec // | ||
+ | |||
+ | < | ||
+ | darkstar:~$ killall bash # SIGTERM | ||
+ | darkstar:~$ killall -s 9 bash # SIGKILL | ||
+ | darkstar:~$ killall -s 1 bash # SIGHUP | ||
+ | darkstar:~$ killall -s HUP bash # SIGHUP | ||
+ | </ | ||
===== top ===== | ===== top ===== | ||
+ | Jusqu' | ||
- | ===== cron ===== | + | < |
+ | darkstar:~$ top | ||
+ | top - 16:44:15 up 26 days, 5:53, 5 users, | ||
+ | Tasks: 122 total, | ||
+ | Cpu(s): | ||
+ | Mem: | ||
+ | Swap: 0k total, | ||
- | < | + | PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND |
+ | 1 root 20 | ||
+ | 2 root 15 -5 | ||
+ | 3 root RT -5 | ||
+ | 4 root 15 -5 | ||
+ | 7 root 15 -5 | ||
+ | 9 root 15 -5 | ||
+ | 11 root 15 -5 | ||
+ | 102 root 15 -5 | ||
+ | 105 root 15 -5 | ||
+ | 106 root 15 -5 | ||
+ | 175 root 15 -5 | ||
+ | 177 root 15 -5 | ||
+ | 178 root 15 -5 | ||
+ | 184 root 15 -5 | ||
+ | 187 root 15 -5 | ||
+ | 242 root 20 | ||
+ | 243 root 15 -5 | ||
+ | </code> | ||
- | ====== Chapter Navigation ====== | + | La page de manuel comporte des détails pratiques sur comment interagir avec //**top**// tel que modifier l' |
- | **Previous Chapter: [[slackbook: | + | ===== cron ===== |
- | **Next Chapter: [[slackbook: | + | ====== Navigation ====== |
+ | |||
+ | **Chapitre précédent | ||
+ | |||
+ | **Chapitre suivant : [[fr:slackbook: | ||
====== Sources ====== | ====== Sources ====== | ||
<!-- If you copy information from another source, then specify that source --> | <!-- If you copy information from another source, then specify that source --> | ||
- | | + | |
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> | ||
- | | + | |
- | < | + | |
+ | <!-- * Contrbutions by [[wiki: | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
<!-- You must also remove the tag-word " | <!-- You must also remove the tag-word " | ||
- | {{tag> | + | {{tag>fr:slackbook process_control ps kill killall top cron}} |