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

Terje Mathisen terje at tmsw.no
Fri Mar 25 11:20:07 UTC 2011

Håkan Johansson wrote:
>> Going to at least two buffers gets totally rid of the problem for all
>> readers, they can always read a full/valid record.
> Not always. As you noted earlier, if the reader involuntarily gets put
> to sleep for long enough, then it will (at best) note that (all) entries
> were modified meanwhile, i.e. no data that it may have read can be used.
> And if it then reattempts then the same thing can happen again. Forever.
> So only almost always.

I disagree:

We are after all talking about time (& position) updates!

If a client/reader is allowed to be arbitrarily delayed(i.e. multiple 
seconds!) in the middle of every (4-5 instructions long) read attempt 
(or a majority of them), then the system as a whole is simply totally 
broken, and cannot work at all.


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

More information about the hackers mailing list