What do other platforms do?
Posted Nov 16, 2006 13:48 UTC (Thu) by brugolsky
Parent article: Counting on the time stamp counter
It is quite remarkable just how many clocks are in a typical PC, all of which have serious drawbacks. Vojtech Pavlik provided a nice summary a while back:
- RTC: 0.5 sec resolution, interrupts
- PIT: takes ages to read, overflows at each timer interrupt
- PMTMR: takes ages to read, overflows in approx 4 seconds, no interrupt
- HPET: slow to read, overflows in 5 minutes. Nice, but usually not present.
- TSC: fast, completely unreliable. Frequency changes, CPUs diverge over time.
- LAPIC: reasonably fast, unreliable, per-cpu
Linux timekeeping has always been a black art, and until John Stultz's rewrite, seemed to me to proceed from the wrong direction. At least now it looks comprehensible.
Do other kernels (*BSD, Solaris) take a markedly different approach?
There does seem to be some work going on to make the TSC more useful on SMP systems, e.g., [PATCH 1/2] Make the TSC safe to be used by gettimeofday().
to post comments)