SHM

Hal Murray hmurray at megapathdsl.net
Mon May 28 02:59:51 UTC 2018


esr at thyrsus.com said:
>> You should probably add cleaning up SHM to your list.  I think
>> we want to make the read side read-only.  The current approach
>> is polled.  Maybe we should move to a socket.   ???

> If we move to a socket it's not SHM any more.

I'm being sloppy and using "SHM" as a handle for talking to a refclock 
running in another process.

The problem with real SHM is that I haven't found a way to wakeup the 
receiver(s).  Standard thread stuff doesn't work - they are in separate 
processes.


> 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.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list