1. It's an implementation thing: the pthreads library spawns an extra process - the master - which manages all the threads. 2. There's the extra process transparently created by the library. With an empty function body, it's obvious that your thread is exiting immediately, so you're seeing what's left after it exits: the original (main) process and the thread manager process. Note that what you're seeing is _processes_ (of the underlying pthreads implementation) and not _threads_. Logically, the number of threads is what you would expect (N-1). Check out section 4.5 in http://www.advancedlinuxprogramming.com/alp-folder/alp-ch04-threads.pdf. -----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Jan Krause Sent: Monday, January 05, 2004 7:45 PM Cc: kernelnewbies@nl.linux.org Subject: Re: pthread creates one extra thread Hi, 1. Whats the difference between original and master thread? 2. I only see 2 threads started, namely the main thread ( void main () ) and the one created with pthread_create... but if this thread immediately exits as you said, there should only be 1 left: the main () thread, but thats not the case. Where is my fault? On Mon, 05 Jan 2004 19:02:14 -0500 Rob Love <rml@ximian.com> wrote: > On Mon, 2004-01-05 at 18:28, Jan Krause wrote: > > I found out that if you uncomment the while line in the my_func_1 function, > > your code works as wished and creates 2 threads. > > > > Unfortunately I dont really know why the while loop is unnecessary. ;) > > If you get rid of the while loop, the thread exits immediately. > > And thus you will see a total of two threads (the original thread and > the master thread). > > Rob Love > > > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/