uCLinux: Tick Rate

With a large number of kernel functions are time-driven, the time management in kernel is very important. The frequency of the system timer (tick rate) is programmed on system boot based on a static preprocessor define, HZ. The value of HZ is architecture-dependent, and it is defined in: <asm/param.h>.

The tick rate has a frequency of HZ hertz and a period of 1/HZ seconds. For example, by default the architecture defines HZ to be 100. Therefore, the timer interrupt on the system has a frequency of 100HZ and occurs every 10 milliseconds.

Since there is so much of the system is dependent on the timer interrupt, changing its frequency has a reasonable impact on the system. And of course, there are pros and cons to larger versus smaller HZ values. Increasing the tick rate implies that the timer interrupt runs more frequently, and the work it performs consequently occurs more often. This allows all timed events to have a higher resolution and accuracy.

However, there are some disadvantages for increasing the tick rate. As mentioned, a higher tick rate implies more frequent timer interrupts and processor must spend more time executing the timer interrupt handler. This situation not only causing less processor time available for other work, but also a more frequent thrashing of the processor’s cache and not to mention increase in power consumption.

You may also like...

Leave a Reply