Re: [Fwd: Adding GThreadPool API to set per-thread stack size]



On Tue, 2004-07-27 at 03:48, Sebastian Wilhelmi wrote:
> Hi Joe,
> 
> > The latest release of gnome-cups-manager exposed a problem with
> > GThreadPools on FreeBSD.  Each thread in a thread pool can only have the
> > default thread stack size.  On FreeBSD, this is 64 KB on most
> > architectures.  As it turns out, this is not big enough to do CUPS
> > operations within a thread, and thus gnome-cups-manager crashes with a
> > stack overflow.
> 
> This indeed is unfortunate. On Linux you get some MB (maximum on i386 is
> 8 MB, can be limited by ulimit -s) virtual memory of stack for every
> thread. Of course physical memory is only mapped, if it really is used.
> 
> The point with thread pools is, that the threads can be reused. That
> however means that you have to use the standard values for stack size
> and so on to avoid having to have pools for every parameter combination.

Then what about adding something like:

static gulong g_thread_default_stack_size;

Similar to g_thread_min_stack_size.  This stack size could be a
reasonable default (e.g. 1 MB).  Programmers could change this still
using g_thread_create_full() with a different stack_size parameter that
was > g_thread_min_stack_size.

[snip]

> 
> g_thread_pool_new has been changed to only take less arguments just to
> make reusing threads possible. The only option I see right _now_ is to
> not use thread pools for gnome-cups-manager, (which of course I wouldn't
> like as the author of glib thread pools). In the long run a function
> 
> g_thread_pool_set_minimal_stack_size (size)
> 
> could be added to simply set the minimal stacksize for all threads in
> the thread pool.

I think something that was universal to all g_threads might be more
beneficial the more I think about this.

Joe

> 
> What about adding a bugzilla bug for that, such that it don't get lost.
> 
> Bye,
> Sebastian
-- 
Joe Marcus Clarke
FreeBSD GNOME Team	::	gnome FreeBSD org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

Attachment: signature.asc
Description: This is a digitally signed message part



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