User`s guide

Slice 1: Task A priority 10, Task B priority 10
Slice 5: Task B priority 15, Task C priority 15
All three tasks, A, B, and C, are in the same round-robin group because task B appears in
both. Therefore, task C may run in slice 1 at priority 10, or task A may run in slice 5 at priority
15, depending on which member of the group ran most recently.
The RELEASE program instruction may be used to bypass the normal scheduling process by
explicitly passing control to another task. That task then gets to run in the current time slice
until it is rescheduled by the 1ms clock. A task may also RELEASE to anyone, which means
that a normal scan is made of all other tasks to find one that is ready to run. During this scan,
members of the original task's round-robin group (if any) are ignored. Therefore, RELEASE to
anyone cannot be used to pass control to a different member of the current group.
AWAIT program instruction with no argument suspends a task until the start of the next
major cycle (slice 0). At that time, the task becomes runnable and will execute if selected by
the normal scheduling process. A WAIT with an expression performs a release to anyone if
the expression is FALSE.
On systems that include the V+ extensions, the V+ task profiler can be used to determine
how the various tasks are interacting. It provides a means of determining how much time is
being used by each task, either on an average basis or as a snapshot of several consecutive
cycles.
Within each time slice, the task with highest priority can be locked out only by a servo
interrupt. Tasks with lower priority can run only if the higher-priority task is inactive or
waiting. A user task waits whenever any of the following occurs:
l The program issues an input or output request that causes a wait.
l The program executes a robot motion instruction while the robot is still moving in
response to a previous motion instruction.
l The program executes a WAIT or WAIT.EVENT program instruction.
If a program is executing continuously without performing any of the above operations, it
locks out any lower-priority tasks in its time slice. Thus, programs that execute in a
continuous loop should generally execute a WAIT (or WAIT.EVENT) instruction occasionally
(for example, once each time through the loop). This should not be done, of course, if timing
considerations for the application preclude such execution delays.
If a program potentially has a lot of critical processing to perform, its task should be in
multiple slices, and the task should have the highest priority in these slices. This will
guarantee the task's getting all the time needed in the multiple slices, plus (if needed)
additional unused time in the major cycle.
The following figure shows the task scheduler algorithm. This flow chart assumes that the
servo task is configured to run every 1ms and no task issues a RELEASE instruction.
(Actually, at the point marked run servos?, any system level interrupts are processed-in
Scheduling of Program Execution Tasks
V+Language User's Guide, v17.0
Page 50