From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 15 22:16:08 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8428106566B for ; Wed, 15 Jun 2011 22:16:08 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email2.allantgroup.com (email2.emsphone.com [199.67.51.116]) by mx1.freebsd.org (Postfix) with ESMTP id 91F528FC0A for ; Wed, 15 Jun 2011 22:16:08 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email2.allantgroup.com (8.14.4/8.14.4) with ESMTP id p5FLtIvX049117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 15 Jun 2011 16:55:18 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.5/8.14.5) with ESMTP id p5FLtInw010123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 15 Jun 2011 16:55:18 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.5/8.14.5/Submit) id p5FLtHJ1010122; Wed, 15 Jun 2011 16:55:17 -0500 (CDT) (envelope-from dan) Date: Wed, 15 Jun 2011 16:55:17 -0500 From: Dan Nelson To: Yuri Message-ID: <20110615215515.GA6889@dan.emsphone.com> References: <4DF91458.8010508@rawbw.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DF91458.8010508@rawbw.com> X-OS: FreeBSD 8.2-STABLE User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.97 at email2.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.6 (email2.allantgroup.com [199.67.51.78]); Wed, 15 Jun 2011 16:55:19 -0500 (CDT) X-Scanned-By: MIMEDefang 2.68 on 199.67.51.78 Cc: freebsd-hackers@freebsd.org Subject: Re: Why user time of the process depends on machine load? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2011 22:16:09 -0000 In the last episode (Jun 15), Yuri said: > When I test performance of the code, I always observe dependency of CPU > user time on the presence of other CPU intense processes. Same CPU-only > deterministic process that on the quiet machine completes in 220 user > seconds in the presence of, for example, kde rebuild would complete in > 261, 266 or even 379 user seconds. I am talking about times shown by > time(1), not actual an execution time. It's the same time as getrusage(2) > returns in ru_utime field. > > Why time that process takes in user seconds depends on what other > processes are running? > > FreeBSD-8.2 STABLE on i7 CPU @ 9200 @ 2.67GHz. Some possible factors: o Intel Turbo Boost, which raises the clock rate of a single core if the other cores are idle. A single process on an idle system will run faster. o i7 chips have a shared L3 cache across all cores, so a single process on an idle system will tend to have more of its data in cache compared to a system with multiple processes, so it spends less time waiting for slower physical memory lookups. o Process accounting isn't exact. I may be wrong, but I don't think timestamps are taken every time a syscall is invoked and returns. Some time marked as "user" may actually be "system" time, in which case you may be seeing the effect of contention in the kernel as more processes are run. You may be able to disable Turbo Boot in your BIOS, which you can use to determine how much of the single-process speedup is due to that. Unrelated but still interesting note on your particular CPU: http://www.passmark.com/forum/showthread.php?t=2256 -- Dan Nelson dnelson@allantgroup.com