4.7 RCP Task Management

Both the audio and graphics libraries provide support for generating command lists to be executed on the RCP, but they do not handle the command list execution. It is therefore necessary for the application to manage the scheduling and execution of RCP tasks (command lists and microcode) on the RCP. To facilitate this, the development package includes an example RCP scheduler.


4.7.1 The Scheduler of "Simple" Application

The structure of the scheduler included with the "Simple"application is described briefly below. Please refer to the example code in the "Simple"directory for additional details.

UP The Scheduler Thread

The scheduler thread is responsible for collecting display/command lists from other threads and assigning them to RCP tasks for scheduling and execution so that real-time constraints are met. This thread has the highest priority of the application threads, to insure that scheduling occurs periodically.

The scheduler executes a task on the RCP based on the retrace interrupt and then monitors the progress, yielding the graphics tasks periodically to interleave audio tasks if necessary.

UP Other Application Threads

The next highest priority application thread is the Audio Manager thread. It is responsible for creating audio display lists, sending them to the scheduler for execution, and transferring the finished audio to the codecs. It has a higher priority than the game thread to prevent audio clicks caused when the audio thread cannot meet its real-time constraints.

Note: The Audio Manager thread is essentially a low-level wrapper around the alAudioFrame call. (Please see "17.4 The Synthesis Driver" for details). Higher-level Audio Library calls are made from the game thread.

The game thread is responsible for generating graphics display lists and sending them to the scheduler for execution. In addition, the game thread handles the controller input, makes calls to the Audio Library, and performs other tasks.