[PATCH] Dynamic thread stack size
Joe Marcus Clarke
marcus at FreeBSD.org
Thu Jan 20 23:46:57 PST 2005
In a follow-up to the previous discussion on increasing our default
thread stacksize, I thought I'd look at how some other BSD
implementations do it. Mezz mentioned that he thought NetBSD had a 2 MB
default stacksize, so I took a look.
What I found was that NetBSD doesn't have a static default stacksize.
Instead, they use the stacksize rlimit and a PTHREAD_STACKSIZE
environment variable to get both the initial stacksize as well as each
thread's default stacksize. I thought this would be a really good way
of doing things, so I ported their work to FreeBSD.
Here is a patch against 5-STABLE's libpthread (also applies to HEAD)
that adds a dynamic thread stacksize. This can be disabled at compile
time by uncommenting the -DTHR_FIXEDSTACKSIZE CFLAG in the Makefile.
Initial testing shows this does the trick with applications such as
gstreamer and Evolution that require a larger initial thread stacksize
and per-thread default stacksize respectively. What do you think?
http://www.marcuscom.com/downloads/libpthread.diff
Joe
--
Joe Marcus Clarke
FreeBSD GNOME Team :: gnome at FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-threads/attachments/20050121/7e6e5f0e/attachment.bin
More information about the freebsd-threads
mailing list