Date: Thu, 4 Oct 2007 11:52:03 -0700 (PDT) From: Matthew Dillon <dillon@apollo.backplane.com> To: cpghost <cpghost@cordula.ws> Cc: Artem Kuchin <matrix@itlegion.ru>, freebsd-stable@freebsd.org, Craig Boston <cb@severious.net> Subject: Re: Quation about HZ kernel option Message-ID: <200710041852.l94Iq3Db021957@apollo.backplane.com> References: <02d401c805cb$abf59ec0$0c00a8c0@Artem> <200710041232.l94CWd6W056143@lurza.secnetix.de> <20071004143944.GA46491@nowhere> <009201c8069d$2f3edc20$0c00a8c0@Artem> <20071004180522.3a724868@epia-2.farid-hajji.net>
next in thread | previous in thread | raw e-mail | index | archive | help
The basic answer is that HZ is almost, but not quite irrelevant.
If a process blocks another will immediately be scheduled. More
importantly, if an interrupt driven event (keyboard, tty, network,
disk, etc) wakes a process up the scheduler has the ability to force
an IMMEDIATE reschedule. Nearly ALL process related events schedule
the process from this sort of reschedule. Generally speaking only
cpu-bound processes will be hitting the schedular quantum on a regular
basis.
For network protocols HZ is the basis for the timeout subsystem which
is only triggered when things actually time-out, which is fairly rare
in a normally running system.
Queue timers, select timeouts, and nanosleep are restricted by HZ in
granularity, but in nearly all cases those calls are used with
very large timeouts not really subject to the granularity of HZ.
I think a higher HZ can be somewhat beneficial if you are running a
lot of processes which fall through the scheduler's cracks (both cpu
and disk bound, usually), or if the scheduler is badly written, but
otherwise a lower value will not have much of an effect. I would not
go under 100, though. I personally believe that a default of 1000 is
ridiculously high, especially on a SMP system.
-Matt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710041852.l94Iq3Db021957>
