On Mon, Jul 14, 2003 at 07:58:11PM +0200, Ralf S. Engelschall wrote:

> In Pth only the (original) stack of the main thread is auto-growing
> (done by the OS), while the other stacks are fixed size stacks. If you
> don't have very high recursion levels or other functions uses large
> buffers on the stack, this is no problem. But if you require really lots
> of stack space, you should be careful or at least spawn the Pth threads
> with a larger stack size.

This is especially great to know if an application requires an unknown
recursive depth in a function, in which case it would probably be best to
either use an iterative method or to dedicate a thread or process to
execute that part and return the results back...

That is what mmftpd has to currently do for a tree size evaluation function
which uses alot of recursion... Slaves processes are started at application
launch, and a thread is dedicated to provide a syscall-like interface to
them in a pth-safe manner so that all threads can make use of their
functionality (and sleep until their results come back without causing other
threads to sleep). This also somewhat permits use of SMP advantages where
available for this expensive function...

That amiga exec-like message port API was great to have to implement this.

Matt

______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
Development Site                      http://www.ossp.org/pkg/lib/pth/
Distribution Files                          ftp://ftp.gnu.org/gnu/pth/
Distribution Snapshots                 ftp://ftp.ossp.org/pkg/lib/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to