SHM
Eric S. Raymond
esr at thyrsus.com
Mon May 28 03:38:12 UTC 2018
Hal Murray <hmurray at megapathdsl.net>:
> > I'm not clear what you mean by making it read-only. Can you explain?
>
> The current stuff has the sender set a ready bit and the receiver turn it
> off. That only works if you have one receiver. Things like gpsmon can't run
> while it is also being used by ntpd.
>
> You can make it read only for the receiver(s) with the following recipe:
> there are two counters in the memory block, X and Y, initialized to 0 and -1
> sender bumps X, updates data, copies X to Y
> receiver checks Y for new data. If new:
> grab Y, grab data, grab X
> if X==Y you win. If not, try again.
> NB: the transmitter and receiver have to update/check X and Y in the opposite
> order.
This is very close to the optimidtic-locking algorithm I invented for
client-site shm.
I don't think it can be made bakward-compatible with the existing one, though.
Which means we might as well write a new triver onforming to the POSIX
shared-memory interface.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.
More information about the devel
mailing list