From owner-freebsd-current@FreeBSD.ORG Sat May 1 21:45:09 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E1DBE16A4CE for ; Sat, 1 May 2004 21:45:09 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8CF2B43D5F for ; Sat, 1 May 2004 21:45:09 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from vigrid.com (tnt-33-8.ct.dialin.ntplx.com [65.75.33.8]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i424j7S7014745; Sun, 2 May 2004 00:45:08 -0400 (EDT) Message-ID: <40947B21.6030603@vigrid.com> Date: Sun, 02 May 2004 00:37:53 -0400 From: "Daniel M. Eischen" User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Alexandre \"Sunny\" Kovalenko" References: <20040501122558.6139dec1.Alex.Kovalenko@verizon.net> <20040501204157.704fbc0d.Alex.Kovalenko@verizon.net> In-Reply-To: <20040501204157.704fbc0d.Alex.Kovalenko@verizon.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org Subject: Re: Is it possible to make -lpthread program to use 100% CPU? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2004 04:45:10 -0000 Alexandre Sunny Kovalenko wrote: > On Sat, 1 May 2004 14:49:47 -0400 (EDT) > Daniel Eischen wrote: > > >>On Sat, 1 May 2004, Alexandre Sunny Kovalenko wrote: >> >> >>>On Thu, 29 Apr 2004 17:16:21 +0200 >>>Ivan Voras wrote: >>> >>> >>>>Alexandre Sunny Kovalenko wrote: >>>> >>>> >>>>>Alternatively, if there is a need to test a patch or time a program >>>>>in this environment, it could easily be accomplished -- it is a non- >>>>>production box. >>>> >>>>Could you turn off Hyperthreading and report any changes? >>>> >>> >>>I have updated my system to the latest CTM mailing on Friday (4/30) morning (EST). >>>This includes version 1.176 of kern_thread.c. >>> >>>I have turned off hyperthreading and got result, which muddles me rather -- try >>>as I might, with -lpthread I could not get past 50% CPU utilization (as reported >>>by 'top') and number of computations per second matching that (number is very >>>close to that for running single-threaded). Top report with thread view enabled >>>shows that both KSE are bound to CPU 0 (if I am interpreting C column properly). >> >>Are you using system or process scope threads? >> >>-- >>Dan Eischen > > Sorry, should have mentioned that too. For -lthr PTHREAD_SCOPE_PROCESS is only > available option. For -lpthread I have tried both, and results do not differ > much, which is what I expect on the machine that runs nothing else (unless > I do not understand PTHREAD_SCOPE_ option). You need to use PTHREAD_SCOPE_SYSTEM in order to get another scheduling quantum (kse group) for each thread under libpthread. There's no way yet to tell the kernel which CPU should get each thread, so they may be scheduled on the same CPU. What scheduler are you using? -- Dan Eischen