N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## osCreateScheduler

Syntax
#include <ultra64.h>
void osCreateScheduler(OSSched *s, void *stack, OSPri priority, u8 mode, u8 retraceCount);
Arguments

- s is the pointer to the scheduler structure to initialize
- stack is the pointer to the stack for the scheduler thread
- priority is the priority for the scheduler thread
- mode is the video mode with which to initialize the VI Manager
- retraceCount is the number of retraces per retrace message sent

Explanation
It creates an RCP task scheduler. The Scheduler is a host CPU thread that is responsible for executing audio and graphics tasks on the RCP such that host and RCP overrun is minimized or eliminated.
Each video retrace, the Scheduler reads the new tasks generated by the scheduler client threads from the task queue and adds them to the end of a real-time (audio) or non-real-time (graphics) task schedule list.
If the previous frame's graphics task has overrun, the Scheduler causes the task to yield. It then runs the next audio task, resuming the yielded task when the audio task has completely processed. Then it runs any additional graphics tasks that are to be run in the current frame.
When a task completes, the Scheduler sends a message to the client indicating that the work it requested is complete.
Before using the Scheduler, you must first call osCreateScheduler to initialize the OSSched data structure along with its message queues and the VI Manager. The osCreateScheduler function spawns a thread to schedule and manage task execution. One of its arguments is the thread priority, which should be higher than that of the threads that generate the command lists.
See Also
osScAddClient
osScGetTaskQ
osCreateScheduler

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998