Date: Mon, 21 Dec 2009 10:09:44 -0500 From: John Baldwin <jhb@freebsd.org> To: freebsd-threads@freebsd.org Subject: Re: disable threads when recompiling libc Message-ID: <200912211009.44660.jhb@freebsd.org> In-Reply-To: <26d2cb010912202315g574353d9g872643d1717f4f86@mail.gmail.com> References: <26d2cb010912202315g574353d9g872643d1717f4f86@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 21 December 2009 2:15:13 am leon zadorin wrote: > Hi, > > is it possible to configure libc to be recompiled in a single-threaded > model only (i.e. disable any additional overhead for handling > thread-safety). > > Basically what I'd like to do is to build a separate non-multithreaded > copy of libc and use it with the rest of "single threaded > environment": > > recompiled gcc (./configure --disable-threads), etc. > c++ boost libs in non-multithreaded mode and so on > > I would like to see if there are any additional performance-benefits > to this (my program does not need to be multi-threaded). > > I think compiler itself can produce more optimisations (various > speculative loads et al) if it is building code for single-threaded > model only... I wonder if there are also "single-threaded" performance > benefits to libc et al ? libc already conditionalizes all the extra multi-thread protection on __isthreaded which only gets set to 1 the first time pthread_create() is invoked, so all you would be able to test is removing several 'if (__isthreaded)' tests. You could perhaps make use of this to build a test libc though by #defining __isthreaded to 0 and relying on the compiler to eliminate all the conditional threading code as dead code. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912211009.44660.jhb>