From owner-freebsd-threads@FreeBSD.ORG Sun Nov 16 20:00:46 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 045DD1065670 for ; Sun, 16 Nov 2008 20:00:46 +0000 (UTC) (envelope-from dreigcht@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.227]) by mx1.freebsd.org (Postfix) with ESMTP id D34A78FC0A for ; Sun, 16 Nov 2008 20:00:45 +0000 (UTC) (envelope-from dreigcht@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so2036144rvf.43 for ; Sun, 16 Nov 2008 12:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=KgHjIP/+Sgy0I6blp5PfHSBhes1gVaXY6lqM+fEkZeY=; b=wCdgI/+0XSwqhunqoZLdTEy8YMVfWR9Se0JJxpWA2EP9byUyEq4w0vQ4zNq/HWZUWO LiTF36X8+JOOVv2WkSPF9MNbBLaHOnkVbrEeQOl29G7QvWqSEBJdFXZlDtf4G7bGdqMq qoxiLKc+5h0IImm4arRod60RfTLihINghfX+U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=QsSkL6Seg2iui1a1HFppbxXS0GqL1eaXreen679oaVT29eyNeesW1pUa9pLf7J/6d1 taVUGiIRbencwpafeCQBPGBZkUGGYnVAYeTy1B7gbddsZOMg5hcl0imbkLDzyWwgU5sZ vHsx2n3quVIKxpWitx0a1YMyBQ/nwPP30IJyk= Received: by 10.142.174.18 with SMTP id w18mr1570153wfe.267.1226864186211; Sun, 16 Nov 2008 11:36:26 -0800 (PST) Received: by 10.143.160.10 with HTTP; Sun, 16 Nov 2008 11:36:25 -0800 (PST) Message-ID: Date: Sun, 16 Nov 2008 22:36:25 +0300 From: "Peter Dreight" To: freebsd-threads@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: threads hang with xorg running X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 20:00:46 -0000 The following program runs perfectly on FreeBSD 6.3 amd64 (with xorg running and without xorg running). But on FreeBSD 7.0 amd64 and 7.1 beta amd64 (only with xorg running - xterm - konsole - etc) after a few seconds of working the thread "period_thread" hangs printing only one time a second and even less. Moreover, the whole system becomes slow though "top" does not show a heavy load. Tried on Intel E6600 and on Intel E1200 with the same result. Tried with GENERIC kernel "out of the box" and with my kernel configurations with the same result. Tried with 4BSD and ULE schedulers with the same result. #include #include #include #include void* heavy_thread(void* q) { const size_t SIZE = 500; volatile double vec[SIZE]; size_t cnt; for(cnt = 0; cnt < 1000000; ++cnt) { size_t i; for(i = 0; i < SIZE; ++i) { vec[i] = 0; } for(i = 0; i < SIZE; ++i) { vec[i] += i; vec[i] -= i; } } } void* period_thread(void* q) { int i; for(i = 0;;++i) { printf("period thread %i\n", i); usleep( 50 * 1000 ); } } int main( int argc, char** argv ) { pthread_t hs; pthread_create(&hs, NULL, period_thread, NULL); for(;;) { const size_t SIZE = 5; pthread_t h[SIZE]; size_t i; for(i = 0; i < SIZE; ++i) { pthread_create( &h[i], NULL, heavy_thread, NULL); } for(i = 0; i < SIZE; ++i) { pthread_join(h[i], NULL); } } }