Available Languages?:

OSA : Scheduler

The service OS_Run() is a macro that contains an infinite loop calling the scheduler. This service should be called at the end of function main(). It gives full control to the OSA kernel. The scheduler examines all active tasks and looks for the ready task with highest priority. When the task is found, the scheduler executes it.

OS_Run() is a macro. This macro contains global labels; thus this service can be used only once in the program.

So your program can look like this:

void main (void)
{
    OS_Init();
    OS_Task_Create(...);
    OS_Task_Create(...);
    // Create all the tasks you need
    // ...
 
    OS_Run();
}

The scheduler scans all active tasks (i.e. those created by service OS_Task_Create) and finds all those ready to execute. Then the scheduler compares the priorities of all ready tasks and gives control to the highest priority one of them. There is one exception: when one of the tasks is in a critical section, only this task can get control; other tasks are skipped by the scheduler in this case.

If, while scanning all tasks, the scheduler finds a ready task with priority = 0 (highest) then the scheduler stops the search and gives control to this task. This increases the scheduler's speed (see Speed characteristics)

 
en/osa/ref/description/scheduler.txt · Last modified: 07.10.2010 13:58 (external edit)
 
Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki