From owner-cvs-all@FreeBSD.ORG Mon May 5 06:08:28 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 05CB237B401 for ; Mon, 5 May 2003 06:08:28 -0700 (PDT) Received: from mailout08.sul.t-online.com (mailout08.sul.t-online.com [194.25.134.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A17A43FB1 for ; Mon, 5 May 2003 06:08:26 -0700 (PDT) (envelope-from Alexander@Leidinger.net) Received: from fwd01.sul.t-online.de by mailout08.sul.t-online.com with smtp id 19CfhU-00077f-02; Mon, 05 May 2003 15:08:12 +0200 Received: from Andro-Beta.Leidinger.net (520065502893-0001@[217.83.18.136]) by fmrl01.sul.t-online.com with esmtp id 19CfhQ-0WN5ySC; Mon, 5 May 2003 15:08:08 +0200 Received: from Magelan.Leidinger.net (Magelan [192.168.1.1]) h45D863G068458; Mon, 5 May 2003 15:08:06 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from Magelan.Leidinger.net (netchild@localhost [127.0.0.1]) by Magelan.Leidinger.net (8.12.9/8.12.9) with SMTP id h45D86Ix001899; Mon, 5 May 2003 15:08:06 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Date: Mon, 5 May 2003 15:08:05 +0200 From: Alexander Leidinger To: Wesley Morgan Message-Id: <20030505150805.6f56bb1c.Alexander@Leidinger.net> In-Reply-To: <20030418113144.K93085@volatile.chemikals.org> References: <20030418113144.K93085@volatile.chemikals.org> X-Mailer: Sylpheed version 0.8.10claws (GTK+ 1.2.10; i386-portbld-freebsd5.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Sender: 520065502893-0001@t-dialin.net cc: eischen@pcnet1.pcnet.com cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libpthreadMakefilesrc/lib/libpthread/thread thr_attr_get_np.c thr_attr_init.c thr_attr_setcreatesuspend_np.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 May 2003 13:08:28 -0000 On Fri, 18 Apr 2003 11:34:59 -0400 (EDT) Wesley Morgan wrote: > Ok, I'm a but confuzzled by all these threading libraries. Now we have > libc_r, libthr, and libpthread? How can I alter the behavior of "-pthread" Yes. > to use a different library? As far as I can tell, only libc_r is actually There's no official way to alter the behavior at compile time. Either you replace libc_r by e.g. libthr, or you link against one of it by hand. (... or you modify the binary by hand (s/libc_r/libthr/)) > linked in with a buildworld, so when is it planned to make these > available? What are the advantages and disadvantages? Which library is > more complete? Can someone do a summary of some sort to help out the > consumers? All of those libs are supposed to implement the POSIX Thread API. libc_r works completely in userland, so you don't get a benefit from more than one CPU in _one_ program (e.g. a program with 2 independent threads doesn't use 2 CPUs at the same time, even if it could). libthr and libpthread are based upon the KSE framework in the kernel. libthr uses a 1:1 model, every POSIX thread is mapped to a kernel thread, the threads in the example program above could run on 2 CPUs at the same time. libpthread uses a M:N model (not as easy to implement as a 1:1 model), think of it as of a combination of libthr and libc_r. Not every POSIX thread is a kernel thread, M POSIX threads are mapped into N kernel threads. The rationale behind this is, that there are a lot of programs with threads which aren't independent, so you don't need to have a kernel thread for every POSIX thread (crossing the barrier between the userland an the kernel is expensive). libc_r is widely tested but doesn't deliver the max. performance, libthr and libpthread aren't widely tested but are supposed to perform better than libc_r on SMP machines. Bye, Alexander. -- If Bill Gates had a dime for every time a Windows box crashed... ...Oh, wait a minute, he already does. http://www.Leidinger.net Alexander @ Leidinger.net GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7