Home |
RTKernel-32 Programming Manual Multitasking, Real-Time, and RTKernel-32 Alternate APIs for RTKernel-32 Preemptive or Cooperative Multitasking? Starting Objects' Methods as Tasks Performance and Interrupt Response Times Task Switches in Cooperative Scheduling Using the FPU in Interrupt Handlers |
Task Switches in Cooperative SchedulingDuring cooperative scheduling, each task must explicitly allow the kernel to perform task switches. If a task fails to do so, it runs exclusively and other tasks will not be able to run. If a task switch has become necessary during cooperative scheduling by a hardware interrupt, the pending task switch is done later during a kernel call of the currently running task or a task running on a different CPU. All kernel functions can be classified in three types: calls that will always perform pending task switches, calls that will only perform task switches if they have caused a task state change, and calls that will never perform a pending task switch. The following table lists all kernel functions of the first two types: Other kernel calls do not lead to task switches during cooperative scheduling. Naturally, all operations containing one of the above calls can lead to a task switch indirectly. In particular, some of these are:
During cooperative scheduling, you should make sure that each endless loop in a program contains at least one call to the kernel to allow it to perform pending task switches caused by interrupts.
|