What Is QNX?

In today’s entry in our Alternative OS Contest, James Ingraham takes a close look at QNX, the operating system based on the Neutrino microkernel. He concludes that “While you can probably find solutions for just about all of your desktop computing needs using the QNX RTOS, that is not QNX’s strong suit. Its focus is real-time, embedded, and mission critical applications.” Read on for the whole article.

What is QNX?

That seems like an easy enough question, but the answer is fairly complicated. QNX is a company, a microkernel, a real-time operating system, and a development platform. To stay consistent, here’s the QNX nomenclature this article will follow, though it is not official:

  • QNX Software Systems is an Ottawa, Ontario, Canada, based company. From here on out, we’ll call the company QSS.

  • QNX 2.x and 4.x are older versions of the operating system, from microkernel up to development tools. This review will essentially ignore them.

  • QNX Neutrino is the microkernel itself.

  • QNX by itself, QNX 6.x, the QNX RTOS, and the QNX Neutrino RTOS will refer to the complete real-time operating system, not counting the development platform.

  • QNX Momentics is the complete development platform.

What’s an RTOS?

Again, a simple question without a particularly good answer. The abbreviation “RTOS” stands for real-time operating system… but unfortunately no one can agree on what “real-time” means, or even “operating system,” for that matter. The raging debate about “what is real-time?” doesn’t particularly impact a review of any given OS, but I’ll outline a few points about people generally mean by it.

  1. Predictability. The time to complete a task must be bounded.

  2. Priorities. There has to be a way to interrupt a lower priority task to make sure that high priority tasks aren’t starved.

  3. Scalability. Usually, when you think of scalability in computing it starts small and goes upward toward massive buildings chock full of IT people. In the case of RTOSes, scalability means stripping down the OS to the bare minimum required. If the RTOS is controlling a jet fighter, you don’t need or want MSN Messenger, Real Player, or Solitaire. Some RTOSes need only a few kilobytes of storage and RAM to work.

  4. Robustness. There is no known way to prevent an electronic system from crashing. However, there are methods for both minimizing the chance of crashes and for graceful recovery from crashes.

The QNX Neutrino RTOS

QSS’s crown jewel is the QNX Neutrino message passing microkernel. What’s a message passing microkernel? The executive summary is that it is a specific solution to the problems of creating a Real-time Operating System. Skipping the technical details on how this works, for now think of QNX as “just another OS.” In fact, to users and developers, QNX looks like any other POSIX-compliant system, e.g. Linux or Solaris. The underlying architecture may be vastly different, but type ls at a prompt and you’ll see the familiar /usr, /bin, /home, and /root directories.

Supported architectures are ARM, MIPS, PowerPC, SH-4, StrongARM, XScale™, and x86. Currently, there is no 64-bit support. The Neutrino is a true multi-threaded, multi-tasking system, with several different modes of multi-processing. QSS refers to these as Symmetric, Asymmetric, and Bounded Multi-Processing. (SMP, AMP, and BMP, respectively). Again ignoring the technical details of these terms, the different modes allow developers to fine-tune the behavior of their applications for real-time tasks. BMP, for example, forces tasks to run on a specific processor.

File systems are not part of the microkernel, making it easy to load and unload as needed. QNX defaults to the qnx4 file system, a proprietary fs similar to other POSIX file systems. It includes support for images for use in ROM, NAND flash, and NOR flash, with Execute-in-place capabilities. There is also a RAM-disk utility. Recently, QNX released ETFS, or the Embedded Transactional File System. Essentially, this uses atomic transactions to ensure there are no file corruptions as a result of power-outages or a crashing program. ext2, DOS / FAT12, FAT16, FAT32 , ISO9660, and Joliet are also supported. Notably missing are ext3, JFS, XFS, ZFS, and ReiserFS. Of course, NTFS is not supported. Sharing with other systems is still fairly easy; both CIFS (client) and NFS (client and server) work fine. Briefly, QNX used a Package File System that was more of a hassle than a help; support remains but it is no longer a mainstream solution.

QNX has IPv4 and IPv6, plus its own proprietary network protocol. Message passing extends to the QNX network seamlessly, so that distributed computing is transparent. As a simple example, a drive on a remote machine could be mounted locally, whether or not the remote machine has it mounted. Since most advanced users think nothing of remote-mounting a drive, a more impressive example might be transparently accessing a remote serial port.

USB support is okay, but since most companies do not offer QNX drivers for their devices you are mostly limited to generic devices such as keyboards, mice, and storage devices. USB flash storage works like any other drive. There are a handful of printers that work on USB. Don’t get your hopes up for much else.

Video card support is similarly essentially limited to nVidia, ATI, or Matrox. Even then, QNX has trouble keeping up with the fast pace of the graphics market.

