Re:Computer Has Two Clocks
by hedora on Tuesday May 03, 2022 @12:11AM
(#31244514)
Your computer has way more than two hardware clocks.
Anyway, in Linux, clock_monotonic is nearly useless for distributed systems because NTP can arbitrarily screw up its speed.
Clock_monotonic_raw does what most distributed systems want, but for some reason it performed a kernel crossing last time I checked. (Clock_monotonic doesn’t do a kernel crossing.)
One possible solution is to use the TSC directly, but then apply an appropriate multiplier to get all the (heterogeneous) processors to run at the same speed.
Anyway, in Linux, clock_monotonic is nearly useless for distributed systems because NTP can arbitrarily screw up its speed.
Clock_monotonic_raw does what most distributed systems want, but for some reason it performed a kernel crossing last time I checked. (Clock_monotonic doesn’t do a kernel crossing.)
One possible solution is to use the TSC directly, but then apply an appropriate multiplier to get all the (heterogeneous) processors to run at the same speed.
I wish Linux’s clocks were better.