具有相同名称的多个进程 [英] Multiple processes with the same name

查看:497
本文介绍了具有相同名称的多个进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Linux 2.6.13和WindRiver Linux 3.0上运行的应用程序.在Linux 2.6.13中,当我执行...

I have an application running on Linux 2.6.13 and WindRiver Linux 3.0. In Linux 2.6.13 when I do...

ps -eaf | grep myapplication

...输出显示"myapplication"的多个条目.

...the output shows multiple entries of 'myapplication'.

如果在WindRiver Linux 3.0中给出相同的命令,则输出仅显示"myapplication"的一个条目.

If I give the same command in WindRiver Linux 3.0, the output shows only one entry of 'myapplication'

差异是否与所用操作系统的差异有关?请告诉我这样做的原因吗?

Is the difference related to the difference in OS used? Kindly tell me the reason for this?

推荐答案

它可能与使用中的线程库和/或内核版本有关.

It's probably related to the threading library in use and/or kernel version.

旧的(现在非常旧的)"Linuxthreads"线程库,用于将每个线程显示为顶级"进程,该进程将直接出现在/proc下并具有不同的PID.这是它的许多缺点之一,已通过以下方式解决:

The old (now very old) "Linuxthreads" threading library, used to show each thread as a "top-level" process, which would appear directly under /proc and have a distinct PID. This was one of its many drawbacks, which were fixed by:

新的(现在不是很新的)"NPTL"线程库已经在每个新的发行版中包含了很多年,可以使用内核功能使线程出现在相同的PID下.线程仍然存在,但是现在在/proc中的任务"子目录下,因此通常被"ps"忽略(如果需要,您仍然可以看到它们,并带有适当的选项).

The new (now not very new) "NPTL" threading library, which has for many years been included in every new distribution, can use kernel features to make the threads appear under the same PID. The threads are still there but are now under a "task" subdirectory in /proc so are normally ignored by "ps" (You can still see them if you want, with an appropriate option).

这两个库都实现了posix线程API(或多或少;更新的比旧的更多).我希望所讨论的进程是多线程的.

Both libraries implement the posix threads API (more-or-less; newer ones do more than the older ones). I expect the processes in question were multithreaded.

如果很久以前就已经静态链接了与Linuxthreads链接的程序,那么仍然有可能看到它们.现代内核对此也很好.

It is still possible to see programs linked with Linuxthreads if they were statically linked a long, long time ago. Modern kernels support this just fine.

这篇关于具有相同名称的多个进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