Agile development of real-time systems

In this Product How-To Henk Muller of XMOS uses the company’s dual Xcore architecture to illustrate his argument that given a predictable underlying processor architecture agile development is very well suited to real-time software.

Agile development is the process of continuously cycling through the whole software development process to incrementally, quickly and visibly develop a working piece of software.

In this article we argue that given a predictable architecture, agile development is very well suited to develop real-time software. Without a predictable architecture, one of the iterations of the development process is likely to introduce subtle timing errors in components of the software that were not touched.

In an environment where software components can be composed with known effects on the timing, and the tools check timing constraints because the underlying architecture has known performance characteristics, teams of developers can make iterations through the software without breaking working components.

Agile development methods

Agile development methods are established techniques to develop software projects. A key element of agile development is quick successive iterations through the software development process. Each iteration through requirements, implementation, unit testing and user testing leads to a working product that is refined in the next iteration.

Agile development methods are attractive because they are more flexible in situations where product specifications are not fixed, and where time to market is crucial. Traditional examples where agile development methods work are web applications, compilers, or mobile phone applications.

In all cases, the ability to evaluate successive prototypes, and use the information gleaned to steer subsequent prototypes, is invaluable. For example, whether the user-interface is right in the case of the web applications, or whether the right optimizations are implemented in the case of a compiler.

It is essential that the prototypes that are developed in the process of an agile development method are functional prototypes. They may have limited functionality, but the offered functionality is bug-free, and hence the product can be used for testing purposes. This makes the agile development methods different from “hacking” together a prototype.

Real-time systems. Real-time systems come in many shapes and forms. The distinguishing characteristic of a real-time system is that, in addition to functional requirements, timing requirements must be met for the system to operate correctly. The level at which the timing requirements are to be met differs wildly between systems; both in terms of granularity of the timing requirements and how strict the requirements are.

The most precise time requirements are systems that interface directly with other hardware. For example, when reading data from a CMOS optical sensor, pixels are required to be read at a clock of, for example, 25 MHz.

This means that a pixel has to be read every 40 ns. One level less precise, an audio system will process audio samples at a rate of 48 kHz – or one audio sample every 20.8 us, almost three orders of magnitude slower. Another three orders of magnitude slower, a video player will play a frame at a rate of 30 fps, or one frame every 33 ms.

The examples above are multimedia systems, and the consequences of missing a sample vary but are unlikely to be disastrous. In the case of a single missed pixel, one line in the image will be slightly distorted; a single missed audio sample will probably result in an audible click; and a single missed frame will probably cause a slight flicker on the screen.

Having said that, if the system in question is a live concert, then missed samples will result in a click for 100,000 listeners.

Other real-time systems that miss a real-time deadline may face more serious consequences. A motor control system that misses a deadline may cause the motor to vibrate, and an avionics system that misses deadlines may make an aircraft unresponsive. In these cases, the real-time requirements are strict.