First One to Know -> jiffies the kernel heartbeat
Talking about kernel heartbeat well talk about jiffies. Jiffies is a variable in kernel space, a jiffie refer to a time measurement, it refer to the duration of one tick of the system timer interrupt. For more understanding, heres the description about jiffies based on “Understanding the Linux Kernel – 3rd edition”
“The jiffies variable is a counter that stores the number of elapsed ticks since the system was started. It is
increased by one when a timer interrupt occurs that is, on every tick.”
The jiffies variable is a counter that stores the number of elapsed ticks since the system was started, It is increased by one when a timer interrupt occurs that is, on every tick. Where the timer of interrupt already programmed at boot time and defined by the value of HZ (see /usr/include/asm/param.h)[c]========
#define HZ 100
One thing to remember is that this jiffies counter is 64 bit variable called jiffies_64 (on 32 bit and 64 bit machines running linux) (check: /usr/include/linux/jiffies.h).
Lets have a check on what weve said above.
Checking current jiffies value[c]jiffies.c
unsigned long j;
j = jiffies;
printk("ncurrent jiffies value : %lun",j);
Lets make it and check using dmesg.[text][/text]==========================
make -C /lib/modules/2.6.35-22-generic/build M=/home/cr0security/lkm/jiffies modules
make: Entering directory
Building modules, stage 2.
MODPOST 1 modules
make: Leaving directory
/home/cr0security/lkm/jiffies#dmesg | tail
[ 3694.258877] [ 3694.258880] current jiffies value : 848564
we got current jiffies counter value : 848564 , well just for note the initial value of this jiffies is programmed to be 0 at the boot time.
Getting confused already ???? what does 848564 means ?? 848564 ticks of the system timer interrupt. dont forget that the timer defined at HZ value.
orgininal post by cr0security : [email protected]