1

如何用top查看每个进程的线程

 9 months ago
source link: https://charon-cheung.github.io/2023/10/17/Linux%E5%9F%BA%E7%A1%80/%E5%A6%82%E4%BD%95%E7%94%A8top%E6%9F%A5%E7%9C%8B%E6%AF%8F%E4%B8%AA%E8%BF%9B%E7%A8%8B%E7%9A%84%E7%BA%BF%E7%A8%8B/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

如何用top查看每个进程的线程 | 沉默杀手

如何用top查看每个进程的线程
2023-10-17|Linux基础|
Word count: 192|Reading time: 1 min

程序中创建的线程(也称为轻量级进程,LWP)会具有和程序的PID相同的“线程组ID”。各个线程会获得其自身的线程ID

列出由进程号为的进程创建的所有线程

ps -T -p <pid>

SID栏表示线程ID,而CMD栏则显示了线程名称

还可以通过htop查看单个进程的线程,它是一个基于ncurses的交互进程查看器。该程序允许你在树状视图中监控单个独立线程。

开启htop,然后按<F2>进入htop的设置菜单。选择“设置”栏下面的“显示选项”,然后开启“树状视图”和“显示自定义线程名”选项。按<F10>退出设置。

©2018 - 2023 By Charon Cheung
Driven - Hexo|Theme - Melody

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK