LoginSignup
167
155

More than 5 years have passed since last update.

psコマンドで表示される内容について調べた

Posted at

psコマンドで表示される列の詳細について分かってない部分もあったので確認してみた時のメモ

参考

以下に書いてある内容について実際に確認しつつ、メモしました。

オプション指定なしで実行してみる

コマンド実行時のプロセスの状況について確認できます。
以下にオプション無しで指定した場合の結果を表示します。

# デーモンでない自分が実行したプロセスを表示
$ps
PID TTY          TIME CMD
2536 pts/0    00:00:00 bash
6999 pts/0    00:00:00 ps

以下を表示しています。

  • PID->プロセスID
  • TTY->仮想端末ファイル
  • TIME->プロセスが実際にCPUを使った時間
  • CMD->プロセスの実行コマンド

TTYについては以前記事を書きました。

ttyとかptsとかについて確認してみる

TIME列については別途以下に後述します。

TIME列でのCPU使用時間について

TIME列の説明をman psで確認すると以下のように表示されていました。

accumulated cpu time, user + system. The display format is usually "MMM:SS", but can be shifted to the right if the process used more than 999 minutes of cpu time.

CPU使用時間てある旨は記述されていますが、user + systemを表示しますと書いてあります。

ユーザーとシステムとはそれぞれ以下を示します。

  • ユーザーモード->ユーザープログラムが動作する際のCPUのモード。通常のアプリケーションが動作するモード
  • システムモード->システムプログラムつまりカーネルが動作するCPUモード

具体的にはユーザーモードはプログラムで時間のかかる演算などをしている場合で、システムモードは例えばファイルへの書き込みによってカーネルのwrite()のシステムコールなどを行うなどのタイミングとなります。

sarコマンドでは以下のようにCPU使用率でもユーザーとシステムが分かれて表示されています。

$sar
Linux 4.4.5-15.26.amzn1.x86_64 (ip-172-31-17-207)   2016年04月28日   _x86_64 (1 CPU)

22時00分01秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
22時10分01秒     all      0.02      0.00      0.01      0.00      0.00     99.97
22時20分01秒     all      0.00      0.00      0.00      0.00      0.00     99.99
22時30分01秒     all      0.00      0.00      0.01      0.00      0.00     99.99
22時40分01秒     all      0.00      0.00      0.00      0.00      0.00     99.99
22時50分01秒     all      0.01      0.00      0.01      0.00      0.00     99.98
23時00分01秒     all      0.00      0.00      0.00      0.00      0.00     99.99
23時10分01秒     all      0.03      0.00      0.02      0.00      0.00     99.95
23時20分01秒     all      0.01      0.00      0.00      0.00      0.00     99.98
平均値:      all      0.01      0.00      0.01      0.00      0.00     99.98

オプションを付けて追加の情報を取得する

私がよく使うオプションは以下です。

  • a->自分以外のユーザーのプロセスについても表示
  • x->デーモンプロセスを表示
  • u->ユーザー名と開始時刻を表示

上記でLinux上でどのようなプロセスが動作しているのか把握することができます。

以下に実行した例を記載します。

$ps aux |egrep 'PID|apache'|grep -v 'grep'
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
apache   27935  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/httpd
apache   27936  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/httpd
apache   27937  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/httpd
apache   27938  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/httpd
apache   27939  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/httpd
apache   27940  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/httpd
apache   27941  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/httpd
apache   27942  0.0  0.5 178544  5924 ?        S    11:46   0:00 /usr/sbin/http

表示する列が増えた事が確認できます。

  • USER->プロセスの実行ユーザー
  • %CPU->プロセスのCPU使用率(CPU利用時間/実際の時間)
  • %MEM->プロセスが確保している物理メモリを百分率で表示
  • VSZ、RSS->それぞれプロセスが仮想メモリ領域のサイズ、物理メモリ領域のサイズ。後述
  • STAT->プロセスの状態。後述

ややこしいものは以下に別途記述します。

複数のプロセスがある場合の親子関係などを確認する場合にはpstreeコマンドが便利です。

