Real-Time Workshop | ![]() ![]() |
Singletasking vs. Multitasking Operation
Singletasking programs require longer sample intervals, because all computations must be executed within each clock period. This can result in inefficient use of available CPU time, as shown in Figure 8-5.
The use of multitasking can improve the efficiency of your program if the model is large and has many blocks executing at each rate.
However, if your model is dominated by a single rate, and only a few blocks execute at a slower rate, multitasking can actually degrade performance. In such a model, the overhead incurred in task switching can be greater than the time required to execute the slower blocks. In this case, it is more efficient to execute all blocks at the dominant rate.
If you have a model that can benefit from multitasking execution, you may need to modify your Simulink model by adding Rate Transition blocks to generate correct results. The next section, Sample Rate Transitions, discusses issues related to rate transition blocks.
![]() | Executing Models in Real Time | Sample Rate Transitions | ![]() |