News & Analysis
Reservation approach guaranties quality sound delivery
6/24/2002 7:41 AM EDT
Peter Dibble, Distinguished Engineer, TimeSys Corp., Pittsburg, Pa
Audio, however it is transmitted, challenges a system's real-time capabilities. Defects in audio timing are particularly easy to hear. A system that aims to carry high-quality audio over a network must respect the timing requirements of the stream. Techniques from real-time systems research allow a relatively low-powered system with a heavy load to deliver good end-to-end response by reserving CPU capacity and network bandwidth. The concept is simple: a reservation is a budget for CPU cycles or bytes of network I/O.
The budget is specified in terms of an interval or a throughput ceiling such as 10 kilobytes/second. At the beginning of each interval, the system sets its budget to the amount, and then it tracks the use of the reserved resource by all the threads that are using the reservation. Until the budget is exhausted, those threads run at a high priority. If they attempt to use more than the reservation, the operating system drops their priority.
A reservation is both a guarantee and a limit. If the system grants reservations for CPU and network capacity for audio processing, it has analyzed the commitments it has already made, and determined that it can deliver the reserved capacity under any circumstances short of system failure. Guarantees cannot work unless the system also has a way to enforce limitations. Once a reservation is exhausted, it is given a low priority; it can even be completely shut off.
A good starting point for the academic aspect of reservation technology is, "Linux/RK: A Portable Resource Kernel in Linux" by Shui Oikawa and Raj Rajkumar in IEEE Real-Time Systems Symposium Work-In-Progress, 1998. A commercial implementation of reservation technology is available as a loadable module for TimeSys Linux.
A dedicated audio device has little use for this technology. Either it can handle that single stream of audio, or it needs more hardware resources. Reservations become useful when the device is more sophisticated, with multiple activities such as multiple audio streams, audio and billing, audio and user interface, or audio and general-purpose Internet access.
Consider, for example, a home gateway, a system which can become a scheduling challenge. At the lowest level, it is a general-purpose embedded computer with an internal network connection and an external network connection. It may also have peripherals including a printer, network storage, and CD-ROM and DVD libraries. The software in the server might be little more than a firewall, but it might also amount to a private full-service Web server with heavy support for streaming media.
Audio and video streams can be expected to go to an expanded gateway from either side, from the gateway into the home, and through the gateway into the home. With conventional priority scheduling, such a system would accept any load without complaining, and use inflexible rules when it degrades under load.
Such a system could better handle the nuances of a user's requirements with use of reservation technology. For instance, voice over IP has relatively stringent timing requirements, so it makes some sense to give it a relatively high priority, but that leaves the system open to abuse by malicious applications that spoof VoIP to get preferential treatment for their data. The stream of AM-radio-quality news is undemanding, so it might ordinarily get a low priority, however, in some instances it may be more important than other data.
Reservation technology can also be used to create smart front-ends for a home gateway, giving users control over trade-offs in the services they receive. The system could inform the user that there isn't enough space for a VoIP call, but there will be if the user turns off the music or changes it from stereo to monaural.
A Web server managing an audio stream provides another useful case in point. In some senses streaming media may be the perfect load for a web server. It is a predictable load with little CPU demand. The system can be sized to deliver the right bandwidth from the disk drives through the network interface, and if the network can guarantee quality of service, the smooth flow can extend from the RAID to the consumers' cable modems.
To minimize cost, this type of web server should be balanced so every resource is heavily used. Using a conventional scheduler, the system needs to be configured with a generous margin to tolerate problems such as errors, and malicious packet storms.


See related chart
