Search code examples
linuxprocess

Multiple processes with the same name


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

...the output shows multiple entries of '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?


Solution

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

    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:

    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).

    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.

    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.