Kernel Model for Precision Timekeeping


The technical report [2], which is a major revision and update of an earlier report [3], describes an engineering model for a precision time-of-day function for a generic operating system. The model is based on the principles of disciplined oscillators using phase-lock loops (PLL) and frequency-lock loops (FLL) often found in the engineering literature. The model uses a hybrid PLL/FLL discipline algorithm implemented in the kernel. The hybrid loop provides automatic time and frequency steering with update intervals from a few seconds to over one day.

The hybrid PLL/FLL has been implemented in the Unix kernels for several operating systems, including FreeBSD and Linux and those made by Sun Microsystems, Digital/Compaq and Hewlett Packard. The modifications are currently included in the licensed kernels for Digital Unix 4.0 (aka Tru64) and Sun Solaris 2.8. Since the modifications involve proprietary kernel interface code, they cannot be provided for other licensed kernels directly. Inquiries should be directed to the manufacturer's representatives. The software and documentation, including a simulator with code segments almost identical to the implementations, but not involving licensed code, is called nanokernel.tar.gz and available via the web at www.ntp.org or by anonymous FTP from ftp.udel.edu in the pub/ntp/software directory.

Recently [1], the model has been re-implemented to support a nanosecond system clock. The /usr/include/sys/timex.h header file defines the applications programming interface (API) routines and data structures. Implementations are available for Linux, FreeBSD, SunOS and Tru64; however, only the Linux and FreeBSD implementations, which are included in recent system versions, are directly available. The software and documentation, including a simulator with code segments almost identical to the implementations, but not involving licensed code, is called nanokernel.tar.gz and available via the web at www.ntp.org or by anonymous FTP from ftp.udel.edu in the pub/ntp/software directory.

The model changes the way the system clock is adjusted in time and frequency, as well as provides mechanisms to discipline its time and frequency to an external precision timing source, such as described in the Pulse-per-second (PPS) Signal Interfacing page. The model incorporates a generic system call interface for use with the NTP or similar time synchronization protocol. The NTP software daemons for Version 3 xntpd and Version 4 ntpd use this API to provide synchronization limited in principle only by the accuracy and stability of the external timing source. There are two new system calls defined in timex.h, ntp_gettime(), which returns a structure including the current time, estimated error and maximum error, and ntp_adjtime(), which provides a means to adjust kernel variables, including the current time and frequency offsets.

These kernel modifications are normally used in conjunction with a kernel hardware interface such as described in the Kernel Programming Interface for Precision Time Signals page.

References

  1. Mills, D.L., and P.-H. Kamp. The nanokernel. Proc. Precision Time and Time Interval (PTTI) Applications and Planning Meeting (Reston VA, November 2000). Paper: PostScript | PDF, Slides: HTML | PostScript | PDF | PowerPoint
  2. Mills, D.L. Unix kernel modifications for precision time synchronization. Electrical Engineering Department Report 94-10-1, University of Delaware, October 1994, 24 pp. Abstract: PostScript | PDF, Body: PostScript | PDF
  3. Mills, D.L. A kernel model for precision timekeeping. Network Working Group Report RFC-1589, University of Delaware, March 1994. 31 pp. ASCII

David L. Mills <mills@udel.edu>