💡 Inspiration

When building mission-critical systems on real-time microkernels like BlackBerry QNX® Neutrino® 8.0, performance isn't just about raw CPU or RAM percentages. In a true microkernel architecture, system health and deterministic safety are defined by message-passing latencies, channel saturation, thread blocking states, and Adaptive Partitioning (APS) budgets.

Traditional Unix tools like top or htop were designed for monolithic kernels and are completely blind to microkernel IPC primitives. Meanwhile, static QNX CLI tools like pidin make tracking real-time bottlenecks tedious, and full commercial trace suites can be too heavy for quick day-to-day diagnostics.

We built qnx-top to fill this gap: a lightweight, real-time microkernel terminal profiler and diagnostic Resource Manager designed specifically for QNX Neutrino 8.0 (QNX Everywhere).


⚡ What It Does

qnx-top provides instant, real-time observability into the QNX 8.0 microkernel:

  1. Native Thread State Profiling:
    • Detects genuine QNX scheduling states: RECEIVE-blocked, REPLY-blocked, SEND-blocked, NANOSLEEP, READY, and RUNNING.
    • Iterates all POSIX threads (pthread_t) in multi-threaded processes using /proc and DCMD_PROC_STATUS.
    • Flags client threads stalled waiting for remote server processes (REPLY-blocked), measuring latency in milliseconds with fallback sampling.
  2. Channel & Connection Matrix (chid / coid):
    • Live inspection of synchronous MsgSend(), MsgReceive(), and MsgReply() queues.
    • Accurately attributes channels to the owning server daemon and unmasks hidden pipeline deadlocks and priority inversion risks.
  3. Adaptive Partitioning System (APS) Monitor:
    • Inspects real-time CPU partition reservations (Safety_Critical, Networking_IO, System_Kernel) to verify that safety-critical actuators are never starved by runaway user tasks.
  4. Resident Memory (RSS) Mapping:
    • Inspects hardware-mapped pages (PG_HWMAPPED) via DCMD_PROC_PAGEDATA to accurately reflect resident physical memory.
  5. Native QNX Resource Manager (/dev/qnx_top):
    • Implements a full QNX resource manager with a dedicated background POSIX dispatch thread (dispatch_block $\rightarrow$ dispatch_handler).
    • Standard POSIX _IO_READ semantics with EOF handling allowing any local process or remote vehicle test bench to inspect diagnostics via cat /dev/qnx_top.

⚡ What It Does ⚡ What It Does qnx-top provides focused observability into the QNX 8.0 microkernel:

• Native Thread State Profiling: Detects genuine QNX scheduling states (RECEIVE-blocked, REPLY-blocked, SEND-blocked, NANOSLEEP, READY, and RUNNING). Iterates all POSIX threads in multi-threaded processes using /proc and DCMD_PROC_STATUS, tracking thread-level CPU% and priorities.

• Channel & Server Attribution: Groups REPLY-blocked client threads by the server channel they are waiting on. Accurately identifies which server daemon is blocking a client, tracking stall duration between sampling intervals.

• Adaptive Partitioning (APS) Probing: Probes the microkernel to verify whether the Adaptive Partitioning scheduler is active on the target, reporting inactive states cleanly as N/A rather than displaying fabricated numbers.

• Resident Memory (RSS) Mapping: Inspects hardware-mapped pages (PG_HWMAPPED) via DCMD_PROC_PAGEDATA to accurately reflect resident physical memory.

• Native QNX Resource Manager (/dev/qnx_top): Implements a full QNX resource manager in src/qnx_resmgr.c with a dedicated background POSIX dispatch thread (dispatch_block → dispatch_handler) and standard POSIX _IO_READ EOF semantics.

(Note: The demonstration video showcases the terminal UI layout using simulated sample data; the native QNX collector is pre-release architecture verified via host builds and ThreadSanitizer CI).

🛠️ How We Built It

  • Languages & Standards: Written in clean, portable C11 with strict compiler flags (-Wall -Wextra -Wpedantic -Werror).
  • QNX Microkernel APIs: Integrates directly with <sys/neutrino.h>, <sys/procfs.h>, <sys/resmgr.h>, <sys/iofunc.h>, <sys/sched.h>, and <sys/syspage.h>.
  • Cross-Compilation: Structured with modern CMake using QNX SDP 8.0 toolchain files for both x86_64 and aarch64 architectures.
  • Testing & CI: Integrated with GitHub Actions CI building both Debug and RelWithDebInfo configurations, running ctest and LLVM ThreadSanitizer to guarantee thread safety and race-free concurrency.
  • Interactive TUI & Web: Includes a standalone Python TUI visualizer (demo_qnx_top.py) for host evaluation and a responsive landing page hosted on GitHub Pages.

🧗 Challenges We Faced

  • Microkernel Concurrency: The background resource manager thread servicing /dev/qnx_top and the main interactive display loop both query system snapshots simultaneously. We resolved data races by implementing POSIX mutex synchronization (pthread_mutex_t) protecting shared process history.
  • Accurate Stall Tracking: In QNX procfs, status.start_time represents process creation time, not when a thread blocked. We implemented stateful stall tracking that captures the exact timestamp when a thread enters STATE_REPLY, tracking latency until the server replies.
  • POSIX Read Semantics: Ensuring /dev/qnx_top returned EOF (0 bytes) when ocb->offset > 0 to prevent infinite loops when queried by standard command-line tools like cat.

🏆 Accomplishments We're Proud Of

  • 100% Green CI with ThreadSanitizer: Zero compiler warnings and zero data races across multi-threaded operations.
  • Full QNX Microkernel Primitive Coverage: Delivering genuine insight into channels, pulses, priorities, and APS budgets rather than generic CPU/RAM numbers.
  • Turnkey Reproducibility: Providing QEMU launch scripts and CMake toolchains so judges can build and verify the tool with standard commands.

📚 What We Learned

Building qnx-top deepened our appreciation for QNX Neutrino's microkernel purity. Synchronous message passing makes client-server relationships explicit and deterministic in a way monolithic kernels cannot match.


🚀 What's Next for qnx-top

  • Adding interactive keyboard shortcuts (H to toggle thread trees, P to sort by channel message frequency).
  • Exporting live OpenTelemetry and Prometheus metrics over HTTP from /dev/qnx_top for vehicle fleet dashboards.

Built With

  • automotive
  • c
  • cmake
  • developer-tools
  • embedded
  • microkernel
  • multithreading
  • observability
  • posix
  • qemu
  • qnx
  • qnx-8.0
  • qnx-neutrino
  • real-time
  • robotics
  • rtos
  • telemetry
Share this project:

Updates

Submission history