LWN.net Logo

What do other platforms do?

What do other platforms do?

Posted Nov 16, 2006 13:48 UTC (Thu) by brugolsky (subscriber, #28)
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:

  1. RTC: 0.5 sec resolution, interrupts
  2. PIT: takes ages to read, overflows at each timer interrupt
  3. PMTMR: takes ages to read, overflows in approx 4 seconds, no interrupt
  4. HPET: slow to read, overflows in 5 minutes. Nice, but usually not present.
  5. TSC: fast, completely unreliable. Frequency changes, CPUs diverge over time.
  6. 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().


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds