[ntp:questions] drift modeling question

Hal Murray hal-usenet at ip-64-139-1-69.sjc.megapath.net
Tue Aug 12 19:54:29 UTC 2008

>> So the question is, do you know of any operating systems which use the RTC
>> to drive the scheduler?
>No, I just found the statements to which I did respond very general. 
>One person claimed the RTC interrupt was used by the scheduler, and the
>other one claimed it is not used at all by the scheduler, but none of them
>mentioned the scheduler of which OS they were talking.
>Since the RTC's interrupt output is wired to the PC's interrupt controller
>it's just a matter of the implementation whether the RTC interrupt is used
>by a scheduler, or not. E.g. some old Linux version could have done so
>whereas recent versions don't.

I was probably mixed up in that discussion.

I'm running a Linux 2.4 kernel.

The key observation is that the temperature of the 32 KHz crystal tracks
the NTP drift much better than the temperature of the CPU crystal.

I was expecting that time would run off the main CPU crystal.  I'm
not really familiar with all the PC timing hardware.  Most systems
I've worked with have some instruction that quickly reads a counter.
It's useful for low level timing hacks.  I think Intel calls it the TSC.
I was expecting the kernel to use it and thus was confused when the temperature
of that crystal didn't track the drift very well.  Dave Mills pointed
out that the kernel time keeping code he wrote which was ported to many
systems was driven off what I'm calling the scheduler interrupt
from the RTC.  Doing things that way makes more sense if you consider
systems with multiplc CPUs.  (which may be running off separate crystals)

I've looked at the code, but I won't claim to be a wizard and it was
a while ago.  All that I remember is considtent with the time being
derived from scheduler interrupts using the TSC to interpolate between ticks.

Recent Linux kernels seem to use the TSC like I expected.
Actually, that's the default.  They have a collection of options.
I got that far because the calibration for the TSC doesn't get
the same answer.  It's close, but easily visible as jumps in
the drift when you reboot.  (I'll say more if anybody wants.)

These are my opinions, not necessarily my employer's.  I hate spam.

More information about the questions mailing list