[coyotos-dev] Timekeeping issues (was: coyotos.sleep, sleepTill, the epoch)

Valerio Bellizzomi devbox at selnet.org
Fri Feb 9 17:10:48 CST 2007


I want to try to remove the confusion. The reason for which I started this
conversation is that I wanted to understand various things:

1. How to capture machine uptime. This is resolved.
2. How to record OS install time (this could be done via some installation
tool).
3. How to remove the uncertainty given by leap seconds.
4. How to choose an arbitrary time scale, and how much it costs in term of
system code changes (not in the kernel).
5. How to improve the time granularity and clock stability.

All of the above has almost nothing to do with the kernel. The paper
"Computer Time Synchronization" cited by me in a previous message has most
answers, though not all, for the above questions, specifically in sections
1.1 and 1.5.

val



On 09/02/2007, at 15.40, Jonathan S. Shapiro wrote:

>I want to try to dis-entangle some of my confusion in this conversation.
>Really, it comes down to two very simple statements:
>
>  1. It's not the kernel's job to tell you what time it is.
>  2. Even if it *is* the kernel's job, the kernel can't do that job.
>
>In principle, the kernel can only do two things:
>
>  1. Keep an accurate tick counter.
>  2. Record a baseline system wall-clock value that correlates to
>     the "zero point" on the tick counter.
>
>The kernel cannot tell you what time it is in TAI, UTC, or anything
>else. For starters, most hardware doesn't have any sort of reference
>clock that is even approximately accurate. The most the kernel can do is
>record enough information that higher-level software may be able to
>clean up the mess or come up with an independently calibrated time.
>
>In fact, it is *very* expensive for the kernel to maintain an accurate
>tick counter. Regrettably, the tick counter rates on most hardware
>scales up and down with the clock -- even in places (like the APIC)
>where it isn't *supposed* to do this. The end result of this is that you
>can have low power consumption or accurate time keeping, but you have to
>pick one.
>
>Something you definitely do NOT want is a 1ms granularity interrupt to
>maintain a tick counter. On current hardware this will account for a
>measurable fraction of the machine.
>-- 
>Jonathan S. Shapiro, Ph.D.
>Managing Director
>The EROS Group, LLC
>+1 443 927 1719 x5100




More information about the coyotos-dev mailing list