From owner-freebsd-threads@FreeBSD.ORG Mon Nov 28 04:10:53 2005 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 BFEF016A41F for ; Mon, 28 Nov 2005 04:10:53 +0000 (GMT) (envelope-from julian@elischer.org) Received: from delight.idiom.com (outbound.idiom.com [216.240.47.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id F10BD43D55 for ; Mon, 28 Nov 2005 04:10:52 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id A48D7227262; Sun, 27 Nov 2005 20:10:52 -0800 (PST) Received: from [192.168.2.5] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id jAS4AnaT012210; Sun, 27 Nov 2005 20:10:51 -0800 (PST) (envelope-from julian@elischer.org) Message-ID: <438A8349.7020508@elischer.org> Date: Sun, 27 Nov 2005 20:10:49 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.11) Gecko/20050727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nicolas Blais References: <200511272101.38903.nb_root@videotron.ca> In-Reply-To: <200511272101.38903.nb_root@videotron.ca> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: 1 process, 2 threads, how many cpus? 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: Mon, 28 Nov 2005 04:10:53 -0000 Nicolas Blais wrote: >As I was looking around the net for some information on pthreading in FreeBSD, >I came across something that got my attention: > >"The native user threads cannot concurrently run more than one thread on >separate processors at one time. If you are running a single process with >multiple CPU-intensive threads in hopes of utilizing multiple processors, you >must use Linuxthreads to get this performance." >(http://www.unobvious.com/bsd/freebsd-threads.html) > >Is this still applicable now (FreeBSD 5.4/6/CURRENT)? > >I'm writing a software that runs 1 process and multiple threads (with pthread) >that performs calculations and I was wondering if on a SMP system the threads >will run on an independant cpu. It would be quite pointless to have all >threads of the same process sharing a single cpu. > >Also, no matter how many threads I create within a process, 'top' only reports >2 threads. The following 'top' run reports my software ('aite') as using 2 >threads (when it actually created 4): > > so, what version of FreeBSD are you running? how many processors do you have? which threading library are you using? With libpthread you only create as amny kernel threads as you need at any instant. threads suspended in userland do not have associated kernel threads. >CPU states: 99.2% user, 0.0% nice, 0.8% system, 0.0% interrupt, 0.0% idle >Mem: 257M Active, 1422M Inact, 189M Wired, 85M Cache, 112M Buf, 49M Free >Swap: 2000M Total, 2000M Free > > PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND >89728 nicblais 2 20 0 4420K 2384K ksesig 0:18 77.44% aite > >Any insight appreciated, >Nicolas. > > >