ps/top doesn't show the process on a smp kernel ;)

From: khandelw
Date: Sun Mar 28 2004 - 11:27:05 EST


Hello,
This is the simple program that I tried on a - 2.4.20-30.9smp #1 SMP Wed Feb
4 20:36:46 EST 2004 i686 i686 i386 GNU/Linux (kernel) machine.

The ps command doesn't show me the process. /proc/ shows that these process are
present in the system. When I uncomment the call getpid(). Then it shows me the
process. I am not able to understand this behavior and I hope this is the right
place to post this question/bug.


<snip>

#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
int i = 3;
pid_t pid, pidarr[3];

for(i = 0; i < 3;i ++) {
if ( (pid = fork()) == 0) {
while(1){
/* getpid(); */
}
}
pidarr[i] = pid;
}
for(i = 0; i < 3;i ++) {
waitpid(pidarr[i], NULL, 0);
}
return 0;
}

</snip>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/