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 QNX Neutrino 7.1.

  3. Programming

  4. Getting Started with QNX Neutrino

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

  5. Processes and Threads

  6. More on synchronization

  • QNX Momentics IDE User's Guide

    This User's Guide describes version 7.1 of the Integrated Development Environment (IDE) that's part of the QNX Momentics 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 QNX Neutrino 7.1.

    • Quickstart Guide

    • OS Components & Operations

    • Audio & Graphics API

    • Multimedia

    • Networking Middleware

    • Programming

      • Getting Started with QNX Neutrino

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

        • Processes and Threads

          • Process and thread fundamentals

            Before we start talking about threads, processes, time slices, and all the other wonderful scheduling concepts, let's establish an analogy.

          • The kernel's role

            The house analogy is excellent for getting across the concept of synchronization, but it falls down in one major area. In our house, we had many threads running simultaneously. However in a single-processor system, only one thing can run at once.

          • Threads and processes

            Let's return to our discussion of threads and processes, this time from the perspective of a real live system. Then, we'll take a look at the function calls used to deal with threads and processes.

          • More on synchronization

            • Readers/writer locks

              Readers and writer locks are used for exactly what their name implies: multiple readers can be using a resource, with no writers, or one writer can be using a resource with no other writers or readers.

            • Sleepon locks

              Another common situation that occurs in multithreaded programs is the need for a thread to wait until something happens. This something could be anything! It could be the fact that data is now available from a device, or that a conveyor belt has now moved to the proper position, or that data has been committed to disk, or whatever. Another twist to throw in here is that several threads may need to wait for the given event.

            • Condition variables

              Condition variables (or condvars) are remarkably similar to the sleepon locks we just saw above. In fact, sleepon locks are built on top of condvars, which is why we had a state of CONDVAR in the explanation table for the sleepon example. It bears repeating that the pthread_cond_wait() function releases the mutex, waits, and then reacquires the mutex, just like the pthread_sleepon_wait() function did.

            • Additional OS services

              QNX Neutrino lets you do something else that's elegant. POSIX says that a mutex must operate between threads in the same process, and lets a conforming implementation extend that. QNX Neutrino extends this by allowing a mutex to operate between threads in different processes. To understand why this works, recall that there really are two parts to what's viewed as the operating system—the kernel, which deals with scheduling, and the process manager, which worries about memory protection and processes (among other things). A mutex is really just a synchronization object used between threads. Since the kernel worries only about threads, it really doesn't care that the threads are operating in different processes—this is an issue for the process manager.

            • Pools of threads

              Another thing that QNX Neutrino has added is the concept of thread pools. You'll often notice in your programs that you want to be able to run a certain number of threads, but you also want to be able to control the behavior of those threads within certain limits.

            • An example of synchronization

              Let's look at an example of synchronization in a multithreaded program.

          • Scheduling and the real world

            So far we've talked about scheduling policies and thread states, but we haven't said much yet about why and when things are rescheduled.

        • Message Passing

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

        • Clocks, Timers, and Getting a Kick Every So Often

          It's time to take a look at everything related to time in the QNX Neutrino RTOS. We'll see how and why you'd use timers and the theory behind them. Then we'll take a look at getting and setting the realtime clock.

        • Interrupts

          In this chapter, we'll take a look at interrupts, how we deal with them under QNX Neutrino, 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 Neutrino that allow you to access services through standard POSIX calls.

        • Sample Programs

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

        • Glossary

      • Programmer's Guide

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

      • The QNX Neutrino Cookbook: Recipes for Programmers
      • Writing a Resource Manager
    • Sensor Framework

    • System Security Guide

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

    • Utilities & Libraries

  • QNX Hypervisor

    The QNX Hypervisor allows you to run multiple OSs on a target system so you can separate critical and non-critical functions, support a wide variety of applications, and reduce hardware costs.

  • QNX Software in the Cloud

    QNX Software in the Cloud enables developers to use the QNX software in Amazon Web Services (AWS) and Microsoft Azure (Azure).

  • QNX Advanced Virtualization Frameworks User's Guide

    This User's Guide is aimed at all systems integrators and developers who want to design and build embedded systems using the QNX Advanced Virtualization Frameworks.

  • Typographical Conventions, Support, and Licensing

    This section describes the typographical conventions used throughout the documentation and explains how to obtain technical support.

More on synchronization

We've already seen:

  • mutexes
  • semaphores
  • barriers

Let's now finish up our discussion of synchronization by talking about:

  • readers/writer locks
  • sleepon locks
  • condition variables (condvars)
  • additional OS services

followed by an example.

Page updated: March 12, 2026
Related information
  • Synchronization services (System Architecture)