Inspiration
What it does
How we built it
Challenges we ran into
Accomplishments that we're proud of
What we learned
What's next for QNX-PulseGuard
Inspiration
A missed heartbeat on a real-time worker is quiet until the deadline is already gone. I wanted a QNX Neutrino 8.0 watchdog that times kernel pulses in microseconds, publishes telemetry through /dev/pulseguard, and restarts a stalled worker inside 10 ms without calling the allocator on the hot path.
What it does
QNX-PulseGuard runs worker threads, a pulse receiver, and a deadline state machine (OK -> WARN -> BREACH -> RECOVERING -> RESTARTED). On QNX the bridge uses ChannelCreate_r, ConnectAttach_r, MsgSendPulse_r, TimerTimeout_r, and MsgReceivePulse_r, and mounts /dev/pulseguard with resmgr_attach. The host build uses the same C++20 core so the suite runs on a laptop. The wait-free SPSC ring and 513-bucket histogram do not allocate on the sample path. fault_injector drives cpu_stall, priority_inversion, and missed_pulse.
- GitHub Repo: https://github.com/alphonshhhomenicmtu/qnx-pulseguard
- Live Telemetry Console: https://alphonshhhomenicmtu.github.io/qnx-pulseguard/
- 8-Slide Architecture Deck (PDF): https://alphonshhhomenicmtu.github.io/qnx-pulseguard/qnx-pulseguard-deck.pdf
How we built it
Strict C++20, -Wall -Wextra -Werror. QNX SDP targets are make qnx-x86_64 and make qnx-aarch64 after qnxsdp-env.sh. The binary executed for our local verification suite is the macOS host build ./build/test_pulseguard.
Challenges we ran into
Late pulses from a dead worker could match the new epoch on the low 4 bits. The 32-bit pulse now carries an 8-bit epoch and a 20-bit timestamp, and a restart handshake counts only when the epoch equals the expected epoch (epoch 17 does not complete recovery as epoch 1). SCHED_FIFO and ClockCycles() are the QNX path; QNX_QEMU_RUNBOOK.md documents the boot guide (we did not run a QEMU VM log in this submission).
Accomplishments that we're proud of
./build/test_pulseguard: 31/31 tests passed (66,334+ assertions), includingtest_zero_alloc_hot_pathandtest_watchdog_epoch_wrap_rejects_stale_epoch.fault_injector --mode all --stall-ms 14: 1,391 pulses, 0 dropped, p50 7 us, p99 31 us, max 148 us (cpu_stalllast recovery 39 us;missed_pulselast recovery 76 us — well under the 10 ms budget).- Full 7-module Codelab walkthrough in
CODELAB.md.
What we learned
Putting worker id, an 8-bit epoch, and a 20-bit timestamp in the pulse payload avoids a reply copy on the fast path. Comparing the full expected epoch in the handshake keeps a wrapped nibble from passing as the restarted worker. Reading device telemetry behind the wait-free ring keeps cat /dev/pulseguard off the worker's clock.
What's next for QNX-PulseGuard
Collect hardware / QEMU benchmark traces using QNX_QEMU_RUNBOOK.md, then add Qnet node-to-node forwarding.
Built With
- c++
- cmake
- posix
- qnx
- rtos