![]() |
Home |
|
Cooperative and Preemptive MultitaskingPreemptive multitasking means that task switches can be initiated directly out of interrupt handlers. With cooperative (non-preemptive) multitasking, a task switch is only performed when a task calls the kernel, i.e., it behaves "cooperatively" and voluntarily gives the kernel a chance to perform a task switch. Example:A receive interrupt handler for a serial port writes data to a mailbox. If a task is waiting at the mailbox, it is immediately activated by the scheduler during preemptive scheduling. In cooperative scheduling, however, the task is only brought into the state "Ready". A task switch does not immediately take place; after the interrupt handler has completed, the task having been interrupted continues to run. Such a "pending" task switch is performed by the kernel at some later time, as soon as the active task calls the kernel. RTKernel-32 supports both cooperative and preemptive scheduling. The preconfigured default is cooperative scheduling.
|