public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mark Knecht <markknecht@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Is my system (really) using nptl
Date: Sat, 13 Oct 2012 11:40:37 -0700	[thread overview]
Message-ID: <CAK2H+efJ-XJ9+QeYy1fBN-EUo3gZkH_0QH1mdRY6cAmmrhEOwA@mail.gmail.com> (raw)
In-Reply-To: <CADPrc831dUYUfRxukK54tUFWU54dtWyu+6MMJLBucoHDGoQBdA@mail.gmail.com>

On Sat, Oct 13, 2012 at 11:16 AM, Canek Peláez Valdés <caneko@gmail.com> wrote:
> On Sat, Oct 13, 2012 at 12:10 PM, Mark Knecht <markknecht@gmail.com> wrote:
>> On Sat, Oct 13, 2012 at 9:15 AM, Canek Peláez Valdés <caneko@gmail.com> wrote:
>> <SNIP>
>>>
>>> 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 <pthread.h> <<======
>>> #include <unistd.h>
>>> #include <stdlib.h>
>>> #include <stdio.h>
>>
>> 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áez Valdés
> Posgrado en Ciencia e Ingeniería de la Computación
> Universidad Nacional Autónoma de México
>

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


  reply	other threads:[~2012-10-13 18:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 13:24 [gentoo-user] Is my system (really) using nptl Timur Aydin
2012-10-12 17:46 ` Canek Peláez Valdés
2012-10-12 23:55 ` Volker Armin Hemmann
2012-10-13  0:09   ` Timur Aydin
2012-10-13  1:11     ` Mark Knecht
2012-10-13 11:15       ` Timur Aydin
2012-10-13 12:09         ` Volker Armin Hemmann
2012-10-13 16:15           ` Canek Peláez Valdés
2012-10-13 17:10             ` Mark Knecht
2012-10-13 18:16               ` Canek Peláez Valdés
2012-10-13 18:40                 ` Mark Knecht [this message]
2012-10-13 18:57                   ` Matthew Finkel
2012-10-13 19:00                   ` Canek Peláez Valdés
2012-10-13 19:50                     ` Michael Mol
2012-10-13 20:18                       ` Canek Peláez Valdés
2012-10-13 23:20                         ` Michael Mol
2012-10-14  9:31                           ` Florian Philipp
2012-10-14 15:07                             ` Michael Mol
2012-10-14 19:19                               ` Florian Philipp
2012-10-14 19:30                                 ` Michael Mol
2012-10-14 19:35                                 ` [gentoo-user] " James
2012-10-14 20:05                                 ` [gentoo-user] " mike
2012-10-14 22:32                           ` Volker Armin Hemmann
2012-10-13 20:13             ` Timur Aydin
2012-10-13 20:28               ` lists
2012-10-13 12:51         ` Michael Mol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK2H+efJ-XJ9+QeYy1fBN-EUo3gZkH_0QH1mdRY6cAmmrhEOwA@mail.gmail.com \
    --to=markknecht@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox