Yo Hal! On Fri, 13 Jan 2023 13:06:28 -0800 Hal Murray <[email protected]> wrote:
> If we make any changes to SHM, we should switch to a setup where the
> memory is read only. The idea is to allow multiple readers.
And how do we do that? Without mutexes or atomics? The "new normal"
is to avoid those because they turn a 96 core system into a 1 core system.
The chrony socket is multiple readers. I think. I really wish ntpd
supported chrony sockets, but those need fixing too for time_64_t.
> The trick to implementing that is to have 2 counters.
> X and Y are initialized to the same value.
> The writer bumps X, updates the data, then bumps Y.
> The reader grabs Y, grabs the data, then grabs X.
> If X and Y are the same the data is valid. If not, try again.
Sadly, that no longer works on modern CPUs with out of order execution.
Unless wrapped in a mutex, or atomic, and that is now a no-no.
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
[email protected] Tel:+1 541 382 8588
Veritas liberabit vos. -- Quid est veritas?
"If you can't measure it, you can't improve it." - Lord Kelvin
pgpy_fWwKPxU1.pgp
Description: OpenPGP digital signature
_______________________________________________ devel mailing list [email protected] https://lists.ntpsec.org/mailman/listinfo/devel
