From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E096E138010 for ; Sat, 13 Oct 2012 18:42:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3D0CCE0462; Sat, 13 Oct 2012 18:41:48 +0000 (UTC) Received: from mail-qa0-f53.google.com (mail-qa0-f53.google.com [209.85.216.53]) by pigeon.gentoo.org (Postfix) with ESMTP id C5EB2E0369 for ; Sat, 13 Oct 2012 18:40:37 +0000 (UTC) Received: by mail-qa0-f53.google.com with SMTP id s11so384677qaa.19 for ; Sat, 13 Oct 2012 11:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=Dv8l5gKXRcqNkR3Fg0NmrTcLToGRFkP6eEt2BYtwqtw=; b=vkrRIigIvo4MYTMYsFj0c6Di5HTyM/inXEZE9tWH+8seHL35Y/chIoLhSPhNLaNUl7 0SGM9NVEOL+y4lrDJ9ZKS9sP4XWT56fr3lSCfQtfqjyEvqtnIhmBMGJ4qoh4ERMRLn9d HaQXVL+U1sWWBx0nIII/YTdiVxaeZW2ppR7HJA1h5Tt4TwctbAnjKahnuypoEBnLbOEn hwCQcQvG4P2BaKmiCea2jaG+eEgS/tdN8Jlpio/XSU5rPN8JDf61/nA9Q26kw/Bdr+zX vjedqI1h9ItZTDOcu5YTsZdYPInkr7LCf12HDl7J8zNZLvzaI8I6CNgTjJo6CU1CIGBo I9Iw== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.224.78.74 with SMTP id j10mr520185qak.17.1350153637157; Sat, 13 Oct 2012 11:40:37 -0700 (PDT) Received: by 10.229.106.15 with HTTP; Sat, 13 Oct 2012 11:40:37 -0700 (PDT) In-Reply-To: References: <50781A2B.3030509@taydin.org> <50794D66.1000305@taydin.org> <2356851.Zlj38iKZWL@energy> Date: Sat, 13 Oct 2012 11:40:37 -0700 Message-ID: Subject: Re: [gentoo-user] Is my system (really) using nptl From: Mark Knecht To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 85df22cf-8b48-470c-a6d4-7830ca4b776b X-Archives-Hash: 76dd8759838cf0796fe8b9931629a24a On Sat, Oct 13, 2012 at 11:16 AM, Canek Pel=C3=A1ez Vald=C3=A9s wrote: > On Sat, Oct 13, 2012 at 12:10 PM, Mark Knecht wrot= e: >> On Sat, Oct 13, 2012 at 9:15 AM, Canek Pel=C3=A1ez Vald=C3=A9s wrote: >> >>> >>> We can only know seeing the code. Timur, this is the little test I >>> made which creates 5 threads and runs them for 1 minute. In my case, >>> `ps x` shows only 1 PID, care to give it a try? >>> >>> ---------------------- >>> #include <<=3D=3D=3D=3D=3D=3D >>> #include >>> #include >>> #include >> >> Thanks for the test case. Like you I see only one thread. However the >> test case wouldn't compile for me without the -pthread option so it >> makes me wonder what happens to a program like I had pointed to >> yesterday that uses the old style threading that did create lots of >> process ids? Possibly an nptl system would still generate lots of ids >> for that program and that's what he's seeing? >> >> Just curious. I don't program but I'm always sort of interested. > > You got your answer. NTPL stands for Native POSIX Thread *Library*. As > it name says, it is a library (with support in the kernel and in > glibc). If you don't use the library (-lpthread), you cannot make use > of its advantages. > > What "old style threading" did you use for your test case? > > Regards. > -- > Canek Pel=C3=A1ez Vald=C3=A9s > Posgrado en Ciencia e Ingenier=C3=ADa de la Computaci=C3=B3n > Universidad Nacional Aut=C3=B3noma de M=C3=A9xico > As for 'old style' I only meant code that did threads but didn't use the POSIX libraries. (I guess...) Actually I hadn't run the test case at the time but was referring to the one I pointed the OP at yesterday: http://www.makelinux.net/alp/032 However it's essentially the same as yours (not as elegant, but functionally similar). However the results shown on that page show different pids for the threads. When I run that same code here I get the same pids: mark@c2stable ~ $ ./pthread2 main thread pid is 5387 child thread pid is 5387 ^C mark@c2stable ~ $ Now, this does make me curious about some things running on my system. Two for instance, Google Chrome and akonadi_agent, have LOTS of pids. I was assuming those were different threads and were demonstrating what the OP was asking about, but now I'm not so sure. How does a single program on an nptl system generate all these different pids? Thanks, Mark