What it is & Potential Impact

In safety-critical automotive, robotics, and medical systems, a single missed real-time deadline can cause control-loop instability or hardware failure—yet teams often discover tail-latency regressions only after flashing physical target boards.

qnx-pulse solves this by turning QNX SDP 8.0 determinism into a measurable, automated CI/CD certification gate (python cli/qnx_pulse.py audit) and live microkernel lab that runs on a standard laptop via QEMU—with zero target hardware required. Instead of relying on heavyweight proprietary profilers or synthetic POSIX mutex demos, qnx-pulse exercises QNX Neutrino's native message-passing and pulse primitives directly from a root (uid 0) C agent, computing a formal Worst-Case Response Time (WCRT) budget (R_wcrt = J_wakeup + C_ipc + B_service) to pass or fail firmware builds before deployment.

Native QNX 8.0 Architecture (agent/pulse_agent.c, v0.3.0)

Written in pure C against the QNX Neutrino microkernel API without external dependencies:

  • Synchronous Message Passing & Hardware TSC Timing: Opens a kernel channel via ChannelCreate() and blocks on MsgReceive(), while a periodic probe sends 64-byte MsgSend() messages every 50 ms and times each round-trip with ClockCycles() calibrated against SYSPAGE_ENTRY(qtime)->cycles_per_sec (zero syscall overhead). Statistics are strictly filtered by active scheduling policy so stale SCHED_OTHER spikes never contaminate SCHED_FIFO percentiles.
  • Message-Driven Priority Inheritance (No Mutex Required): Unlike generic RTOS demos that test priority inheritance on POSIX mutexes, qnx-pulse proves QNX's unique message-driven priority propagation across three CPU-pinned threads (ThreadCtl(_NTO_TCTL_RUNMASK)) at priorities 10, 15, and 25—comparing QNX's default behavior against a channel created with _NTO_CHF_FIXED_PRIORITY.
  • Sub-Millisecond Kernel Pulse Wakeup Profiler (WAKEUP_TEST): Uses timer_create(CLOCK_MONOTONIC) with SIGEV_PULSE_INIT, MsgReceivePulse(), and TimerTimeout() armed with absolute timestamps (TIMER_ABSTIME) to measure scheduler wakeup jitter without kernel-tick rounding drift.
  • Live /proc Kernel Telemetry: Queries /proc/<pid>/as directly via devctl() (DCMD_PROC_INFO, DCMD_PROC_TIDSTATUS, DCMD_PROC_MAPDEBUG_BASE) to stream active PIDs, thread counts, priorities, and CPU time.

Dual Interface: Native QNX Resource Manager (/dev/qnxpulse) + TCP

pulse_agent now exposes two interfaces from the same process:

  • Native QNX Neutrino Resource Manager at /dev/qnxpulse: registered with dispatch_create(), iofunc_func_init(), iofunc_attr_init() and resmgr_attach(), and served by a dispatch_block() / dispatch_handler() loop. Custom io_read and io_write handlers validate every request with iofunc_read_verify() and iofunc_write_verify().
  • TCP server on port 9090: line-based JSON protocol used by the host CLI (cli/qnx_pulse.py) and the remote dashboard.

Any process or POSIX shell script inside QNX can read the agent's live state or control scheduling and system load with plain file I/O, with no sockets or external libraries:

cat /dev/qnxpulse                    # io_read: live latency and scheduler state
echo "policy fifo" > /dev/qnxpulse   # io_write: switch the probe to SCHED_FIFO
echo "stress 1" > /dev/qnxpulse      # io_write: start CPU + IPC stress

