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 05695138010 for ; Sat, 13 Oct 2012 16:17:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F3AEB21C006; Sat, 13 Oct 2012 16:17:02 +0000 (UTC) Received: from mail-ie0-f181.google.com (mail-ie0-f181.google.com [209.85.223.181]) by pigeon.gentoo.org (Postfix) with ESMTP id 6A430E0552 for ; Sat, 13 Oct 2012 16:15:41 +0000 (UTC) Received: by mail-ie0-f181.google.com with SMTP id 16so6366397iea.40 for ; Sat, 13 Oct 2012 09:15:40 -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 :cc:content-type:content-transfer-encoding; bh=ehsZGhVKwt0n7UHoDX0wLtCeugzuZ0MNBf5Snqtx4mo=; b=mQneuxuOpDASApZxHhLe3oXItvGavzhpmAr/kX/ZNl3Z+sHtKRnVkfDAIuYdH8tjHl wqtB2NVsM+ByAZ+s3zl6Dgpr6n7CjKBE33PnNzB/6gPa6IbIrS/2P4EjT7YCETiskhNJ DEXUv/niAUet23Kep+qxvpHCVIlzg0nzYuOOvBKUI+kX/cbZdY+7tC4IpBxYwDjMXUNZ brloVmDHY57YOLd1omm9Qycnz3u+QOXrB4AcghhZVOcV2rdHPOBuauToSy10EIgcefb4 tOKaANW2wZi/c0OPU0SShcuo4nck7sHpvFR7PaAaPTeC8obPFMgYPIL1jTGKPfKXaLYn aMwg== 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.50.153.162 with SMTP id vh2mr4806292igb.67.1350144940877; Sat, 13 Oct 2012 09:15:40 -0700 (PDT) Received: by 10.64.32.195 with HTTP; Sat, 13 Oct 2012 09:15:40 -0700 (PDT) In-Reply-To: <2356851.Zlj38iKZWL@energy> References: <50781A2B.3030509@taydin.org> <50794D66.1000305@taydin.org> <2356851.Zlj38iKZWL@energy> Date: Sat, 13 Oct 2012 11:15:40 -0500 Message-ID: Subject: Re: [gentoo-user] Is my system (really) using nptl From: =?UTF-8?B?Q2FuZWsgUGVsw6FleiBWYWxkw6lz?= To: gentoo-user@lists.gentoo.org Cc: Timur Aydin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: f4770582-17f2-4e22-a1bb-00573ff931a6 X-Archives-Hash: 3f1eecc2302312b6bb41298a1cee6a59 On Sat, Oct 13, 2012 at 7:09 AM, Volker Armin Hemmann wrote: > Am Samstag, 13. Oktober 2012, 14:15:50 schrieb Timur Aydin: >> On 10/13/12 04:11, Mark Knecht wrote: >> > Take look here. The answer is, I think, not necessarily. >> > >> > http://www.makelinux.net/alp/032 >> >> Hello Mark, >> >> Thank you for the link to an excellent book. However, it seems the book >> is talking about linuxthreads by Xavier Leroy, not nptl. I am well aware >> that linuxthreads uses LWP's to implement threads and as a result, each >> thread has a separate, unique pid. >> >> I did a few more tests using gdb and my simple app. I am seeing the >> SIG32 signal and the lack of the manager threads. So everything hints >> that I am indeed using nptl, but the separate process id's still doesn't >> make sense... > > or you made a mistake somewhere in your app. 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 #include #include #include static pthread_mutex_t mutex =3D PTHREAD_MUTEX_INITIALIZER; static int keep_running; static void* my_thread(void* data) { int id =3D *((int*)data); int count =3D 0; sleep(id); printf("Thread %d beginning.\n", count++); while (keep_running) { printf("Thread %d: %d.\n", id, count++); sleep(1); } printf("Thread %d exiting.\n", count++); } int main(int argc, char* argv[]) { keep_running =3D 1; pthread_t a, b, c, d, e; int* arr[] =3D { NULL, NULL, NULL, NULL, NULL }; int i; for (i =3D 0; i < 5; i++) { arr[i] =3D malloc(sizeof(int)); *arr[i] =3D i; } pthread_create(&a, NULL, my_thread, arr[0]); pthread_create(&b, NULL, my_thread, arr[1]); pthread_create(&c, NULL, my_thread, arr[2]); pthread_create(&d, NULL, my_thread, arr[3]); pthread_create(&e, NULL, my_thread, arr[4]); sleep(60); pthread_mutex_lock(&mutex); keep_running =3D 0; pthread_mutex_unlock(&mutex); for (i =3D 0; i < 5; i++) free(arr[i]); } ---------------------- Regards. --=20 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