The newer POSIX (interval) timers mechanism

Earlier in this chapter, we saw in Table 1 : A quick comparison of the simple alarm(2) API and interval timers, that, although the interval timer [get|set]itimer(2) APIs are superior to the simplistic alarm(2) API, they still lack important modern features. The modern POSIX (interval) timer mechanism addresses several shortcomings, some of which are as follows:

  • The resolution is improved a thousand-fold with the addition of nanosecond granularity timers (with the addition of an arch-independent HRT mechanism, which is integrated into 2.6.16 Linux kernel onward).
  • A generic sigevent(7) mechanism—which is a way to handle asynchronous events such as timer expiry (our use case), AIO request completion, ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.