From owner-freebsd-threads@FreeBSD.ORG Sun Jul 18 21:58:03 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9EF3916A4CE for ; Sun, 18 Jul 2004 21:58:03 +0000 (GMT) Received: from vn1173.fireboxhosting.com (vn1173.fireboxhosting.com [205.237.202.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 46F1B43D2F for ; Sun, 18 Jul 2004 21:58:03 +0000 (GMT) (envelope-from alex@hightemplar.com) Received: from 212-150-124-244.barak.net.il ([212.150.124.244] helo=hydralisk) by vn1173.fireboxhosting.com with esmtp (Exim 4.34) id 1BmJfV-0005kH-JJ for threads@freebsd.org; Sun, 18 Jul 2004 17:58:02 -0400 From: Alex Keahan To: threads@freebsd.org Date: Mon, 19 Jul 2004 00:57:14 +0300 User-Agent: KMail/1.5.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200407190057.14164.alex@hightemplar.com> Subject: Re: A way to build and install libpthread as 1:1 as well as M:N? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2004 21:58:03 -0000 On Sunday 18 Jul 2004 7:30 pm, Daniel Eischen wrote: > On Sun, 18 Jul 2004, Robert Watson wrote: > > I'm doing some stability and performance testing as part of the network > > stack locking work. I'd like a way to easily plug and play the > > configuration of libpthread at run-time (although restarting apps is > > fine, rebooting is less preferable, as is actually rebuilding!). It > > looks like right now if I want to switch the operating mode of libpthread > > to 1:1, I have to recompile it with different compile options and have a > > separate library floating around that I plug. Could we arrange for it to > > be a runtime switch of some sort (perhaps read once when the app starts), > > or build the library both ways by default and intall with different > > names? > > The way to do this so it is switchable without relinking > the application (and without using libmap.conf) is to use > LD_LIBRARY_PATH. You can install libpthread built as 1:1 > anywhere you like and just set LD_LIBRARY_PATH to wherever > it is installed. > > If you want both 1:1 and M:N versions of libpthread installed > by default, we have to decide where to install the 1:1 version. > I would recommend 1:1 go in lib/lwp/libpthread.so.1 and M:N > in lib/libpthread.so.1. You could change "lwp" to "kse" > or something else. How about: M:N libpthread: /usr/lib/libpthread.so 1:1 libpthread: /usr/lib/lwp/libpthread.so 1:1 libthr: /usr/lib/thr/libpthread.so? or M:N libpthread: /usr/lib/libpthread.so 1:1 libpthread: /usr/lib/kse/libpthread.so 1:1 libthr: /usr/lib/lwp/libpthread.so? I think all the POSIX thread libraries should be called "libpthread.so" instead of libpthread, libthread, libc_r. Then you can compile things once and select the library you want at runtime by setting the dynamic linker search path (or at link time using the -R linker switch.) In essense, this would be similar to Solaris. Solaris 8 has two POSIX threads libraries (libpthread.so): M:N, located in /usr/lib (32-bit) and /usr/lib/sparcv9 (64-bit), and 1:1, located in /usr/lib/lwp (32-bit) and /usr/lib/lwp/sparcv9 (64-bit) Solaris 9 has only one libpthread (1:1) in: /usr/lib (32-bit) and /usr/lib/sparcv9 (64-bit) (Their 1:1 libpthread is probably more like our "libthr" than "libkse/libpthread in 1:1 mode".) As a side note, Solaris also has a "libthread" which is *not* a POSIX thread library - it implements "Solaris threads" - it's *not* like our libthr which implements *POSIX threads*. Alex Keahan