$pstree -p
init(1)─┬─agetty(2502)
        ├─atd(2469)
        ├─auditd(2086)───{auditd}(2087)
        ├─crond(2455)
        ├─dbus-daemon(2199)
        ├─dhclient(2034)
        ├─httpd(27933)─┬─httpd(27935)
        │              ├─httpd(27936)
        │              ├─httpd(27937)
        │              ├─httpd(27938)
        │              ├─httpd(27939)
        │              ├─httpd(27940)
        │              ├─httpd(27941)
        │              └─httpd(27942)
        ├─mingetty(2506)
        ├─mingetty(2509)
        ├─mingetty(2511)
        ├─mingetty(2513)
        ├─mingetty(2515)
        ├─mingetty(2518)
        ├─ntpd(2414)
        ├─rngd(2129)
        ├─rpc.statd(2168)
        ├─rpcbind(2147)
        ├─rsyslogd(2107)─┬─{rsyslogd}(2108)
        │                ├─{rsyslogd}(2110)
        │                └─{rsyslogd}(2111)
        ├─ruby(27669)───{ruby}(27670)
        ├─ruby(27831)───{ruby}(27833)
        ├─sendmail(2434)
        ├─sendmail(2443)
        ├─sshd(2642)─┬─sshd(29582)───sshd(29584)───bash(29585)───less(29634)
        │            └─sshd(29811)───sshd(29813)───bash(29814)───pstree(31314)
        ├─tmux(28357)─┬─bash(28358)
        │             └─bash(28379)───man(29341)───less(29352)

VSZ、RSS列について

VSZ(Virtual Set Size)はプロセスが確保した仮想メモリ領域のサイズ、RSS(Resident Set Size)は物理メモリ領域のサイズなので別の指標となっています。

LinuxなどのマルチタスクOSではプロセスがメモリを利用したい場合でも直接物理メモリを利用しません。
プロセスがメモリ要求を行うとカーネルが依頼を受け、物理メモリを抽象化した仮想メモリのアドレスを返却します。プロセスに仮想メモリのアドレスを返却した時点では物理メモリの領域は確保せず、プロセスがメモリに書き込みを行ったタイミングで物理メモリを確保します。

上記によって得られる利点は以下。

  • 実際の物理メモリの容量以上のメモリを扱えるかのようにプロセスに認識させることができる
  • 物理メモリ上ではバラバラに配置されたメモリアドレスでも、仮想メモリでは連続したメモリのアドレスに見せかけることができる
  • 物理メモリが不足した場合には、長時間使われていない仮想メモリと物理メモリ領域の対応を解除する。解除したデータはディスクに退避して必要になった時に戻す。いわゆるスワップ

大量のスワップが発生している場合、原因となっているプロセスは物理メモリを消費しているとうことなのでRSS列の値が高いもプロセスを確認する必要があります。

スワップを詳しく

以下IT用語辞典 スワップより引用

スワップとは、ハードディスクなどの補助記憶装置を利用して使用可能なメモリ容量を増やすOSの機能の一つ。
ハードディスク上に「スワップファイル」あるいは「スワップ領域」と呼ばれる専用の保存領域を用意して、メモリ容量が不足してきたら現在使われていないプログラム(プロセス)を一時的にスワップファイルに書き出して消去し、占有していたメモリを開放する。メモリからハードディスクに退避する動作を「スワップアウト」(swap-out)、ハードディスクからメモリに書き戻す動作を「スワップイン」(swap-in)という。

上記の通り、物理メモリの容量が少なくなった時に使われていないプロセスをスワップ領域(ディスク)に退避して物理メモリを確保する機能であると書いてあります。
上記によって物理メモリの確保はできるかもしれませんが、スワップアウトが発生するとディスクへの書き込みが発生するため、メモリの書き込みと比べるとかなり遅い動作となってしまいます。スワップインも同様にメモリと比べると遅い動作です。

つまり、物理メモリが不足し、スワップイン・スワップアウトが大量に発生する場合、システムのパフォーマンスはかなり遅くなってしまっていることが想定されるため、解消を行う必要があります。

また、以下に書いてあるように物理メモリの不足だけでなく、物理メモリの空き領域が断片化している場合にもスワップが発生するようです。

どうしてメモリはスワップするのか!?

sarコマンドでページがスワップアウト・インしている回数・バイト数について、確認する事ができるようなので確認してみます。

$sar -B
Linux 4.4.5-15.26.amzn1.x86_64 (ip-172-31-17-207)   2016年04月29日   _x86_64 (1 CPU)