QNX 8.0 Microkernel Primitives Used

  • Message passing & timing: ChannelCreate(), MsgSend(), MsgReceive(), MsgReply(), ClockCycles(), SYSPAGE_ENTRY(qtime)->cycles_per_sec
  • Pulses & timers: timer_create() with SIGEV_PULSE_INIT, MsgReceivePulse(), TimerTimeout() (TIMER_ABSTIME)
  • Scheduling & priority inheritance: pthread_setschedparam(), ThreadCtl(_NTO_TCTL_RUNMASK), _NTO_CHF_FIXED_PRIORITY
  • Resource manager: dispatch_create(), dispatch_block(), iofunc_func_init(), iofunc_attr_init(), resmgr_attach(), iofunc_read_verify(), iofunc_write_verify()
  • Kernel telemetry: devctl() on /proc/<pid>/as (DCMD_PROC_INFO, DCMD_PROC_TIDSTATUS, DCMD_PROC_MAPDEBUG_BASE)

Verified Experimental Results (QNX SDP 8.0)

Across multi-core CPU (4x SCHED_OTHER hogs) and back-to-back IPC burst stress runs:

Metric / Kernel Experiment Run A (215 FIFO samples) Run B (1,000 FIFO samples) Engineering Takeaway
IPC MsgSend RTT (p50 / p99) 14.0 µs / 122.5 µs 14.8 µs / 176.4 µs Sub-200 µs deterministic IPC under heavy load
Priority Inheritance (Default vs _NTO_CHF_FIXED_PRIORITY) 400.9 µs vs 39,603.7 µs (98.8×) 368.2 µs vs 40,885.4 µs (111.0×) Server inherits prio 25 via MsgSend; inversion eliminated
Kernel Pulse Wakeup Jitter (p99, QEMU/WHPX) 2,703.1 µs 2,715.8 µs Captures Windows hypervisor timer granularity vs QNX scheduler
Computed WCRT (R_wcrt = J + C + B) 3,226.4 µs 3,260.3 µs Passes --profile qemu (4,500 µs budget, +1,239.7 µs slack)

CI/CD Determinism Gate & Zero-Setup CLI (cli/qnx_pulse.py)

  • python cli/qnx_pulse.py up — Cross-compiles pulse_agent.c with qcc -Vgcc_ntox86_64, boots QNX 8.0 in QEMU, deploys the binary via SFTP, and starts the root agent in one command.
  • python cli/qnx_pulse.py audit --with-stress — Runs the loaded IPC probe, WAKEUP_TEST, and PRIORITY_TEST, evaluates the formal WCRT budget against --profile qemu or --profile hardware, exports a JSON certification report, and exits 0 (CERTIFIED DETERMINISTIC) or 1 (NOT DETERMINISTIC) to gate CI pipelines.
  • python cli/qnx_pulse.py dashboard — Launches the live Flask + HTML5/Canvas dashboard (http://127.0.0.1:8765) with log-scale time series, latency distribution histogram, side-by-side policy table, and JSON report export.

Self-Contained 30-Minute Codelab

Includes a step-by-step hands-on tutorial (codelab/README.md) taking developers from their first ChannelCreate() and MsgSend() round-trip to running WCRT determinism audits and diagnosing QEMU vs. bare-metal timer behavior: https://github.com/axier011/qnx-pulse/blob/main/codelab/README.md

How we built it, Challenges & Accomplishments

  • How we built it: Architected as a decoupled two-tier system: a minimal, zero-dependency C micro-agent running inside QNX 8.0 exposing both a native /dev/qnxpulse resource manager and a line-based TCP/JSON protocol on port 9090, paired with a Python/Flask host CLI and real-time Canvas dashboard.
  • Key Technical Challenge: During WAKEUP_TEST implementation, an initial periodic POSIX timer rounded sub-millisecond intervals (500 µs) to QNX's kernel tick, causing cumulative phase drift across 200 samples. Re-architecting the loop around absolute one-shot arming (TIMER_ABSTIME + MsgReceivePulse) eliminated drift and cleanly isolated QEMU/WHPX host timer granularity (~2.7 ms) from QNX's sub-200 µs IPC scheduling.
  • Accomplishments: Built a reproducible, single-command QNX 8.0 determinism lab and CI gate that empirically proves QNX's up to 111× message-passing priority-inheritance advantage without physical hardware.

Built With

Share this project:

Updates

Submission history