Can you post the output of the command /lib/libc-2.x.x.so?
Look out for the kind of thread implementation you are using. If its linuxthreads then you are using an old (and not very POSIX compliant) threading library on linux. On linux 2.6 you have the option of NPTL support in glibc which is a newer better threading library which shouldn't show you this weirdness.
linuxthreads uses a separate "helper thread" for managing the other threads of a process. This explains your extra thread.
Look out for the kind of thread implementation you are using. If its linuxthreads then you are using an old (and not very POSIX compliant) threading library on linux. On linux 2.6 you have the option of NPTL support in glibc which is a newer better threading library which shouldn't show you this weirdness.
linuxthreads uses a separate "helper thread" for managing the other threads of a process. This explains your extra thread.
Ritesh
On 7/19/06, Parav Pandit <paravpandit@xxxxxxxxx> wrote:
Hi,
I have created 4 threads in my linux system using
pthread_create() API.
Each thread does nothing but just sleeps using
sleep().
e.g.
int main()
{
pthread_create(thread1);
pthread_create(thread2);
pthread_create(thread3);
pthread_create(thread4);
while(1) {
};
return 0;
}
Here are the results of "top".
Before running above program,
total process = 35
sleeping process = 34,
running = 1.
After running about program,
total process = 41
sleeping process = 39,
running = 2.
Can somebody give me justification for this addition
of one more process for this?
We know that threads = processes = task_struct in
kernel when it comes to scheduling them.
But why there is an overhead of one more
thread/process?
Regards,
Parav Pandit
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/