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.

Reply to
tns1
Loading thread data ...

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

Reply to
Juergen Beisert

Does the posix pthread library just use glibc / uclibc ?

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

Reply to
Michael Schnell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.