特定のプロセスに関連するすべてのプロセスのPIDを見つける方法は?

特定のプロセスに関連するすべてのプロセスのPIDを見つける方法は?

他のプロセスのためにタスクを実行するプロセスのPIDやその他の情報をどのように見つけることができますか?kworkerたとえば、スレッドやカーネルの他のプロセスに対して作業を行う他のスレッド/プロセスについて話しています。

私のジレンマは、CPUアフィニティがCPU 0にバインドされたsched prio 99で実行されるリアルタイム予約プロセスを持っていますが、私の(SCHED_FIFO)コンピュータにCPU圧力を注入するときに重要なrtプロセスが重要ではない他のプロセスを先取りしないことです。プロセス。おそらく、とに-aオプションを指定したkworkersにもかかわらず、tasksetこの重要なプロセスを担当するプロセスがメインプロセスの優先順位を継承しないためですchrt。現在の私の考えは、スレッドを手動でtaskset操作してRT以外のプロセスがプリエンプトしないようにすることです。chrtkworker

ベストアンサー1

開始されたプロセスのPIDがわかっている場合は、そのプロセスで開始されたすべてのジョブのツリーを取得できますps

$ ps f -g2305957
    PID TTY      STAT   TIME COMMAND
2305957 pts/20   Ss     0:00 bash
2310399 pts/20   S+     0:00  \_ stress -t 300 -c 16
2310400 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310401 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310402 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310403 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310404 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310405 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310406 pts/20   R+     0:23      \_ stress -t 300 -c 16
2310407 pts/20   R+     0:25      \_ stress -t 300 -c 16
2310408 pts/20   R+     0:22      \_ stress -t 300 -c 16
2310409 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310410 pts/20   R+     0:25      \_ stress -t 300 -c 16
2310411 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310412 pts/20   R+     0:23      \_ stress -t 300 -c 16
2310413 pts/20   R+     0:24      \_ stress -t 300 -c 16
2310414 pts/20   R+     0:25      \_ stress -t 300 -c 16
2310415 pts/20   R+     0:22      \_ stress -t 300 -c 16

これはstress16のスレッドで実行されます。関連この回答

おすすめ記事