Standard Training Courses
Realtime Programming under the QNX RTOS v4
Prerequisites
You should have a good working knowledge of the C programming language.
Objectives
This course is designed for anyone who wants to develop applications more efficiently under the QNX® RTOS v4. By the end of the course, you will have learned practical, time-saving techniques that help you design and write successful QNX RTOS v4 applications.
The course has three main goals:
- Demonstrate time-saving programming skills that can be applied to both the QNX RTOS v4 and subsequent versions of QNX OS technology.
- Familiarize developers with realtime concepts as they pertain to the QNX RTOS v4.
- Provide hands-on exercises that allow developers to apply the techniques covered in the course.
Topics
The course consists of the following sections:
-
Introduction
We'll start off with a brief overview of the QNX RTOS v4 architecture, delving into what the microkernel and process manager do and provide. We'll cover important QNX concepts such as modularity and the prefix namespace. And we'll also introduce the operating system's self-hosted development environment, including the Watcom compiler, Ditto™, and qtalkIn this section, you will have a chance to become more comfortable with the QNX RTOS v4 documentation. You will also learn how to use the helpviewer and documentation to your best advantage.
-
Interprocess communication
Native message passing is at the heart of QNX RTOS v4 and can be the most important thing for a QNX developer to understand. You will leave the course knowing when and how to use message-passing concepts such as blocking, multi-part messages, multiple reads of a message buffer, and multiple writes to a reply buffer. We'll discuss what to do when a client process is hit with a signal while its message is being processed. And we'll cover an invaluable technique called reply-driven messaging.You will learn techniques for avoiding deadlocks and for handling other synchronization issues. We'll show you the method we recommend for one process to find another. In addition, we'll look at the operating system's network-distributed nature. You will learn how to determine which processes are communicating with which other processes.
Proxies are another important concept in the QNX RTOS v4. We'll show you how to use proxies to do nonblocking event notification. For those coming from the TCP world, we show how select() makes use of proxies. We'll also cover using proxies across a QNX network.
We'll discuss other interprocess communication techniques, many of which are built on top of message passing. We'll start with POSIX signals and the functions needed to work with them. Next, we'll look at POSIX shared memory and the associated synchronization issues. Then, we'll introduce POSIX semaphores as a way to handle these issues. We'll finish up with POSIX message queues and a short discussion of pipes.
-
The QNX process model
An understanding of the QNX process model will help you make decisions about how to break applications into separate processes, which priorities to run the processes at, and which scheduling algorithms to apply. We'll cover all these situations and show you the functions to use. We'll also show how to handle priority inversion and how to have messages received in process priority order instead of FIFO.In this section, you will learn how tools such as sac and sysmon can help you examine what is happening in a system and to diagnose problems. We'll examine actual source for an example of how to run processes on other nodes of a QNX network. And we'll show you some of the things that can be done using shared memory functions.
-
Timers, clocks, and timeouts
In a realtime system, you need to keep track of real time and to schedule periodic events. By looking at functions dealing with real time, timers, and kernel timeouts we'll show you how timing is implemented in the QNX RTOS v4 and how to arrange the priorities of processes that handle timing. -
Interrupts
Dealing with interrupts under other operating systems is an often difficult and awkward task. Not so with the QNX RTOS v4. We'll demonstrate a number of approaches that show how simple it is to write and debug interrupt handlers. -
Writing an I/O manager
An I/O manager under the QNX RTOS v4 is much more than just a device driver. It can be just about any process that receives messages. In this key section of the course we'll show you the easiest method of writing a complete I/O manager with the use of a special set of library functions. We'll also look at the capabilities of I/O managers, including pathname space resolution and inheritance. -
Other topics
In the latter part of the course we'll cover a number of other useful tools and little-understood concepts. We'll introduce you to the trace facility, an important tool that can be used for event logging as well as for debugging interrupt handlers. We'll go over the concepts and techniques involved with sessions, process groups, and controlling terminals. We'll briefly discuss embedding the QNX RTOS v4.To produce an optimum solution, developers must know how to tune the operating system and the application's processes. We'll cover compilation and linker options as well as how to tune the process manager and file system manager.
-
QNX RTOS v4 in practice
Throughout the course, you will have a chance to put what you learn into practice by writing various programs. After learning each programming technique, you will apply it to situations that may arise in their own applications. Diskettes with solutions to the problems covered in class will be distributed at the end of the course, and blank diskettes will also be provided to let you take your work home.