Re: pthread_create creating 2 threads on first call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 20, 2002 at 01:50:48PM -0800, Usman S. Ansari wrote:
> Don,
> 
> Two points.
> 
> (1) I was under the impression that pthreads share everything except stack under Linux
>     implementation, I quote you "... because these "threads" are full blown processes ..."

Of course they are! That does not mean, your impression was not right.
It was right. The threads share everything but stack (plus signals
are handled in the master thread).

The thing is, that a process is designated by task_struct kernel
structure. Anything with task_struct (in kernel) has all properties of
a process and nothing can have any property of a process without one.
This structure referes to substructures for things like memory map, file
descriptor array, signal handler array etc. (and includes parameters
like pid, priority, identity etc.). All those substructures are
reference-counted and can be shared between any number of processes.
That does not make them less a processes. When one of them dies,
ref-count is dropped, others continue to use it...

> (2) When one of the thread gets a signal, say signal 11, than core is dumped. Recently, my
>     application was coring. Looking at the stack trace, it always showed one of the thread
>     which is sleeping most of the time on select call was getting the signal. In reality, the
>     cause of the problem was another thread, found out after some strugle.

That probably was the mentioned manager thread. It sleeps on a request
queue most of the time.

>     My understanding is binfmt_elf.c dumps core of all relavent pages, including stacks of all
>     the threads, it was gdb which was not pthread aware ???

I suppose so. I however recently looked at core-dump of threaded program
that crashed on SIGFPE and gdb showed the right point that caused the
fault. I have glibc 2.3.1-5 and gdb 5.2.cvs20020818-3 (from debian). So
I suppose the recent gdb snapshots handle linuxthreads.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux