From owner-freebsd-questions@FreeBSD.ORG Mon Apr 4 09:37:04 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EE8EC16A4CE for ; Mon, 4 Apr 2005 09:37:03 +0000 (GMT) Received: from fw.farid-hajji.net (fw.farid-hajji.net [213.146.115.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4412543D49 for ; Mon, 4 Apr 2005 09:37:03 +0000 (GMT) (envelope-from cpghost@cordula.ws) Received: from epia2.farid-hajji.net (epia-2 [192.168.254.11]) by fw.farid-hajji.net (Postfix) with ESMTP id EC0BF4B0F7; Mon, 4 Apr 2005 11:37:23 +0200 (CEST) Date: Mon, 4 Apr 2005 11:37:55 +0200 From: cpghost@cordula.ws To: Dick Hoogendijk Message-ID: <20050404093755.GA48928@epia2.farid-hajji.net> References: <20050404091719.GA9748@lothlorien.nagual.st> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050404091719.GA9748@lothlorien.nagual.st> User-Agent: Mutt/1.5.6i cc: freebsd-questions Subject: Re: HZ=1000 ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2005 09:37:04 -0000 On Mon, Apr 04, 2005 at 11:17:19AM +0200, Dick Hoogendijk wrote: > I read about polling and HZ=1000. The latter is not high enough for > vmware3 (it complains..). I read 'man polling' and learn something about > this, but I really want to know more about 'hz=1000' > > The GENERIC has hz=100 as I recall (fbsd-4.11). Can somebody explain I > "human language" what happens if you raise this HZ? Is there a processor > related issue here? What exectly happens if you have 'hz=1000' or is it > maybe better to have 'hz=2000' ? I can't decide now because I don't > understand what happens.. So, anybody? This is the frequency of the heart beat. Superficially, every 1/HZ second, a clock tick happens and the kernel is invoked. Then stuff like cleanup and scheduling a new thread happens (this is not the only time when threads get scheduled though). HZ=100 is good enough for most purposes. If the kernel needs to poll some data faster and more frequently, you can crank up HZ to 1000 or even higher. A system with higher HZ is usually also more responsive, but this comes at a price: * The overhead is higher (you need more time to do internal housekeeping, and there's less time available for userland threads) * Processor caches are flushed more frequently, resulting in slower RAM access. A high value for HZ is also not a good idea for slow(er) hardware either. Interestingly, HZ=100 has remained constant for decades (!), despite CPUs getting faster all the time. This is an excellent value for most typical usage patterns. Cranking it up should only be required for special cases. Anyway, the HZ knob is there. Experiment with it until you get optimal performance. > dick -- http://nagual.st/ -- PGP/GnuPG key: F86289CE > ++ Running FreeBSD 4.11 ++ FreeBSD 5.3 > + Nai tiruvantel ar vayuvantel i Valar tielyanna nu vilja -cpghost. -- Cordula's Web. http://www.cordula.ws/