Jump to main content
Index
Advanced search
  1. Home
  2. QNX Software Development Platform

    QNX SDP is a cross-compiling and debugging environment, including an IDE and command-line tools, for building binary images and programs for target boards running the QNX OS 8.0.

  3. Programming

  4. Getting Started with the QNX OS

    Getting Started with the QNX OS: A Guide for Realtime Programmers is intended to introduce you to the QNX OS and help you develop applications and resource managers for it.

  5. Resource Managers

    In this chapter, we'll take a look at what you need to understand in order to write a resource manager. Resource managers are another distintive feature of QNX OS that allow you to access services through standard POSIX calls.

  6. Writing a resource manager

    Now that we've introduced the basics—how the client looks at the world, how the resource manager looks at the world, and an overview of the two cooperating layers in the library, it's time to focus on the details.

  7. Resource manager structure

    Now that we've seen the data structures, we can discuss interactions between the parts that you'd supply to actually make your resource manager do something.

  • QNX Momentics IDE User's Guide

    This User's Guide describes version 8.0 of the Integrated Development Environment (IDE) that's part of the QNX Tool Suite.

  • QNX Software Development Platform

    QNX SDP is a cross-compiling and debugging environment, including an IDE and command-line tools, for building binary images and programs for target boards running the QNX OS 8.0.

    • Quickstart Guide

    • System Architecture

      The System Architecture guide accompanies the QNX OS and is intended for both application developers and end-users.

    • OS Components & Operations

    • Graphics

    • Programming

      • Getting Started with the QNX OS

        Getting Started with the QNX OS: A Guide for Realtime Programmers is intended to introduce you to the QNX OS and help you develop applications and resource managers for it.

        • Processes and Threads

          This chapter explains the concepts behind processes and threads, and the challenges of synchronization and scheduling. A thread is a flow of execution, and a process is a collection of threads. In the QNX OS, the schedulable entity is a thread, not a process.

        • Message Passing

          In this chapter, we'll look at the most distinctive feature of QNX OS, message passing. Message passing lies at the heart of the operating system's microkernel architecture, giving the OS its modularity.

        • Interrupts

          In this chapter, we'll take a look at interrupts, how we deal with them under QNX OS, their impact on scheduling and realtime, and some interrupt-management strategies.

        • Resource Managers

          In this chapter, we'll take a look at what you need to understand in order to write a resource manager. Resource managers are another distintive feature of QNX OS that allow you to access services through standard POSIX calls.

          • What is a resource manager?

            A resource manager is simply a program with some well-defined characteristics.

          • The client's view

            We've already seen a hint of what the client expects. It expects a file-descriptor-based interface, using standard POSIX functions.

          • The resource manager's view

            Let's look at things from the resource manager's perspective.

          • The resource manager library

            Before we get too far into all the issues surrounding resource managers, we have to get acquainted with the QNX OS resource manager library.

          • Writing a resource manager

            Now that we've introduced the basics—how the client looks at the world, how the resource manager looks at the world, and an overview of the two cooperating layers in the library, it's time to focus on the details.

            • Data structures

              The first thing we need to understand is the data structures used to control the operation of the library.

            • Resource manager structure

              Now that we've seen the data structures, we can discuss interactions between the parts that you'd supply to actually make your resource manager do something.

              • The secpol_resmgr_attach() and resmgr_attach() functions and their parameters

                As you saw in the /dev/null example above, the first thing you'll want to do is register your chosen mountpoint with the process manager. This is done via secpol_resmgr_attach() or resmgr_attach().

              • Putting in your own functions

                When designing your very first resource manager, you'll most likely want to take an incremental design approach. It can be very frustrating to write thousands of lines of code only to run into a fundamental misunderstanding and then having to make the ugly decision of whether to try to kludge (er, I mean fix) all that code, or scrap it and start from scratch.

              • The general flow of a resource manager

                As we alluded to in the overview sections above, the general flow of a resource manager begins on the client side with the open(). This gets translated into a connect message and ends up being received by the resource manager's open connect function handler.

              • Messages that should be connect messages but aren't

                Here's an interesting point you may have noticed. Consider the client's prototype for chown() shown below.

              • Combine messages

                As it turns out, this concept of combine messages isn't useful just for saving bandwidth (as in the chown() case, above). It's also critical for ensuring atomic completion of operations.

            • POSIX-layer data structures

              There are three data structures that relate to the POSIX-layer support routines. As far as the base layer is concerned, you can use any data structures you want; it's the POSIX layer that requires you to conform to a certain content and layout. The benefits delivered by the POSIX layer are well worth this tiny constraint. As we'll see later, you can add your own content to the structures as well.

          • Handler routines

            Not all outcalls correspond to client messages—some are synthesized by the kernel, and some by the library.

          • Alphabetical listing of connect and I/O functions

            This section gives an alphabetical listing of the connect and I/O function entry points that you can fill in (the two tables passed to resmgr_attach()). Remember that if you simply call iofunc_func_init(), all these entries will be filled in with the appropriate defaults; you'd want to modify a particular entry only if you wish to handle that particular message. In the Examples section, below, you'll see some examples of the common functions.

          • Examples

            I'm now going to show you a number of cookbook examples you can cut and paste into your code, to use as a basis for your projects. These aren't complete resource managers—you'll need to add the thread pool and dispatch skeleton shown immediately below, and ensure that your versions of the I/O functions are placed into the I/O functions table after you've done the iofunc_func_init(), in order to override the defaults!

          • Advanced topics

            Now that we've covered the basics of resource managers, it's time to look at some more complicated aspects.

          • Summary

            Writing a resource manager is by far the most complicated task that we've discussed in this book.

        • Sample Programs

          This appendix contains the complete versions of some of the sample programs discussed in this book.

        • Glossary

      • Programmer's Guide

        The QNX OS Programmer's Guide covers a variety of topics that might interest developers who are building applications that will run under the QNX OS.

      • Writing a Resource Manager
    • System Security Guide

      The QNX System Security Guide is intended for both system integrators who are responsible for the security of a QNX OS system and developers who want to create a QNX OS resource manager free from vulnerabilities.

    • Utilities & Libraries

    • Migrating to QNX OS 8.0
  • QNX Software in the Cloud

    QNX Software in the Cloud enables developers to use the QNX OS in the Amazon cloud environment.

  • QNX Toolkit for Visual Studio Code

    This User's Guide describes the QNX® Toolkit for Visual Studio Code. The guide introduces you to the QNX Toolkit by explaining the QNX development environment and how to build, run, and debug your QNX® Operating System (OS) applications and systems.

  • QNX Hypervisor User's Guide

    This User's Guide explains the QNX hypervisor architecture and provides instructions for installing and running a QNX Hypervisor system, changing system components and configuration, and using hypervisor features such as virtual devices (vdevs).

  • Typographical Conventions, Support, and Licensing

    This section describes the typographical conventions used throughout the documentation, explains how to obtain technical support, and provides some information about licensing.

Resource manager structure

QNX SDP8.0Getting Started with the QNX OSDeveloperUser

Now that we've seen the data structures, we can discuss interactions between the parts that you'd supply to actually make your resource manager do something.

We'll look at:

  • The resmgr_attach() function and its parameters
  • Putting in your own functions
  • The general flow of a resource manager
  • Messages that should be connect messages but aren't
  • Combine messages
Page updated: March 05, 2025
Related information
  • Resource Managers (System Architecture)
  • Writing a Resource Manager