[ntp:hackers] [Gpsd-dev] A lightweight synchronization mechanism for shared memory

Terje Mathisen terje at tmsw.no
Fri Mar 25 10:23:23 UTC 2011

Eric Raymond wrote:
> Håkan Johansson<f96hajo at chalmers.se>:
>> Going to a more-than-1 entry buffer does not immediately give any
>> further guarantees, but it does open another loophole:
> One of the objectives of this method is to be starkly simple and lightweight.
> I am therefore not inclined to pursue generalizations that are more complex and
> use more storage.

Eric, you've been one of my heroes for many years, but here you are 
simply wrong:

Going to at least two buffers gets totally rid of the problem for all 
readers, they can always read a full/valid record.

This is "starkly simple" compared to any setup where all clients have to 
have complicated code to guard against partially updated data.

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.

- <Terje at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

More information about the hackers mailing list