Job tasks
Job Tasks are used by TwinCAT Vision to parallelize functions. Depending on the system in use, its configuration, the API functions in use, the image content and the number of job tasks, this can lead to a shortening of the execution time. The supported functions are marked in the API reference by the comment “Can use available TwinCAT Job Tasks for executing parallel code regions.” The Vision Job Pool is used to assign which Job Tasks are used by TwinCAT Vision. Job Tasks only need to be created and configured once; thereafter the parallelization takes place automatically in the runtime.
Benefit of Job Tasks The actual benefit of Job Tasks must be checked in the individual case. This is dependent on the system in use, its configuration, the API functions in use, the image format, the image content and the number of Job Tasks. |
Use
Like other tasks, Job Tasks can be created via the Solution Explorer > SYSTEM >, right-click Tasks > Add new item.... In the following Insert Task Dialog, select the type TwinCAT Job Task (Worker Task).
A corresponding core assignment can then be made via Solution Explorer > SYSTEM > Real-Time, like for all other tasks. Observe the notes under Restrictions and recommendations.
Notice | |
Floating point exceptions This setting specifies whether or not TwinCAT checks for floating point exceptions. The same option should be selected here as in the Configuration of the corresponding PLC tasks. Otherwise exceptions and system crashes can occur. |
The assignment of which job tasks are used by TwinCAT Vision is made via the parameter list of the Vision Job Pool. The Vision Job Pool can be found in the Solution Explorer below the Vision node, as soon as an application has been created there.
Prioritization
Prioritization of the Vision Job Pool access
If several programs that are executed in parallel share the Vision Job Pool, the program with the highest task priority is generally granted access to the Job Tasks. However, this assignment is dynamic, i.e. if the program with the highest priority is currently in a sequential processing section, lower-priority programs can use the Job Tasks. As soon as a higher-priority program can process tasks in parallel, the tasks of lower-priority programs are displaced. However, the master task of the lower-priority program is able to terminate a task started in parallel on its own, so that there is no need to wait for a new availability of Job Tasks.
Multiple tasks on one core
As indicated in the section on restrictions and recommendations, a Job Task should not share a core. Otherwise, the task priorities apply.
Restrictions
- Job Tasks can currently only be used for TwinCAT Vision.
- More than one Job Task may not be assigned to the same core.
- A Job Task should not be assigned to the same core as a Vision PLC task.
- A Job Task should not be assigned to the same core as the PlcAuxTask.
Recommendations
- Each Job Task should be assigned to a dedicated isolated core.
- However, if another cyclic task runs on the same core as a Job Task, the priority of the cyclic task should be higher than that of the Job Task. It should be noted that this restricts parallelization and, in the worst case, make it unavailable.
- No job task should be assigned to the default core.
If cyclic TwinCAT tasks or the Windows operating system claim computing time on the core at the same time, an analysis is hampered due to the varying load of the Job Task.