signalling remote threads

Julian Elischer julian at
Sat Mar 10 00:42:46 UTC 2007

Martin Blapp wrote:
> Hi,
>> There is no portable way to identify threads in another process. There 
>> is also no guarantee that the tread is even externally visible. Take
> But is it true for FreeBSD that 'ps -Hauxwww' should show all threads
> for a process with libc_r,, or ?


libc_r will only have one line in ps even if there are 10,000 threads
because they are an internal 'figment of the imagination of the process".
There is NO externally visible sign of them esxcept for the behaviour 
of the process. (it does a lot of async operations).

Similarly for libpthread, it will show SOME threads but not as many 
as there are threads in the process because only threads that are blocked
for IO in the kernel or are actually running at that instant will
show up. Threads that are not running or blocked in the kernel
are, once again just figments of the imagination of the process.
If you run a libpthread process with LIBPTHREAD_SCOPE_SYSTEM set to 'yes'.
then it will switch to 1:1 mode and there will be a kernel thread 
instantiated for each thread in the process and yes you will 
see them in ps -H.  

libthr will always show all the threads because it is basically the
equivalent and optimised version of libpthread with 
LIBPTHREAD_SCOPE_SYSTEM set. It only runs in that mode.

> -- 
> Martin

More information about the freebsd-threads mailing list