Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jan 2005 02:46:46 -0500
From:      Joe Marcus Clarke <marcus@FreeBSD.org>
To:        threads@FreeBSD.org
Subject:   [PATCH] Dynamic thread stack size
Message-ID:  <1106293606.11662.20.camel@shumai.marcuscom.com>

next in thread | raw e-mail | index | archive | help

--=-1U1q414SiXPHFJkb9jxF
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

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

--=20
Joe Marcus Clarke
FreeBSD GNOME Team      ::      gnome@FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

--=-1U1q414SiXPHFJkb9jxF
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iD8DBQBB8LNmb2iPiv4Uz4cRApkUAJsEw93zcpMdU9Jud0B0TypCjdWB+QCfQvZD
FEj/u6GC+UibcQz8Q9wQdIQ=
=il8/
-----END PGP SIGNATURE-----

--=-1U1q414SiXPHFJkb9jxF--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1106293606.11662.20.camel>