Hardware support in general is a weakness when it comes to “standard” devices. The emphasis is on embedded hardware, such as Board Support Packages (BSPs) to allow QNX to boot on systems that don’t have a BIOS. Writing or porting device drivers is fairly straightforward, provided with documentation for a given device. QNX has several Device Driver Kits (DDKs) to ease development, as well as POSIX conventions for direct access of hardware through port I/O and dual-port memory.

QNX Photon microGUI

QNX has its own window manager / GUI called Photon. There is no true “desktop.” The Shelf is something like a Dock or Quick Launch, which is of course configurable. The Shelf also includes a Launch button that behaves just like the Windows Start Menu. In fact, the Windows key opens the Launch menu.

Photon has its own API, which means that the vast library of X Windows applications are not supported. However, there is a port of XFree86, which can be run instead of Photon. In addition, an application called XPhoton allows most applications to run in Photon by fooling them into thinking they are running in X. Still, QSS does not directly support GTK+, Qt, or Tcl/Tk. Ports of these toolkits are unsupported and very far behind the latest revisions.Photon Screenshot

QNX has its own browser, called Voyager 2, which uses Mozilla’s rendering engine. Mozilla itself and Firefox are both available, though users are at the mercy of QSS for updates. There is a browser widget, so embedding an HTML renderer into an application is trivially easy. Alas, while QNX has a nice set of native widgets, there is not nearly as broad a range as there are for more “standard” systems.

One advantage Photon has as a result of being a standard component of the OS is that virtually everything is configurable in GUI form. Yes, you can edit text files like you would on Linux, but the GUI configuration is quite nice. It is possible to use the system without ever opening a shell.

Fast, lightweight, configurable, and reasonably pretty, Photon is an excellent GUI for embedded applications. It does not have the power and flexibility of say KDE on X, but it can do an awful lot with a lot less resources. My photon directory is about 37MB… and 15MB of that is fonts. This doesn’t count Mozilla.

QNX Momentics

QSS is a founding member of the Eclipse consortium, and is almost single handedly responsible for the C Development Tools (CDT). Eclipse is therefore the cornerstone of the Momentics development platform. This is a double edged sword; on the one hand having full support for Eclipse is good. On the other hand, there are virtually no other options. However, it appears that there will be virtually no options besides Eclipse in the entire RTOS market fairly soon. Such is QNX’s success with Eclipse that almost all other major RTOS vendors have switched to Eclipse-based tools. This includes arch-rival and RTOS market leader Wind River, as well as highly-regarded tool maker Green Hills.

In addition to Eclipse, Momentics includes Application Builder, a GUI form designer for Photon applications. While the Photon API is all C, Application Builder is a RAD tool in the vein of Microsoft’s Visual Basic or Borland’s Delphi. In fact, Application Builder was around well before Microsoft or Borland had form designers for C/C++. The separation of the form designer from the IDE is quite normal for Eclipse developers, but might come as a shock for those used to Visual Studio or Borland’s tools.

Language and compiler support is an issue. Most real-time embedded systems are programmed in C. Here, QNX is covered by the GCC, plus an extensive set of libraries. The GCC also provides C++ support, and QNX has a full C++ library (including the STL) and a scaled down Embedded C++ library, both supplied by Dinkum. Intel also provides a C/C++ compiler for QNX on x86, which is an additional purchase beyond standard Momentics. Things go downhill from there. Ada (invented for and still widely used for the mission critical applications QNX and other RTOSes target) is available, but not from QSS. Java is supported, but since it relied on IBM’s WebSphere it became horribly out of date. They have since switched to PERC from Aonix. (Unfortunately, I can’t give you any more information about PERC, since I do not have access to it.) GCJ has not been ported, nor have many of the other GCC tools. The bottom line is that the bulk of any real applications for QNX will have to be done in C/C++.

QNX is not open source, but does offer the source code for many components. They have a number of what they call Technology Development Kits (TDKs) to cover multimedia, embedded 3D graphics (using the OpenGL ES standard), networking, high availability computing, critical process monitoring, and more.

QNX is unique among RTOSes in that it supports self-hosted development. In other words, you can compile a program on the QNX RTOS. For programmers not used to the embedded world, it will come as a shock that no other RTOS can compile so much as a “Hello, world!” program, in any language. However, consider where the RTOSes are intended to run. Is there any reason to compile a program on your TiVo, PDA, cell phone, or car entertainment system? All other commercial RTOSes rely on cross-development. Most vendors’ cross-development systems require Windows, though a few support other platforms. In addition to self-hosted development, Momentics also supports cross-development from Windows, Linux, and Solaris. The nice thing about self-hosted development is that it eases the code-test-debug cycle. After the development cycle, a final product based on QNX (e.g. a car navigation system) would not include the development tools.

Documentation and Support

