Explaination from David Woodhouse about meaning of thread groups.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3385 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/THREADS_SYSCALLS_SIGNALS.txt b/THREADS_SYSCALLS_SIGNALS.txt
index e9b3f79..3f06d71 100644
--- a/THREADS_SYSCALLS_SIGNALS.txt
+++ b/THREADS_SYSCALLS_SIGNALS.txt
@@ -241,3 +241,53 @@
 
     J
 
+--------------------------------------------------------------------
+
+Re:   Fwd: Documentation of kernel's signal routing ?
+From: David Woodhouse <...>
+To:   Julian Seward <jseward@acm.org>
+
+> Regarding sys_clone created threads.  I have a vague idea that 
+> there is a notion of 'thread group'.  I further understand that if 
+> one thread in a group calls sys_exit_group then all threads in that
+> group exit.  Whereas if a thread calls sys_exit then just that
+> thread exits.
+> 
+> I'm pretty hazy on this:
+
+Hmm, so am I :)
+
+> * Is the above correct?
+
+Yes, I believe so.
+
+> * How is thread-group membership defined/changed?
+
+By specifying CLONE_THREAD in the flags to clone(), you remain part of
+the same thread group as the parent. In a single-threaded process, the
+thread group id (tgid) is the same as the pid. 
+
+Linux just has tasks, which sometimes happen to share VM -- and now with
+NPTL we also share other stuff like signals, etc. The 'pid' in Linux is
+what POSIX would call the 'thread id', and the 'tgid' in Linux is
+equivalent to the POSIX 'pid'.
+
+> * Do you know offhand how LinuxThreads and NPTL use thread groups?
+
+I believe that LT doesn't use the kernel's concept of thread groups at
+all. LT predates the kernel's support for proper POSIX-like sharing of
+anything much but memory, so uses only the CLONE_VM (and possibly
+CLONE_FILES) flags. I don't _think_ it uses CLONE_SIGHAND -- it does
+most of its work by propagating signals manually between threads.
+
+NTPL uses thread groups as generated by the CLONE_THREAD flag, which is
+what invokes the POSIX-related thread semantics.
+
+>   Is it the case that each LinuxThreads threads is in its own
+>   group whereas all NTPL threads [in a process] are in a single
+>   group?
+
+Yes, that's my understanding.
+
+-- 
+dwmw2