「実行中の」プロセスがそれほど少ないのはなぜですか?

「実行中の」プロセスがそれほど少ないのはなぜですか?

すべてのBSD / Linux / MacOSとSolarisで私は観察しました。システムがいくら忙しくても、常にtop実行中のプロセスはほとんど報告されません(通常1〜2つ)。

限られた理解によると、プロセスは、CPU時間が使用中であるか、CPU時間が使用可能になるのを待っている場合は「実行中」状態です。

シナリオは次のとおりです。 SSHを使用してVNCトンネルを設定し、topリモートシステムのターミナルエミュレータでそれを実行します。

  • topそれ自体は「実行中」のプロセスとしてリストされます(理解可能)。
  • sshd記載されていますが、「実行中」ではありません。
  • Xvnc記載されていますが、「実行中」ではありません。

しかし、sshdトンネルされたVNCトラフィックXvncは私の画面を更新し続けますが、どのようにCPU時間を使用しないのですか?

CPU時間を使用している場合、なぜ「実行」されないのですか?

ベストアンサー1

時間の問題だと思います。topN秒ごとにCPUの状態を確認してください。検査を実行するときtop持つシステム状態を積極的に確認しているため有効になります。これを確認する良い方法は、更新時間を短縮し、topプロセスの進行状況を確認することです!提案されているようにman top

   o  The  user  interface,  through  prompts and help, intentionally
      implies that the delay interval is limited to tenths of a  sec‐
      ond.   However,  you're  free to set any desired delay.  If you
      want to see Linux at his scheduling best, try a  delay  of  .09
      seconds or less.

      For this experiment, under x-windows open an xterm and maximize
      it.  Then do the following:
        . provide a scheduling boost and tiny delay via:
            nice -n -10 top -d.09
        . keep sorted column highlighting Off so as to
          minimize path length
        . turn On reverse row highlighting for emphasis
        . try various sort columns (TIME/MEM work well),
          and normal or reverse sorts to bring the most
          active processes into view

      What you'll see is a very busy Linux  doing  what  he's  always
      done  for you, but there was no program available to illustrate
      this.

これを試してみると、より多くのプロセスがモードRに入ることを確認できます。また、topバッチモードで数回実行を試み、実行中とマークされたプロセスを収集することもできます。

sudo nice -n -10 top -d.09 -bn 100 | awk '$8~/R/{print $NF}' | sort -u

私のシステムでは、現在のロード状態(パブリックSSHトンネルを含む)から次のプロセスを取得します。

cinnamon
firefox
kworker/0:1
kworker/1:2
kworker/2:2
kworker/3:0
plugin-containe
ssh
tint2
top
Xorg

おすすめ記事