pthreads and number of processes in uClinux
I noticed that when I had a simple non-threaded app, I would see a
single process in the $ps listing whenever it ran. Now that I have an
app that creates a single helper pthread, $ps shows three processes
during runtime. Why is that?
I am using mutexes. Does the third process represent these?
If I kill the first or last process by pid, they all get killed too, but
if I kill the 2nd by pid, nothing happens.
Re: pthreads and number of processes in uClinux
tns1 wrote:[color=blue]
> I noticed that when I had a simple non-threaded app, I would see a
> single process in the $ps listing whenever it ran. Now that I have an
> app that creates a single helper pthread, $ps shows three processes
> during runtime. Why is that?
> I am using mutexes. Does the third process represent these?
>
> If I kill the first or last process by pid, they all get killed too, but
> if I kill the 2nd by pid, nothing happens.[/color]
Its the behavior of GNU libc's old linux-thread implementation. It uses
always one additional management thread if the process contain more than
one thread. So you see one thread or at least three threads per process.
If you kill your main thread or the management thread you kill the whole
process.
In the current nptl implementation this additional thread is gone. Sorry,
but I don't know how relevant this is for uClinux.
JB
Re: pthreads and number of processes in uClinux
> Its the behavior of GNU libc's old linux-thread implementation. It uses[color=blue]
> always one additional management thread if the process contain more than
> one thread. So you see one thread or at least three threads per process.
> If you kill your main thread or the management thread you kill the whole
> process.[/color]
Does the posix pthread library just use glibc / uclibc ?
[color=blue]
> In the current nptl implementation this additional thread is gone. Sorry,
> but I don't know how relevant this is for uClinux.
>[/color]
There is a 14 page paper in the net on uclibc and NPTL. I d/l'ed it this
morning, but I did not yet read it. I heard it does not handle non
MMU-CPUs, which might or might not need special considerations due to
fork/vfork issues.
-Michael