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.

Job tasks 1:

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).

Job tasks 2:

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.

Job tasks 3:

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.

Job tasks 4:

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

Recommendations

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.