pthreads and number of processes in uClinux - Embedded

This is a discussion on pthreads and number of processes in uClinux - Embedded ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: pthreads and number of processes in uClinux

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

  2. Re: pthreads and number of processes in uClinux

    tns1 wrote:
    > 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.


    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

  3. Re: pthreads and number of processes in uClinux

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


    Does the posix pthread library just use glibc / uclibc ?

    > In the current nptl implementation this additional thread is gone. Sorry,
    > but I don't know how relevant this is for uClinux.
    >


    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 Thread