Introduction
The passage of time is, almost by definition, of interest to real-time software. Specific examples include:
- Periodic threads with or without deadlines
- Watchdog timers
- Sporadic servers
- Other CPU-consumption budgeting.
- Deadlines for aperiodic processing
Rationale
The POSIX specification is mature and generally accepted. It includes a set of time-related APIs that provide a strong basis to build software that needs these services. The POSIX timers functions are adopted for this specification without modification.
Specification
- The kernel MUST conform to the POSIX specification IEEE Std 1003.1-2001 for timers. This includes functions marked with the following margin codes:
- The TMR margin code for POSIX timers
- The CS margin code for clock selection
- The MON margin code for a monotonic clock
- The CPT margin code for process CPU time clocks is not required.
- The kernel timer support MAY include support for one or more clocks with high-resolution utilizing hardware counters or timers to achieve timer resolution with 100us or lower.
Notes
The list of required functions includes:
- clock_gettime, clock_settime, and clock_getres
- timer_create, timer_delete, timer_settime, timer_gettime, timer_getoverrun
- nanosleep, clock_nanosleep
References
Support for POSIX timers is included in the CELF kernel. This also includes support for high-resolution timers on selected architectures.
Support for POSIX timers is also included in 2.6 Linux kernels. A patch for high-resolution timers is available at http://high-res-timers.sourceforge.net.
