Clear Filters
Clear Filters

How to change the execution mode of the real-time application in slrt from Singletasking to Multitasking?

7 views (last 30 days)
As shown in the figure below,I create a simulink model that have 3 unrelated tasks. I hope these tasks can simultaneously run on different cores of the target computer cpu. What should I do? I try to build this model into Real-Time Multitasking Execution mode.
As shown in the figure below,I chose the Allow task execute concurrently on target option in the Solver pane. Furthermore,the get_param function return the MultiTasking result.
But, when i load this real-time application into the target and run it. The application execution mode is still Single-Tasking.
So, How to change the execution mode of the real-time application from Singletasking to Multitasking?

Accepted Answer

Dimitri MANKOV
Dimitri MANKOV on 4 Apr 2022
Hi Liqun,
This is most likely due to the fact that your model uses only one sample rate. You can confirm this by highlighting the blocks of your model according to their sample time, see here.
By default, Simulink Coder can automatically partition the model into several tasks only if there are multiple rates defined in the model. Then each rate would get its own task.
If you need to run blocks that use the same step size in different tasks, you need to use explicit (manual) partitioning. You can find an example showing how to do that here.
Dimitri MANKOV
Dimitri MANKOV on 5 Apr 2022
That's correct: each task runs on a separate CPU core. The core assignment is done automatically, the user has no control over that. Tasks are sorted by priority (lower step size => higher priority), and a task can be preempted ("paused") to free a CPU core for a task with higher priority if necessary.

Sign in to comment.

More Answers (0)


Find more on Multicore Processor Targets in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!