kernel configuration parameter HZ

Frank Sorenson frank at
Mon Dec 31 13:41:14 MST 2007

Hash: SHA1

Alec Shaw wrote:
> If you include linux/param.h then you can use the #define HZ.
> Alec

Not necessarily.  This will include the generic system-wide kernel
header, but that header file will not necessarily be the one for the
currently-running kernel, especially if you've got more than one kernel
version installed.  If you compiled your own kernel from source, you may
be able to include the file from /lib/modules/`uname -r`/source

> Andres Gonzalez wrote:
>> My understanding is that the kernel configuration parameter HZ has
>> changed with the various linux releases. Up to 2.4.x, HZ was typically
>> 100; starting with version 2.6.0 HZ was 1000; but starting with 2.6.13
>> HZ can be 100, 250 or 1000; and since 2.6.20 HZ can also be 300.
>> My question is how can I determine programmatically (e.g. system call
>> ??) what HZ was used to build the kernel my program is currently
>> running on?   That is, I want to be able to determine HZ during
>> program runtime.
>> Thanks,
>> -Andres

HZ could be just about anything.  And the most recent kernels have NO_HZ
capability, so if the system can tell there's nothing to come out of
sleep for, it just skips a wakeup.

What is it you're trying to do with HZ once you've determined it?  Can
you use something other than HZ for timing?

- --
Frank Sorenson - KD7TZK
Linux Systems Engineer, DSS Engineering, UBS AG
frank at
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora -


More information about the PLUG mailing list