A kernel timer is an easy way to ask the kernel to execute a specific function after a well-defined amount of time. Linux implements two different types of kernel timers: old but still valid kernel timers defined in the linux/include/linux/timer.h header file and new high-resolution kernel timers defined in the linux/include/linux/hrtimer.h header file. Even if they are implemented differently, both mechanisms work in a very similar manner: we have to declare a structure holding timer's data, which can be initialized by proper functions, and then the timer can be started using the proper function. Once expired, the timer calls a handler to execute the desired actions and, eventually, we have the possibility of stopping or restarting the timer.
Legacy kernel timers are only supported at a resolution of 1 jiffy. The length of a jiffy is dependent on the value...