Linux Task
Spawn task functions as separate Linux threads
Add-On Required: This feature requires the Embedded Coder Support Package for Intel SoC Devices add-on.
Libraries:
Embedded Coder Support Package for Intel SoC Devices
Description
Use this block to create a task function that spawns as a separate Linux® thread. The task function runs the code of the downstream function-call subsystem.
Examples
Get Started with Embedded Coder Support Package for Intel SoC Devices
Use Embedded Coder® Support Package for Intel® SoC Devices to run a Simulink® model on an Intel SoC device.
Ports
Output
Port_1 — Function-call control signal
scalar
A function-call control signal that triggers a Function-Call Subsystem block.
Parameters
Task name — Name of task in generated code
task0 (default) | character vector
Assign a name to this task. You can enter up to 32 letters and numbers. Do not use
standard C reserved characters, such as the /
and
:
characters.
Programmatic Use
Block Parameter:
taskName
|
Default:
Task0
|
Thread scheduling policy — Thread scheduling policy
SCHED_FIFO
(default) | SCHED_OTHER
Select the scheduling policy that applies to this thread. You can choose from the following options:
SCHED_FIFO
enables a First In, First Out scheduling algorithm that executes real-time processes without time slicing. With FIFO scheduling, a higher-priority process preempts a lower-priority process. The lower-priority process remains at the top of the list for its priority and resumes execution when the scheduler blocks all higher-priority processes.For example, in the following image, task2 preempts task1. Then task3 preempts task2. When task3 completes, task2 resumes. When task2 completes, task1 resumes.
Selecting
SCHED_FIFO
, displays the Thread priority parameter, which you can set to a value from 1 to 99.SCHED_OTHER
enables the default Linux time-sharing scheduling algorithm. You can use this scheduling for all processes except those requiring special static priority real-time mechanisms. With this algorithm, the scheduler chooses processes based on their dynamic priority within the static priority 0 list. Each time the process is ready to run and the scheduler denies it, the operating system increases the dynamic priority of that process. Such prioritization helps the scheduler serve the SCHED_OTHER processes.Selecting
SCHED_OTHER
, hides the Thread priority parameter, and sets the thread priority to 0.
Programmatic Use
Block Parameter:
taskPolicy
|
Type:
SCHED_FIFO | |
Values:
SCHED_OTHER | |
Default:
SCHED_FIFO
|
Thread priority (1 to 99) — Thread priority
1 (default) | 1 – 99
When you set Thread scheduling policy to
SCHED_FIFO
, you can set the priority of the thread from 1
to 99 (low-to-high).
Higher-priority tasks can preempt lower-priority tasks.
Note
The task priority rate for VxWorks® follows a POSIX® priority numbering system where higher value results in higher task priority.
Programmatic Use
Block Parameter:
taskPriority
|
Default:
1
|
Version History
Introduced in R2014b
See Also
Topics
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)