Red Hat Bugzilla – Bug 89942
2nd+ forked processes only show up in ps as threads
Last modified: 2007-04-18 12:53:23 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312
Description of problem:
If an application forks more than once, the processes beginning with the seconf
fork and on will not show up in the ps -ef output. They do show up in the ps
-efm output. Specifying ps -p $pid_num will also display the correct
information. The proc filesystem DOES have the correct information for the
The following program can be used to reprod
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Compile the following program. gcc -o pid_test pid_test.c
pid = fork();
if(pid == 0)
printf("Child1 pid == %d\n",pid);
pid = fork();
if(pid != 0)
printf("Child2 pid == %d\n", pid);
2. Run the program: ./pid_test
3. ps -ef | grep pid_test
Actual Results: You will only see listing for two instances of pid_test.
run the following command: ps -efm | grep pid_test
and you will see all three processes.
Expected Results: all three processes should be listed. The fork call should
not prodice a light-weight process.
This is due to the way "threads" are detected in ps. Basically it just looks for
children with the exact same VMSIZE as the parent. If the child does any real
work it will typically not show up like this.
This is fixed in RHL 9 with then new threading model (NPTL).