查看proc手册页(http://man7.org/linux/man-pages/man5/proc.5.html),可以通过查看flags值(PF_KTHREAD)来检测哪些进程是/proc/<pid>/stat中的内核线程。
flags %u (%lu before Linux 2.6.22)
(9) The kernel flags word of the process. For bit
meanings, see the PF_* defines in the Linux kernel
source file include/linux/sched.h. Details depend
on the kernel version.这个进程标志(PF_KTHREAD)似乎不存在于内核版本2.6.18 (在RHEL5中使用),该值由一个不同的标志使用。
是否有另一种方法来确定pid是否是内核线程?
发布于 2013-10-18 17:10:51
在3.8系列内核上内核线程的/proc条目中,很明显,exe链接是空的,statm中满是零,status缺少所有Vm*条目,maps也是空的。
其中一些可能适用于所讨论的旧内核。
https://unix.stackexchange.com/questions/96651
复制相似问题