✘64-bit time_t on glibc 2.34 and up

Gary E. Miller gem at rellim.com
Fri Jan 13 21:14:10 UTC 2023


Yo Hal!

On Fri, 13 Jan 2023 13:06:28 -0800
Hal Murray <halmurray at sonic.net> 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
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 851 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20230113/92fb14d1/attachment-0001.bin>


More information about the devel mailing list