New SHM clock todo list

I will keep track of suggestions/ideas/fixes in this list. It should be updated whenever a new version of the tar balls arrives.

Legal Note

All information provided on this page, the containing directory and its child directories is governed by the NTP copyright and license rules. I will consider all patches, code changes, ideas on improvements etc that are sent to me as also being covered by these rules.

Kindly refrain from giving me any kind of information that you do not want to fall under the the NTP copyright and license rules.

TO DO

  1. Miroslav Lichvar pointed out that using a different namespace for mode 1 clocks would be useful, so clients could not by accident use a SHM segment of the wrong type. Proposed scheme: for mode 0 everything stays as it is. For mode 1 the SHM key for SYSV compatible SHM management is incremented by 256, giving effective mnemonics starting from 'NTQ0' upwards. For WIN32/WIN64 targets the naming scheme will be 'NTPx.1', where x is the clock unit. (For mode 0 the old name remains.) Both names should be placed in the 'Global\\' namespace or only programs running in session 0 will have access to it. (At least on WINNT versions >= 6, that is Vista and Windows7. And the server type NT variants will have that problem, too.)

    Done at 2011-02-09
    updated to the nanosec extension for the old scheme.
    Added naming scheme for POSIX SHM if available.

  2. I think we will need memory barriers to make the interprocess communication work for some targets like PPC and ARM. They might have much weaker write order than x86/x86_64 targets, depending on the way the OS maps the SHM segment. (Even the x86 targets have the 'lfence', 'sfence' and 'mfence' instructions and the 'lock' prefix for a reason...) See this Wikipedia entry for an overview.

    Since collision/overwrite detection depends on the order of change visibility, we have to enforce a particular order via barriers. 'volatile' disables certain optimisations the compiler might do, but it does not force the hardware to make writes globally visible at a specific point.

    I know how to do this with MSVC8/MSVC9 and GCC; this is inherently non-portable and we might have to do some heavy compiler/target analysis for that.

    Done 2013-09-16
    Created proper header files for the needed atomic operations.

  3. If POSIX shared memory is detected with the autoconf dance, give it preference over SysV shared memory, both in the daemon and the access library.

    Done 2013-09-16

  4. Provided a library that hides the low-level access to the SHM segment. Integrated with autoconf and the MSVC project for VisualStudio 2008. The header is in 'include/libshmclk.h', the sources reside under 'libshmclk'. The definitions for the SHM segment are now in a specific header, 'include/shmclockdef.h'.

    Provides functions to feed time samples as struct timeval, struct timespec and a fractional time format, plus support to convert FILETIME stamps under Win32 to that format. Also the leap indicator, the precision and a PPS-support flag can be set for mode 1 SHM clocks. Passing a recommended minimum poll cycle is also included, but this is not yet wired into the NTP daemon.

    Done 2013-09-16

Conributors