[ntp:hackers] [Gpsd-dev] ntpd shm changes
davehart_gmail_exchange_tee at davehart.net
Sat Mar 19 11:56:22 UTC 2011
On Sat, Mar 19, 2011 at 11:20 UTC, Terje Mathisen <terje at tmsw.no> wrote:
> The best you can do with a single producer and one/multiple readers (which
> are allowed to read the same data), is probably to have multiple slots for
> the data packets together with a single pointer to the current/last updated
> The pointer can even be a simple index, using a byte variable makes it
> impossible for a reader to read a partially updated value.
That sounds like a good way to go to me. Can you think of any reason
two slots would not be enough? Also I'd feel better about the atomic
handling of th index with it manipulated as the native word size
(currently 32 or 64, could set aside 128 bits). At least on some RISC
platforms, byte access is handled by the compiler as a native word
size plus extra instructions, killing atomicity I believe.
More information about the hackers