Home |
RTKernel-32 Programming Manual Multitasking, Real-Time, and RTKernel-32 RTKernel-32's Scheduler Alternate APIs for RTKernel-32 |
RTKernel-32's SchedulerThe decision which task is to run is made by the Scheduler. Only task states and priorities are considered in this process. RTKernel-32's scheduler is not - like in many other systems - primarily based on the timer interrupt; rather, RTKernel-32 is an event-driven system. An event is an inter-task communication that may be initiated by a task or an interrupt handler. Events can lead to task state changes of the tasks involved. RTKernel-32's timer interrupt handler is just one interrupt handler among others. It has the sole purpose of bringing tasks waiting for a certain point in time into the state "Ready". Some multitasking programs could run completely without the timer interrupt handler. The scheduler implements the following rules:
Normally, the rules given above are obeyed strictly, i.e., they are never violated. Whenever a task's state changes, the scheduler checks whether a task switch becomes necessary according to the scheduling rules. Only during cooperative scheduling, rule 1 can be violated between the occurrence of an interrupt and the next call to the kernel. Rule 1 may also be violated when the execution of threads has been restricted through function RTKSetCPUMask. Time slice task switches are performed if the following conditions are satisfied:
The value of TimeSlice is set using function RTKTimeSlice. If TimeSlice is 1, condition 3 is true in every timer interrupt. Please note that preemptions are not required for time slicing. The multiprocessor kernel evaluates the timeslice criteria on each CPU separately. Time slicing plays a minor role and must not violate the scheduling rules given above. Multitasking, Real-Time, and RTKernel-32
|