The invention relates to a multi-task scheduling method and
system based on
macro assembly. The method comprises the steps that when a task is executed to a scheduled step point, a task
scheduling system stores a subsequent step point of the task and loads
dormancy time, the task
scheduling system reads and judges an activated state and the
dormancy time of a subsequent task, if the activated state and the
dormancy time meet demands, the subsequent task is executed, and if any one of the activated state and the dormancy time can not meet the demands, the task
scheduling system continues to judge the subsequent task until the task is executed to a stop point and not scheduled by the task scheduling
system. According to the multi-task scheduling method and
system based on the
macro assembly, functions of the system are realized through the
macro assembly, task stacks are not used, all the tasks and the system share one stack, great memory requirements when a large number of parallel tasks exist in the system are avoided, and the risk that the system crashes due to the fact that potential task stacks overflow in the
actual use of RTOS is effectively avoided. The multi-task scheduling method based on the macro assembly is suitable for an industry
control system, especially suitable for being used in industry flow type control and well solves the problem that save and return of a control process are difficult when power fails suddenly.