Task Priorities

A REXIS task has a priority, ranging from REXIS_PRIO_MIN to REXIS_PRIO_MAX. The REXIS kernel uses a table, indexed by the priority levels, to store lists of runnable tasks. Each task list is ordered by when the task becomes eligible to run. This allows for priority-based round-robin scheduling, such that the oldest available task of a priority level is selected to run before a later available task.

The value of REXIS_PRIO_MIN is 1 and the default value of REXIS_PRIO_MAX is 3. If you have a source license for REXIS, you may change the REXIS_PRIO_MAXvalue to be any number that can be represented in the datatype of the prio field in the internal process structure, which is by default an unsigned char. However, having too many priority levels slows down the kernel when it is looking for the next task to run. Therefore, it is best to keep the number of priority levels small.

In addition to being used for scheduling, task priorities are used whenever tasks are maintained in a list. For example, multiple messages sent to a task are queued by the sender tasks’ priorities, and then by the order the messages are received. This way, a message from a higher priority task will be processed before a low priority one.