[ntp:hackers] [Gpsd-dev] A lightweight synchronization mechanism for shared memory
terje at tmsw.no
Fri Mar 25 12:39:27 UTC 2011
Dave Hart wrote:
> On Fri, Mar 25, 2011 at 10:23 UTC, Terje Mathisen<terje at tmsw.no> wrote:
>> PS. Bookend coherence is elegant, but still not a solution, see my other
>> post. For ntpd as a client it is however almost certainly sufficient, since
>> ntpd has a _lot_ of sanity checking& filtering code, so a spurious entry
>> does not matter.
> I've heard that sort of reasoning from a number of ntpd contributors
> in different contexts, and each time it makes me uncomfortable. I
> believe ntpd's grooming of its inputs should not be relied upon to
> excuse to occasionally feed it garbage because it's convenient. The
> grooming has a job to do which is undermined by avoidable garbage, and
> intentional noise is not budgeted.
We're in violent agreement. :-)
With a counter and circular buffer (even if just of size 2), the only
possible reader problem happens if it put to sleep in the middle of a
read, then wakes up after _exactly_ 2^32 (or 2^64) update cycles
(usually seconds) and reads the remainder.
This is similar to the odds against getting an NTP timestamp of exactly
zero (which is handled by discarding it).
I.e. I refuse to worry about quantum mechanical odds. :-)
- <Terje at tmsw.no>
"almost all programming can be viewed as an exercise in caching"
More information about the hackers