Q: What support does NEXTSTEP supply for real-time programs?
A: NeXT's support for real-time programming was enhanced in Release 2. On NeXT Computers, this capability can also be extended by using the DSP as a dedicated, very programmable serial port. Actual real-time performance for code running on the 68030 or 68040 is not guaranteed, because the Mach kernel itself is not preemptable at this point. This topic is a source of continuing work at NeXT, so that we may achieve some guaranteed real-time responsiveness on all available platforms in the future .
The primary support added in Release 2 for real-time programming was the addition of scheduling policies that can be set on a per-thread basis. There are now three scheduling policies: POLICY_TIMESHARE for traditional UNIX scheduling, POLICY_INTERACTIVE designed for interactive behavior for applications, and POLICY_FIXEDPRI for non-degrading realtime priorities. Additionally, thread_switch() can be used to do user-level scheduling among a set of threads.
The DSP supplied with NeXT Computers is inherently a real-time programming environment. It is best used for low-level interrupt processing and data reduction/expansion. It's currently used this way for real-time expansion of sound before it's played, as well as data reduction of input from the DSP serial port. The DSP can then communicate with a Mach task using the Sound/DSP driver interface. The combination of these features makes NeXT Computers a suitable platform for a wide range of real-time programming tasks. The key is to require no more than 100ms responsiveness from Mach-level programs with a light virtual memory load.
In the future we hope to remove the remaining barriers to Mach-level real-time programming by enhancing the scheduler behavior and supporting user-level wiring of virtual memory resources.
QA623
Valid for 2.0, 3.0