This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Task Manager

Create and manage task executions in Simulink model

  • Library:
  • SoC Blockset / Processor Task Execution

Description

The Task Manager block simulates the execution of software tasks as they would be expected to behave on an SoC processor. With the Task Manager, you can add and remove tasks from your model that can either be timer-driven or event-driven. Tasks can be represented in a model as rates, for timer-driven tasks, or function-call subsystems, for event-driven tasks, contained inside a single Model block. The Task Manager executes individual tasks based on their parameters, such as period, duration, trigger, priority, or processor core, and the combination of that task with the state of other tasks and their priorities in the running model.

Note

The Task Manager block cannot be used in a referenced model. For more information on referenced models, see Model block.

The Task Manager block provides three methods to specify the duration of a task in simulation:

  • A probability model of task duration defined in the block mask.

  • From a data file recording of either a previous task simulation or from a task on an SoC device.

  • Input ports on the block, which you can connect to more dynamic models of task duration.

Ports

Output

expand all

A function-call signal that can trigger timer-driven and event-driven tasks, represented as rate or function-call subsystems in the processor Model block, respectively.

For a rate port from a timer-driven subsystem, to show on the Model block, set the Block Parameters > Main > Schedule rates and select ports. For a function-call port from an event-driven subsystem contained in a Function-Call Subsystem block to show on the Model block, include an Inport in the processor Model block connected to the function-call trigger port of the subsystem. In the Inport, check Block Parameters > Signal Attributes > Output function call.

Note

The Task1 port must be connected to either a function-call port or scheduled rate signal port on a Model block.

Dependencies

To create or remove a control signal port for a task, add or remove the task from the Task Manager block by clicking the Add or Delete buttons in the block dialog mask.

Input

expand all

An event notification that triggers the associated event-driven task. The Task1Event port receives the event notification from either a Memory Channel block or IO Data Source block as an entity. For more information on entities, see Entities in an SoC Blockset Model.

Dependencies

To show a Task1Event port, then Task1 must have Type set to Event-driven.

Data Types: rteEvent

A positive value signal that specifies the execution duration of a task at the present time. For more information on specifying task duration, see Task Duration.

Dependencies

To enable this port, set the Specify task duration via parameter to Input port.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Parameters

expand all

Enable or disable the simulation of task duration. If you clear this parameter, tasks simulate using a function-call generator inheriting their period from the fundamental sample time of the model for event-driven tasks or from the dialog for timer-driven tasks.

List of the tasks generated by the Task Manager block. Each task has a set of parameters listed in the Main and Simulation tabs of the block dialog mask.

Add a task to the Task Manager block. During deployment, each task is encapsulated as an execution thread in the generated code. The properties of the thread are taken from the Main parameters for that task. During simulation, the task uses a combination of the Main and Simulation parameters for that task.

Remove a task from the Task Manager.

Dependencies

To enable this parameter, specify at least two tasks.

Main

Unique name of the task. The task name must only contain alphanumeric characters and underscores.

Specify the task as timer-driven or event-driven. For more information on timer- and event-driven tasks, see Timer-Driven Task and Event-Driven Tasks, respectively.

Dependencies

To enable this parameter, set Type to Timer-driven.

Specify the trigger time period for timer-driven tasks.

Specify the number of the processor core where a task executes. For more information on selecting cores and core execution visualizations, see Multicore Execution and Core Visualization.

Specify the schedulers priority for the event-driven task between 1 and 99. Higher priority tasks can preempt lower priority tasks, and vice versa. The task priority range is limited by the hardware attributes. For more information on task priority, see Task Priority and Preemption.

Dependencies

To enable this parameter, set Type to Event-driven.

Select this parameter to force tasks to drop, rather than catch up, following an overrun instance. For more information on task overruns, see Task Overruns and Countermeasures.

Simulation

Select this parameter for the Task Manager block to play back the recorded execution data provided from the specified File name parameter. For more information on replaying task execution, see Task Execution Playback using Recorded Data.

Specify the source of the timing information for the task execution.

  • Dialog - Use a normally distributed probabilistic model with Mean, Deviation, Min, and Max defined in the block dialog mask.

  • Input port – When set from Input port, the block input port dynamically defines the execution duration.

  • Record task execution statistics – Use a normally distributed probabilistic model with mean and deviation provided in file specified by File name.

For more information on configuring task duration, see Task Duration.

Task duration settings

Adds a distribution to the set of normal distributions that generates an execution duration. For more information on configuring task duration, see Task Duration.

Note

Only a maximum five distributions can be assigned to a single task.

Remove a distribution from the set of normal distributions.

Specify the likelihood of each normal distribution. The Percent weighted sum of normal distributions determines the task duration likelihood. For more information on configuring task duration, see Task Duration.

Note

The sum of Percent for all the distributions in a single task must equal 100.

Specify the mean duration of the task during simulation of the task. The simulated task duration uses a normal distribution with a specified Mean and SD parameter values as a first-order approximation of the task behavior. For more information on configuring task duration, see Task Duration.

Specify the standard deviation duration of the task during simulation of the task. The simulated task duration uses a normal distribution with a specified Mean and SD as a first-order approximation of the task behavior. For more information on configuring task duration, see Task Duration.

Lower limit of a task duration distribution. For more information on configuring task duration, see Task Duration.

Upper limit of a task duration distribution. For more information on configuring task duration, see Task Duration.

The data in this file specifies the Mean and SD parameter values. When the Play recorded task execution sequence parameter is selected, the specified CSV file provides the explicit task execution timing. The CSV file contains the diagnostic data of the task scheduler previously recorded from the hardware board. For more information on configuring task duration, see Task Duration.

Dependencies

To enable this parameter, set the Specify task duration via parameter to Recorded task execution statistics.

Extended Capabilities

Introduced in R2019a