00時00分01秒  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
00時10分01秒      0.00      0.42      7.45      0.00      8.06      0.00      0.00      0.00      0.00
00時20分01秒      0.00      0.37     14.21      0.00     12.76      0.00      0.00      0.00      0.00
00時30分01秒      0.00      1.94     39.31      0.00     37.60      0.00      0.00      0.00      0.00
平均値:       0.00      0.91     20.32      0.00     19.47      0.00      0.00      0.00      0.00

上記を見るとページアウト(メモリ->ディスクへの退避)は発生しているようですが、ページイン(ディスク->メモリへ書き戻す)は発生していないようです。つまり、利用されていないプロセスがページアウトしただけのようなので現状は特に問題はないと思われます。もし、ページインも同時に多発している場合にはディスクI/Oが大量に発生しているため、システムパフォーマンスが落ちている事が考えられ、対策が必要となります。

STAT列について

STAT列ではプロセスの状態を記載します。
試しに確認してみます。

$ps aux
SER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.2  19636  2588 ?        Ss   Apr28   0:00 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Apr28   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Apr28   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    Apr28   0:00 [kworker/0:0]
root         5  0.0  0.0      0     0 ?        S<   Apr28   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    Apr28   0:01 [rcu_sched]
root         8  0.0  0.0      0     0 ?        S    Apr28   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    Apr28   0:00 [migration/0]
root        10  0.0  0.0      0     0 ?        S    Apr28   0:00 [kdevtmpfs]
root        11  0.0  0.0      0     0 ?        S<   Apr28   0:00 [netns]
root        12  0.0  0.0      0     0 ?        S<   Apr28   0:00 [perf]
root        15  0.0  0.0      0     0 ?        S    Apr28   0:00 [xenwatch]
root        17  0.0  0.0      0     0 ?        S    Apr28   0:00 [kworker/u30:2]
root        20  0.0  0.0      0     0 ?        S    Apr28   0:00 [xenbus]
root        21  0.0  0.0      0     0 ?        S    Apr28   0:01 [kworker/0:1]
root       127  0.0  0.0      0     0 ?        S    Apr28   0:00 [khungtaskd]
root       128  0.0  0.0      0     0 ?        S<   Apr28   0:00 [writeback]
root       130  0.0  0.0      0     0 ?        SN   Apr28   0:00 [ksmd]
root       131  0.0  0.0      0     0 ?        SN   Apr28   0:00 [khugepaged]
root       132  0.0  0.0      0     0 ?        S<   Apr28   0:00 [crypto]
root       133  0.0  0.0      0     0 ?        S<   Apr28   0:00 [kintegrityd]
root       134  0.0  0.0      0     0 ?        S<   Apr28   0:00 [bioset]
root       136  0.0  0.0      0     0 ?        S<   Apr28   0:00 [kblockd]
root       483  0.0  0.0      0     0 ?        S<   Apr28   0:00 [md]
root       615  0.0  0.0      0     0 ?        S    Apr28   0:00 [kswapd0]
root       616  0.0  0.0      0     0 ?        S<   Apr28   0:00 [vmstat]
root       688  0.0  0.0      0     0 ?        S    Apr28   0:00 [fsnotify_mark]
root       707  0.0  0.0      0     0 ?        S<   Apr28   0:00 [kthrotld]
root       747  0.0  0.0      0     0 ?        S<   Apr28   0:00 [bioset]
root       751  0.0  0.0      0     0 ?        S<   Apr28   0:00 [deferwq]
root      1314  0.0  0.0      0     0 ?        S<   Apr28   0:00 [ata_sff]
root      1346  0.0  0.0      0     0 ?        S    Apr28   0:00 [scsi_eh_0]
root      1385  0.0  0.0      0     0 ?        S<   Apr28   0:00 [scsi_tmf_0]
root      1388  0.0  0.0      0     0 ?        S    Apr28   0:00 [scsi_eh_1]
root      1389  0.0  0.0      0     0 ?        S<   Apr28   0:00 [scsi_tmf_1]
root      1469  0.0  0.0      0     0 ?        S    Apr28   0:00 [jbd2/xvda1-8]
root      1470  0.0  0.0      0     0 ?        S<   Apr28   0:00 [ext4-rsv-conv]
root      1500  0.0  0.0      0     0 ?        S<   Apr28   0:00 [kworker/0:1H]
root      1518  0.0  0.2  10900  2064 ?        Ss   Apr28   0:00 /sbin/udevd -d
root      1596  0.0  0.0      0     0 ?        S<   Apr28   0:00 [kpsmoused]
root      1827  0.0  0.0      0     0 ?        S    Apr28   0:00 [kauditd]
root      1882  0.0  0.0      0     0 ?        S<   Apr28   0:00 [ipv6_addrconf]
root      2034  0.0  0.2   9360  2304 ?        Ss   Apr28   0:00 /sbin/dhclient
root      2086  0.0  0.2  46536  2236 ?        S<sl Apr28   0:00 auditd
root      2107  0.0  0.2 247380  2716 ?        Sl   Apr28   0:00 /sbin/rsyslogd
root      2129  0.0  0.0   4380    84 ?        Ss   Apr28   0:01 rngd --no-tpm=1
rpc       2147  0.0  0.2  35292  2180 ?        Ss   Apr28   0:00 rpcbind
rpcuser   2168  0.0  0.3  39860  3348 ?        Ss   Apr28   0:00 rpc.statd
dbus      2199  0.0  0.0  21792   232 ?        Ss   Apr28   0:00 dbus-daemon --s
ntp       2414  0.0  0.4  29288  4252 ?        Ss   Apr28   0:00 ntpd -u ntp:ntp
root      2434  0.0  0.4  88980  4368 ?        Ss   Apr28   0:00 sendmail: accep
smmsp     2443  0.0  0.3  80432  4016 ?        Ss   Apr28   0:00 sendmail: Queue
root      2455  0.0  0.2 119552  2380 ?        Ss   Apr28   0:00 crond
root      2469  0.0  0.0  17068   156 ?        Ss   Apr28   0:00 /usr/sbin/atd
root      2502  0.0  0.1   6460  1524 ttyS0    Ss+  Apr28   0:00 /sbin/agetty tt
root      2506  0.0  0.1   4312  1384 tty1     Ss+  Apr28   0:00 /sbin/mingetty
root      2509  0.0  0.1   4312  1484 tty2     Ss+  Apr28   0:00 /sbin/mingetty
root      2511  0.0  0.1   4312  1388 tty3     Ss+  Apr28   0:00 /sbin/mingetty
root      2513  0.0  0.1   4312  1488 tty4     Ss+  Apr28   0:00 /sbin/mingetty
root      2515  0.0  0.1   4312  1384 tty5     Ss+  Apr28   0:00 /sbin/mingetty
root      2518  0.0  0.1   4312  1388 tty6     Ss+  Apr28   0:00 /sbin/mingetty
root      2642  0.0  0.2  77832  3004 ?        Ss   Apr28   0:00 /usr/sbin/sshd
ec2-user 27669  0.0  0.8 135308  8576 ?        Sl   Apr28   0:00 ruby hoge.rb
ec2-user 27831  0.0  0.4 135276  4408 ?        Sl   Apr28   0:00 ruby deamon.rb
root     27933  0.0  0.6 178544  7048 ?        Ss   Apr28   0:01 /usr/sbin/httpd
apache   27935  0.0  0.5 178544  5924 ?        S    Apr28   0:00 /usr/sbin/httpd
apache   27936  0.0  0.5 178544  5924 ?        S    Apr28   0:00 /usr/sbin/httpd
apache   27937  0.0  0.5 178544  5924 ?        S    Apr28   0:00 /usr/sbin/httpd
apache   27938  0.0  0.6 178544  6696 ?        S    Apr28   0:00 /usr/sbin/httpd
apache   27939  0.0  0.5 178544  5924 ?        S    Apr28   0:00 /usr/sbin/httpd
apache   27940  0.0  0.5 178544  5924 ?        S    Apr28   0:00 /usr/sbin/httpd
apache   27941  0.0  0.5 178544  5924 ?        S    Apr28   0:00 /usr/sbin/httpd
apache   27942  0.0  0.5 178544  5924 ?        S    Apr28   0:00 /usr/sbin/httpd
root     27946  0.0  0.0      0     0 ?        S    Apr28   0:00 [kworker/u30:1]
ec2-user 28357  0.0  0.3  22360  3156 ?        Ss   Apr28   0:09 tmux
ec2-user 28358  0.0  0.3 115492  3588 pts/0    Ss+  Apr28   0:00 -bash
ec2-user 28379  0.0  0.3 115492  3472 pts/1    Ss   Apr28   0:00 -bash
ec2-user 29341  0.0  0.3 119220  3388 pts/1    S+   Apr28   0:00 man ps
ec2-user 29352  0.0  0.2 112616  2380 pts/1    S+   Apr28   0:00 less -s
root     29582  0.0  0.6 117796  6676 ?        Ss   Apr28   0:00 sshd: ec2-user
ec2-user 29584  0.0  0.3 117796  3904 ?        S    Apr28   0:00 sshd: ec2-user@
ec2-user 29585  0.0  0.3 115492  3572 pts/3    Ss   Apr28   0:00 -bash
ec2-user 29634  0.0  0.2 112616  2364 pts/3    S+   Apr28   0:00 less
root     29811  0.0  0.6 117796  6684 ?        Ss   00:38   0:00 sshd: ec2-user
ec2-user 29813  0.0  0.3 117796  4008 ?        S    00:38   0:00 sshd: ec2-user@
ec2-user 29814  0.0  0.3 115492  3572 pts/4    Ss   00:38   0:00 -bash
ec2-user 31284  0.0  0.2 117204  2556 pts/4    R+   01:07   0:00 ps aux