If you are used to Linux, the documentation for QNX is absolutely delightful. Extensive, well-written, and virtually error-free, the docs (available as HTML or PDF) cover everything from basic systems administration and using Photon to the deep inner-workings of the OS and how to develop applications from top to bottom. However, there are virtually no independent books on QNX. The two most famous, both by Robert Krten, are quite good. There are also a handful of on-line communities for QNX. However, if you find yourself stuck, the massive on- and off- line community surrounding Windows and Linux is not there for QNX.

QSS does offer web, e-mail, and phone based support, at varying levels of service and price. The people that answer the phone are not call center plebeians reading from a script. They work with QNX daily and can answer many questions off-hand. They also have access to the QNX developers, so that even very sophisticated questions can be answered. Sending code snippets back and forth is common. Granted, this support is not cheap, but it is good. For home projects, it’s not worth it. For mission critical commercial applications, it’s nice to know that solid people are there to help.

Getting QNX

RTOS vendors generally do not have an “Add to Cart” button on their web pages. It can take weeks to get a quote from a vendor, with lots of back-and-forth with a sales rep about specific requirements and features. I am not at liberty to divulge specific pricing for various RTOS development licenses, but you should expect a number in the tens of thousands of US dollars. QNX Momentics is among the least expensive for initial setup, and can come in under ten thousand depending on requirements. The trade-off is that there is also a runtime royalty, which can tip the balance depending on volume. The cost runtime licenses for QNX can vary greatly, especially since price will go down as volume goes up. The industry as a whole ranges from royalty-free to hundreds of dollars per unit.

QNX does offer a 30-day trial of Momentics, which is enough time to check it out as a desktop OS. It would be difficult to learn enough to develop a non-trivial real-time application in 30 days. At one time QSS offered a version that was free for non-commercial use; this has since been withdrawn.

There is a famous demonstration of QNX 4.x booting the OS and Photon microGUI from a single floppy disk, then launching a browser and using an Ethernet or SLIP connection to access the Internet. This is not possible with the QNX Neutrino RTOS. The demo used older versions of the OS, the GUI, and the Voyager browser. This is worth mentioning only because people still talk about how impressive this demo was whenever QNX is mentioned, but it is no longer available, nor is it particularly related to the modern QNX RTOS.

Conclusions

While you can probably find solutions for just about all of your desktop computing needs using the QNX RTOS, that is not QNX’s strong suit. Its focus is real-time, embedded, and mission critical applications. In these realms, QNX has numerous features that stand out. Recently, the in-car telematics market has been a primary driver, leading to QSS’s acquisition by Harman, of Harman-Kardon audio fame. It may not have the market share of VxWorks, but QNX manages to maintain a niche for itself with continually innovative features and a broad array of options.

About the author:

James Ingraham is the Software Development Team Leader for gantry robot manufacturer Sage Automation, Inc., and has been a QNX user for the last decade or so.


If you would like to see your thoughts or experiences with technology published, please consider writing an article for OSNews.

47 Comments

  1. 2006-07-24 11:55 am
    • 2006-07-24 2:03 pm
    • 2006-07-24 2:08 pm
    • 2006-07-24 2:49 pm
      • 2006-07-25 2:23 am
    • 2006-07-24 8:43 pm
    • 2006-07-25 5:18 am
      • 2006-07-25 11:46 am
  2. 2006-07-24 12:42 pm
    • 2006-07-24 2:10 pm
      • 2006-07-25 3:29 am
  3. 2006-07-24 1:04 pm
  4. 2006-07-24 2:38 pm
    • 2006-07-24 3:49 pm
      • 2006-07-24 5:56 pm
        • 2006-07-25 3:25 am
          • 2006-07-25 8:36 am
          • 2006-07-25 11:49 am
          • 2006-07-25 3:05 pm
        • 2006-07-25 8:34 am
          • 2006-07-25 8:03 pm
      • 2006-07-24 7:10 pm
  5. 2006-07-24 3:21 pm
    • 2006-07-24 3:50 pm
  6. 2006-07-24 3:42 pm
    • 2006-07-24 3:55 pm
  7. 2006-07-24 4:25 pm
    • 2006-07-24 4:39 pm
    • 2006-07-24 5:55 pm
  8. 2006-07-24 4:52 pm
    • 2006-07-25 3:16 am
      • 2006-07-25 9:00 am
      • 2006-07-25 3:23 pm
        • 2006-07-25 7:14 pm
          • 2006-07-25 8:10 pm
          • 2006-07-26 3:12 pm
          • 2006-07-27 4:46 am
        • 2006-07-26 2:24 am
  9. 2006-07-24 6:22 pm
    • 2006-07-24 7:39 pm
      • 2006-07-24 8:13 pm
        • 2006-07-25 8:40 am
          • 2006-07-25 3:10 pm
  10. 2006-07-24 7:29 pm
  11. 2006-07-24 8:49 pm
    • 2006-07-25 1:43 am
  12. 2006-07-25 3:53 am