One more thing: interestingly, the Linux kernel allows us to peek deep inside the OS; this is (typically) achieved via the powerful Linux proc filesystem. In our current context, proc allows us to look up all the timers that a given process has. How is this done? By reading the pseudo-file /proc/<PID>/timers. Check it out. The screenshot below illustrates this being performed on the runwalk_timer process:
The terminal window on the left is where the runwalk_timer application runs; while it's running, in the terminal window on the right, we lookup the proc filesystem's pseudo-file /proc/<PID>/timers. The output clearly reveals the following:
- There's just one (POSIX) timer within the process (ID 0).
- The timer-expiry event-notification mechanism is signaling, because we can see that notify:signal/pid.<PID> and signal: 34 are associated with this timer (signal: 34 is SIGRTMIN; use kill -l 34 to verify this).
- The clock source associated with this timer is ClockID 0; that is, the real-time clock.