From owner-freebsd-threads@FreeBSD.ORG Tue Jul 25 00:33:34 2006 Return-Path: X-Original-To: freebsd-threads@FreeBSD.org Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7DA9516A4E1 for ; Tue, 25 Jul 2006 00:33:34 +0000 (UTC) (envelope-from pav@FreeBSD.org) Received: from hood.oook.cz (hood.oook.cz [195.250.137.134]) by mx1.FreeBSD.org (Postfix) with ESMTP id 55EC843D62 for ; Tue, 25 Jul 2006 00:33:31 +0000 (GMT) (envelope-from pav@FreeBSD.org) Received: from ikaros.oook.cz (localhost [127.0.0.1]) by hood.oook.cz (8.13.6/8.13.6) with ESMTP id k6P0XTZO013696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 25 Jul 2006 02:33:29 +0200 (CEST) (envelope-from pav@FreeBSD.org) Received: (from pav@localhost) by ikaros.oook.cz (8.13.6/8.13.6/Submit) id k6P0XT3l013695 for freebsd-threads@FreeBSD.org; Tue, 25 Jul 2006 02:33:29 +0200 (CEST) (envelope-from pav@FreeBSD.org) X-Authentication-Warning: ikaros.oook.cz: pav set sender to pav@FreeBSD.org using -f From: Pav Lucistnik To: freebsd-threads@FreeBSD.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-mXQEIRE+PoCybYP1kCsc" Date: Tue, 25 Jul 2006 02:33:29 +0200 Message-Id: <1153787609.20641.47.camel@ikaros.oook.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 FreeBSD GNOME Team Port Cc: Subject: thread starving X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pav@FreeBSD.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2006 00:33:34 -0000 --=-mXQEIRE+PoCybYP1kCsc Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hey team, I have a program which basically does this: - start timer_thread with pthread_create() - set handler for sigalarm that collects some statistics - set up itimer which will fire sigalarms once per second - start up a scientific computation timer_thread does basically this: while (1) { sleep(1); communicate statistics with controller over network } Now the problem. On certain machines, sometimes, the timer_thread never starts to execute. pthread_create() returns 0 (success), but it's never scheduled. Possibly because the main thread is in CPU intensive loop, never sleeps, never waits for i/o. If I put pthread_yield() into the main thread just after the pthread_create(), it runs a bit of timer_thread, but then stalls. But sometimes it works as it should. And there are machines where this always works. Now the most odd part: attaching truss or gdb to the application unstucks the timer_thread. I'm currently observing this on a 6.0-STABLE and 6.1-RC boxes. How can I help it? --=20 Pav Lucistnik Said Helvetica Narrow to Helvetica Bold: "Hey, you're just my type." --=-mXQEIRE+PoCybYP1kCsc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?= =?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?= =?ISO-8859-1?Q?_zpr=E1vy?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (FreeBSD) iD8DBQBExWbZntdYP8FOsoIRAihUAJ4uGq6E2DDBESoyK7KN/0pe+KQSdgCgy0ck juLSaAHKBIxwnLac1SFqgtQ= =90lF -----END PGP SIGNATURE----- --=-mXQEIRE+PoCybYP1kCsc--