On Sat, Oct 13, 2012 at 1:40 PM, Mark Knecht <markknecht@gmail.com> wrote:
> 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?
Because Google Chrome is actually LOTS of programs. I don't know about
akonadi (don't use KDE), but Chrome doesn't use threads; it uses
different process for each tab (and for several plugins, I believe),
and it integrates all those process in a single GUI using come kind of
IPC.
The idea is that if a tab crashes (bad pulgin, rogue JavaScript,
etc.), it only crashes the tab, not the whole browser. It saves us
from the nightmare that forced us to "killall -9 mozilla" from time to
time some years ago.
A thread is a "lightweight process"; it has its own call stack, but it
shares the same memory space as its "parent" (actually, the thread
that created it). The advantages are many: since all threads in the
same process share the same memory space, they can easily and quickly
communicate between each other. The tradeoff is that if one thread
crashes, the whole program does (AFAIK, someone please correct me if
I'm wrong).
A process has its own call stack and its own memory space; and while
it can share file descriptors with its parent (the process where it
was created), including pipes, it cannot easily and quickly
communicate with a process different from its parent (hence little
wonders like dbus, whose job is precisely to provice Inter Process
Communication [IPC] between different processes).
For threads in Linux/Unix you usually use POSIX threads, although
there are alternatives. For processes you use fork; everytime you use
"ls" or "cp" in a terminal, or launch a program using KDE or GNOME,
your shell or desktops forks a new process for it.
Up until very recently most programs used threads to do several things
at once; some years ago apache started to do a "hybrid" approach,
where it forks or launches threads dependign on the load of the
system, other server programs followed it. AFAIK, Google Chrome was
the first desktop program in Linux which uses several processes
runnning under the same GUI.
Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e IngenierÃ*a de la Computación
Universidad Nacional Autónoma de México
Sat Oct 13 21:30:01 2012
Return-Path: <packaging-bounces@lists.fedoraproject.org>
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
eagle542.startdedicated.com
X-Spam-Level:
X-Spam-Status: No, score=-4.3 required=5.0 tests=DKIM_ADSP_CUSTOM_MED,
DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MAT CHES_RCVD,SPF_PASS,
T_DKIM_INVALID autolearn=ham version=3.3.2
X-Original-To: tom@linux-archive.org
Delivered-To: tom-linux-archive.org@eagle542.startdedicated.com
Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2])
by eagle542.startdedicated.com (Postfix) with ESMTP id 795D520E007D
for <tom@linux-archive.org>; Sat, 13 Oct 2012 21:09:32 +0200 (CEST)
Received: from lists.fedoraproject.org (collab03.vpn.fedoraproject.org [192.168.1.70])
by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id BA42D20BDC;
Sat, 13 Oct 2012 19:09:31 +0000 (UTC)
Received: from collab03.fedoraproject.org (localhost [127.0.0.1])
by lists.fedoraproject.org (Postfix) with ESMTP id 847D540769;
Sat, 13 Oct 2012 19:09:31 +0000 (UTC)
X-Original-To: packaging@lists.fedoraproject.org
Delivered-To: packaging@lists.fedoraproject.org
Received: from smtp-mm02.fedoraproject.org (smtp-mm02.fedoraproject.org
[66.35.62.164])
by lists.fedoraproject.org (Postfix) with ESMTP id 7F8C93FDDD
for <packaging@lists.fedoraproject.org>;
Sat, 13 Oct 2012 19:09:30 +0000 (UTC)
Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45])
by smtp-mm02.fedoraproject.org (Postfix) with ESMTP id 137E43FD19
for <packaging@lists.fedoraproject.org>;
Sat, 13 Oct 2012 19:09:29 +0000 (UTC)
Received: by mail-ee0-f45.google.com with SMTP id b47so2504311eek.32
for <packaging@lists.fedoraproject.org>;
Sat, 13 Oct 2012 12:09:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s 120113;
h=message-id:date:from:user-agent:mime-version:to:cc:subject
:content-type:content-transfer-encoding;
bh=tCq9dOEstIdsLpgMVN2UxVjXzXz5xJX5Rge6PCTHdFE=;
b=uTsL99FHGerEpQhxUHC3Y4Ywl/fNLXHxZehq5ChnKHXt8tzaNQWKQCQwNCci0q4eHQ
/2w48EPiaJ6uj6PsV6jrvMLhUKEyioiLycEif9w+4eTkvG2IYbo zIlDUckkN9zIj4wWs
CJLerYtxeTjEq7nwOJjXuWPgxNQxmJwcEXcT+ezZhpX1b+h1Xq W2NeRJSg2Kb4yccxZu
28mFuCREens5pOa8LezJRId1AMIL21ni9Bp8JEO1Qha8k5ruJS Sn/FHTtyAUAK7kyxT9
RVB34m3XSygwqJ7/cdQYx0ndbLV7AVCYR+oieEo26QlzqsCqm6Nm3yT2qgZaiMaQE3 vP
Ca8Q=Received: by 10.14.213.201 with SMTP id a49mr10808343eep.4.1350155369258;
Sat, 13 Oct 2012 12:09:29 -0700 (PDT)
Received: from [192.168.2.103] (p508CBB2E.dip.t-dialin.net. [80.140.187.46])
by mx.google.com with ESMTPS id b44sm13255774eep.12.2012.10.13.12.09.27
(version=SSLv3 cipher=OTHER); Sat, 13 Oct 2012 12:09:28 -0700 (PDT)
Message-ID: <5079BCA0.6060001@gmail.com>
Date: Sat, 13 Oct 2012 21:10:24 +0200
From: =?ISO-8859-15?Q?Mario_Bl�ermann? <mario.blaettermann@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:15.0) Gecko/20120911 Thunderbird/15.0.1
MIME-Version: 1.0
To: packaging@lists.fedoraproject.org
Cc: rbean@redhat.com
Subject: [Fedora-packaging] Rules for obsoleting or conflicting packages
X-BeenThere: packaging@lists.fedoraproject.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: Discussion of RPM packaging standards and practices for Fedora
<packaging@lists.fedoraproject.org>
List-Id: Discussion of RPM packaging standards and practices for Fedora
<packaging.lists.fedoraproject.org>
List-Unsubscribe: <https://admin.fedoraproject.org/mailman/options/packaging>,
<mailto

ackaging-request@lists.fedoraproject.org?subject=unsubscrib e>
List-Archive: <http://lists.fedoraproject.org/pipermail/packaging/>
List-Post: <mailto

ackaging@lists.fedoraproject.org>
List-Help: <mailto

ackaging-request@lists.fedoraproject.org?subject=help>
List-Subscribe: <https://admin.fedoraproject.org/mailman/listinfo/packaging>,
<mailto

ackaging-request@lists.fedoraproject.org?subject=subscribe>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-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