STAT列の1文字目はプロセスの以下を状態を表します。

  • R->実行可能状態なプロセス(実際に実行していないCPU割り当て待ちのプロセスも含む)
  • S->割り込み可能な待ち状態。主に復帰時間が予想できるもの。sleepやユーザーの入力待ちなど
  • D->ディスクIO待ちの状態
  • Z->ゾンビプロセス状態(親プロセスに待たれずに死んでしまった子プロセス)

2文字目以降は以下を表す状態のようです。

  • +->フォアグラウンドのプロセスグループ
  • s->セッションリーダー。httpdのプロセスを見るとrootユーザーで実行されているプロセスがセッションリーダーとなっているのでが分かる
  • 「<」->優先度が高いプロセス
  • N->優先度が低いプロセス
  • l->マルチスレッドのプロセス

スレッド情報を確認してみる

オプションを利用することでスレッド情報も合わせて確認できます。

# まずはpstreeで確認{}となっているのはスレッド
$pstree -p|grep mysqld
        |-mysqld_safe(31472)---mysqld(31669)-+-{mysqld}(31671)
        |                                    |-{mysqld}(31672)
        |                                    |-{mysqld}(31673)
        |                                    |-{mysqld}(31674)
        |                                    |-{mysqld}(31675)
        |                                    |-{mysqld}(31676)
        |                                    |-{mysqld}(31677)
        |                                    |-{mysqld}(31678)
        |                                    |-{mysqld}(31679)
        |                                    |-{mysqld}(31680)
        |                                    |-{mysqld}(31681)
        |                                    |-{mysqld}(31682)
        |                                    |-{mysqld}(31683)
        |                                    |-{mysqld}(31684)
        |                                    `-{mysqld}(31692)

# -Lオプションでスレッドを表示
$ps aux -L|egrep -e'mysqld|PID'
USER       PID   LWP %CPU NLWP %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     31472 31472  0.0    1  0.3 115212  3276 pts/4    S    01:32   0:00 /bin/sh /usr/libexec/mysql55/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql    31669 31669  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31671  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31672  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31673  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31674  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31675  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31676  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31677  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31678  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31679  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31680  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31681  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31682  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31683  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31684  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
mysql    31669 31692  0.0   16  4.3 540788 44692 pts/4    Sl   01:32   0:00 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
ec2-user 31779 31779  0.0    1  0.2 110476  2192 pts/4    S+   01:36   0:00 grep -E --color=auto -emysqld|PID

LWP列に軽量プロセスもしくはスレッドのID、NLWP列に総スレッド数を
が書いてありますね。

まとめ

psコマンドの表示されている列の詳細について確認する機会がなかったのですが、今回、まとめて確認ができて頭が整理できて良かったです。

167
155
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
167
155