How to change the execution mode of the real-time application in slrt from Singletasking to Multitasking?
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949974/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949979/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949984/image.png)
But, when i load this real-time application into the target and run it. The application execution mode is still Single-Tasking.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949989/image.png)
So, How to change the execution mode of the real-time application from Singletasking to Multitasking?
댓글 수: 0
채택된 답변
Dimitri MANKOV
2022년 4월 4일
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.
Best,
Dimitri
댓글 수: 3
Dimitri MANKOV
2022년 4월 5일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multicore Processor Targets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!