How do RTOS kernel keep track of time ?
Every kernel provides a mechanism to keep track of time. This is done by a hardware timer which interrupts the CPU periodically.
The ISR for this timer invokes a service provided by the kernel, which is responsible to update time dependent variables. This ISR is generally called a Clock Tick ISR. Kernel maintains a special list to keep track of tasks that are waiting for the time to expire. This is called delayed task list.
1) Excellent LWN write up on linux porting to 2.6 series