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

Eric Raymond esr at thyrsus.com
Fri Mar 25 11:05:50 UTC 2011


Terje Mathisen <terje at tmsw.no>:
> 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.

By "complicated code" do you mean the memory-barrier instructions?
Because in the low-power, memory-constrained environments I have 
in mind, they seem like a good tradeoff for requiring less memory
than a multiple-buffer solution.  

The rest of the required implementation doesn't seem complicated to
me. It basically just consists of one forward copy, one backward copy,
and a trivial check-and-loop by the reader.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


More information about the hackers mailing list