System Manual Compact Systems 6 User Program
HI 800 141 E Rev. 2.02 Page 35 of 110
2. In Multitasking Mode 2, the unneeded duration of lower-priority user programs is distributed
among higher-priority user programs. In addition to the specified Max. Duration for Each
Cycle [µs], these user programs can use the portions of unneeded duration. This procedure
ensures high availability.
Four user programs are used in the example: Prg 1…Prg 4. The following priorities are
allocated to the user programs:
- Prg 1 has the lowest priority, priority x
- Prg 2 and Prg 3 have a medium priority, priority y
- Prg 4 has the highest priority, priority z
z
y
y
x
y
t
y
x x
Prg 1
Prg 3
y
Prg 2
y
Prg 4 z z
First CPU cycle considered.
Second CPU cycle considered.
Third CPU cycle considered.
Max. Duration for Each Cycle [µs] of Prg 1 has
expired, Prg 2 starts.
Max. Duration for Each Cycle [µs] of Prg 2 has
expired, Prg 3 starts.
Max. Duration for Each Cycle [µs] of Prg 3 has
expired, Prg 4 starts.
Max. Duration for Each Cycle [µs] of Prg 4 has
expired, completion of the first CPU cycle.
Completion of the Prg 1 cycle, Prg 2 is resumed.
The remaining duration is distributed to the Max.
Duration for Each Cycle [µs] of Prg 2 and Prg 3
(medium priority y) (arrows).
Prg 2 Max. Duration for Each Cycle [µs] +
proportional remaining duration of Prg 1 have
expired, Prg 3 is resumed.
Prg 3 Max. Duration for Each Cycle [µs] +
proportional remaining duration of Prg 1 have
expired, Prg 4 starts.
Max. Duration for Each Cycle [µs] of Prg 4 has
expired, completion of the first CPU cycle.
The next user program cycle of Prg 1 starts.
Completion of Prg 1 Max. Duration for Each
Cycle [µs], Prg 2 resumes.
Completion of Prg 2 Max. Duration for Each
Cycle [µs], Prg 3 is resumed.
Completion of the Prg 3 cycle, Prg 4 is resumed.
The remaining duration is added to Prg 4
(highest priority z).
Max. Duration for Each Cycle [µs] of Prg 4+
remaining duration of Prg 3 have expired,
completion of the third CPU cycle.
Figure 6: Multitasking Mode 2