STE 58762 2-27
The task ID (the number assigned to the task) is described.
The characteristic numbers (task ID) are assigned to the tasks which have been started by the
TASK command respectively. In the example of Fig. 2, “1” is assigned to the program 1, “2” is
assigned to the program 2 and “3” is assigned to the program 3. This task ID starts from 1 in
sequence and this ID increases one by one every time the task starts (every time the task
executes). If the task is managed by the SCOL language, this task ID is used.
To get the task ID, see the following examples.
Example: I1 = TASK (“PROG 2”)
“I1” is a desired variable of integer type. The task ID of PROG 2 can be obtained. This command
is executed in the program 1. The task ID of its own cannot be referred to in the program 2 in this
example.
Example: I2 = TID
“I2” is a desired variable of integer type. If the system variable TID is referred to, the task ID of its
own can be acquired. If this command is executed in the program 2, the task ID of its own can be
seen in the program 2 (“2” in this occasion).
If this command is executed in the program 1, the task ID of program 1 (“1” in this occasion) is
substituted for “I2”.
If the task ID other than the own task is referred to from other tasks, variables of examples 1 and 2
are required to be defined as the global variable.
Change-over of task is described.
As shown in the Fig. 2, the system executes the program 1 ~ 3 by time sharing. When this
happens, timing of program change-over depends on the following three conditions.
(1) When the program change-over is specified clearly by the SWITCH command of the SCOL.
The SWITCH command is used if the task is changed over clearly by the SCOL language.
Even if the task change-over conditions specified in the system are not satisfied while the
SWITCH command is used, the task can be changed over.
(2) When a new task starts by the TASK command of the SCOL.
If a new task starts by the TASK command, the program control is changed over to the
newly started task.
(3) When the task terminates by the KILL command of the SCOL.
If the task of its own terminates by the KILL command, the program control is changed over
to the next task.