[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ✘64-bit time_t on glibc 2.34 and up

From: Gary E. Miller
Subject: Re: ✘64-bit time_t on glibc 2.34 and up
Date: Fri, 13 Jan 2023 13:14:10 -0800

Yo Hal!

On Fri, 13 Jan 2023 13:06:28 -0800
Hal Murray <> 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.

Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpE7DN_RJXvO.pgp
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]