HIMax System  5 Programming 
HI 801 001 E Rev. 4.01  Page 73 of 122 
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. The following priorities are allocated to the 
user programs: 
-  UP 1 has the lowest priority, priority x 
-  UP 2 and UP 3 have a medium priority, priority y 
-  UP 4 has the highest priority, priority z 
 
  First CPU Cycle Considered. 
  Second CPU Cycle Considered. 
  Third CPU Cycle Considered. 
 The Max. Duration for Each Cycle [µs] of UP 1 
has Expired, UP 2 Starts. 
 The Max. Duration for Each Cycle [µs] of UP 2 
has Expired, UP 3 Starts. 
 The Max. Duration for Each Cycle [µs] of UP 3 
has Expired, UP 4 Starts. 
  The UP 4 Max. Duration for Each Cycle [µs] 
has Expired, Completion of the First CPU Cy-
cle. 
  Completion of the UP 1 Cycle, UP 2 Re-
sumes. The Remaining Duration is Distributed 
to the Max. Duration for Each Cycle [µs] of 
UP 2 and UP 3 (Medium Priority y) (Arrows). 
 UP 2 Max. Duration for Each Cycle [µs] + 
Proportional Remaining Duration of UP 1 
have Expired, UP 3 Resumes. 
 UP 3 Max. Duration for Each Cycle [µs] + 
Proportional Remaining Duration of UP 1 
have Expired, UP 4 Starts. 
  The UP 4 Max. Duration for Each Cycle [µs] 
has Expired, Completion of the Second CPU 
Cycle. 
  The next User Program Cycle of UP 1 Starts. 
  The UP 1 Max. Duration for Each Cycle [µs] 
has Expired, UP 2 Resumes. 
  Completion of UP 2 Max. Duration for Each 
Cycle [µs], UP 3 Resumes. 
  Completion of the UP 3 Cycle, UP 4 Re-
sumes. The Remaining Duration is Added to 
UP 4 (Highest Priority z). 
 UP 3 Max. Duration for Each Cycle [µs] + 
Remaining Duration of UP 3 have Expired, 
Completion of the Third CPU Cycle. 
Figure 14:  Multitasking Mode 2