An industrial data-oriented task scheduling optimization method
Patent Information
- Application Number
- CN202210825304.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-13
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2042-07-13
AI Technical Summary
[0021]与现有技术相比,本发明具有如下特点:
Smart Images

Figure CN115222121B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of technology, and more specifically to a task scheduling optimization method for industrial data. Background Technology
[0002] As the core of monitoring industrial production lines, the host computer system needs to flexibly schedule industrial control commands and tasks in real time to meet the low latency and high reliability requirements of industrial control. Industrial tasks can be divided into non-periodic non-real-time tasks, periodic real-time tasks, and non-periodic real-time tasks. Non-periodic non-real-time tasks include tasks that need to be executed during production but are not in real time, such as the storage of on-site monitoring videos, and have the lowest priority. Periodic real-time tasks include tasks that are executed on-site according to a set cycle, such as periodic storage tasks and periodic acquisition tasks. Non-periodic real-time tasks include alarm tasks when equipment faults, errors, warnings, etc. occur, and have the highest priority. In a typical industrial environment, non-periodic real-time tasks can be further subdivided into fault handling tasks, warning handling tasks, and error handling tasks, with priority decreasing from high to low. In summary, industrial tasks can generally be divided into five priorities: Level 1 fault handling tasks, which may directly lead to system crashes and are extremely important, with very high priority; Level 2 warning handling tasks; Level 3 error handling tasks; Level 4 periodic real-time tasks; and Level 5 non-periodic non-real-time tasks. How to optimize scheduling to meet the requirements of low latency and high reliability under multiple priority industrial real-time task requests from the host computer system is the research focus of industrial task scheduling for industrial data.
[0003] For online scheduling applications, there are two main solutions: optimization-based and sorting-based. Optimization-based solutions model the scheduling problem as an optimization problem to search for the optimal solution for executing tasks. However, due to high computational cost and long scheduling decision-making time, they are only suitable for non-real-time scheduling scenarios and not for real-time scheduling. Sorting-based solutions schedule tasks according to their priorities, requiring only the calculation and sorting of the priorities of all tasks, making them more suitable for real-time scheduling scenarios. Commonly used methods in sorting-based solutions include First-Come, First-Served (FCFS), Fixed Priority (FPS), and Lowest Relaxation (LLF). FCFS schedules tasks according to the order in which they enter the system, which is beneficial for long tasks but detrimental to short tasks, because if a long task arrives first, many short tasks will wait for a long time. Fixed Priority (FPS) is mainly used to schedule tasks with inherent priorities or user-defined priorities. It only considers task priority, but this can lead to high-priority tasks with long scheduling times continuously occupying resources, while low-priority tasks experience starvation and cannot be scheduled. The minimum relaxation algorithm determines priority by calculating relaxation time, but when the relaxation values of multiple tasks are close, it will cause frequent switching and selection jitter between tasks, which will increase the system overhead. At the same time, as the current time changes, the task relaxation also needs to be recalculated, which increases the system overhead. Summary of the Invention
[0004] The present invention addresses the problems of existing sorting-based real-time task scheduling algorithms and provides a task scheduling optimization method for industrial data.
[0005] To solve the above problems, the present invention is achieved through the following technical solution:
[0006] A task scheduling optimization method for industrial data includes the following steps:
[0007] Step 1: Determine if any new industrial tasks arrive during the execution of existing industrial tasks. If yes, proceed to Step 2; otherwise, proceed to Step 5.
[0008] Step 2: According to the inherent priority of the industrial task, it is assigned to the corresponding priority ready queue. Among them, the fault handling industrial task is assigned to the current emergency priority ready queue, and the warning handling industrial task, error handling industrial task, periodic real-time industrial task and non-periodic non-real-time industrial task is assigned to the current normal priority ready queue.
[0009] Step 3: Calculate the urgency value of each industrial task in the current urgent priority ready queue and the current normal priority ready queue;
[0010] Step 4: Based on the urgency value of the industrial tasks, sort the industrial tasks in the current urgent priority ready queue and the current normal priority ready queue from largest to smallest to obtain the current sorted urgent priority ready queue and the current sorted normal priority ready queue.
[0011] Step 5: Determine if the number of currently executed industrial tasks is less than the number of enqueued industrial tasks: if it is less, proceed to step 6; if it is equal, the industrial task scheduling ends.
[0012] Step 6: Determine if the current urgent priority ready queue is empty: If not empty, proceed to step 7; if empty, proceed to step 9.
[0013] Step 7: Take the head task of the current urgent priority ready queue as the current industrial task, and determine whether the deadline of the current industrial task is less than the sum of the current time and the time required to complete the current industrial task: if so, go to step 8; otherwise, discard the current industrial task and remove it from the current urgent priority ready queue.
[0014] Step 8: Determine if the remaining system resources are greater than the resources required by the current industrial task. If yes, use the remaining resources to process the current industrial task. After the current industrial task is completed, remove it from the current sorted urgent priority ready queue and return to step 1. If no, retain the context of the current industrial task and preempt the resources of the currently executing industrial task. After the current industrial task is completed, remove it from the current sorted urgent priority ready queue and return to step 1.
[0015] Step 9: Take the head task of the current sorted normal priority ready queue as the current industrial task, and determine whether the deadline of the current industrial task is less than the sum of the current time and the time required to complete the current industrial task: if so, go to step 10; otherwise, discard the current industrial task and delete it from the current sorted normal priority ready queue.
[0016] Step 10: Determine if the remaining resources of the current system are greater than the resources required by the current industrial task. If yes, use the reserved resource mechanism to process the current industrial task. After the current industrial task is processed, remove it from the current urgent priority ready queue and return to step 1. If no, the current industrial task needs to continue waiting in the queue and return directly to step 1.
[0017] In the above scheme, industrial task x i Emergency value UV(x) i )for:
[0018]
[0019] In the formula, DT(x)i ) for industrial task x i The deadline; I(x) i ) for industrial task x i The inherent priority; i = 1, 2, ...
[0020] In step 10 above, the reserved resources follow a Poisson distribution.
[0021] Compared with the prior art, the present invention has the following characteristics:
[0022] 1. To address the issue that existing real-time scheduling algorithms require periodically checking whether there are urgent tasks in the task pool, which can lead to a large number of tasks and time-consuming checks, this invention considers the impact, randomness, and time-varying nature of fault tasks in industrial real-time scenarios compared to ordinary tasks. It adopts a two-level queue for tasks in industrial real-time scenarios, placing fault-handling industrial tasks into an urgent priority ready queue and other industrial tasks into an ordinary priority ready queue. This way, during task execution, only the head tasks of the two priority ready queues need to be checked, thereby shortening the loop check time and improving the real-time performance of task processing.
[0023] 2. Considering that when there are more than one task in the task queue, computing resources may not be sufficient to allocate and tasks need to be queued, this invention uses an urgent value (UV) to sort the tasks in the two task queues respectively. The urgent value combines the inherent priority and deadline characteristics of the task, and the task with the higher urgent value is placed at the front of the queue and executed first.
[0024] 3. When resources are sufficient: For urgent tasks awaiting processing, the remaining resources are used directly to handle the current task; for ordinary tasks awaiting processing, a resource reservation mechanism is used to reserve some resources as backup resources for when urgent tasks occur. When resources are insufficient: For urgent tasks awaiting processing, resources from the currently executing task are preempted to execute the urgent task; for ordinary tasks awaiting processing, resources are reserved for backup resources when subsequent urgent tasks occur. On the one hand, the resource reservation mechanism can ensure the completion rate of ordinary queue tasks. On the other hand, the reserved resources are used by tasks in the emergency queue. When an emergency task suddenly occurs, this not only ensures that emergency resources can be executed first, but also reduces the frequency of context switching. Finally, considering that the arrival time of sudden tasks can roughly follow a Poisson distribution, this invention sets the reserved resources to follow a Poisson distribution. This avoids the waste of reserved fixed resources that are not used for a long time, and also avoids the situation where reserved resources are always insufficient when there are more sudden tasks. Attached Figure Description
[0025] Figure 1 This is a flowchart of a task scheduling optimization method for industrial data. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific examples.
[0027] See Figure 1 A task scheduling optimization method for industrial data includes the following steps:
[0028] Step 1: Determine if any new industrial tasks arrive during the execution of the industrial task. If yes, proceed to Step 2; otherwise, proceed to Step 5.
[0029] Step 2: According to the inherent priority of the industrial task, it is assigned to the corresponding priority ready queue. Among them, the fault handling industrial task is assigned to the current emergency priority ready queue Q1, and the warning handling industrial task, error handling industrial task, periodic real-time industrial task and non-periodic non-real-time industrial task is assigned to the current normal priority ready queue Q2. The priority of the current emergency priority ready queue Q1 is higher than the priority of the current normal priority ready queue Q2.
[0030] Step 3: Calculate the urgency value of each industrial task in the current urgent priority ready queue and the current normal priority ready queue; the formula for calculating the urgency value is:
[0031]
[0032] In the formula, UV(x) i ) for industrial task x i The urgent value; DT(x) i ) for industrial task x i The deadline, with a value greater than 0; I(x) i ) for industrial task x i The inherent priority of i is not 0; where i = 1, 2, ...
[0033] Step 4: Based on the urgency value of the industrial tasks, sort the industrial tasks in the current urgent priority ready queue and the current normal priority ready queue from largest to smallest to obtain the current sorted urgent priority ready queue and the current sorted normal priority ready queue.
[0034] Step 5: Determine if the number of currently executed industrial tasks is less than the number of enqueued industrial tasks: if it is less, proceed to step 6; if it is equal, the industrial task scheduling ends.
[0035] Step 6: Determine if the current urgent priority ready queue is empty: If not empty, proceed to step 7; if empty, proceed to step 9.
[0036] Step 7: Take the head task of the current urgent priority ready queue as the current industrial task, and determine whether the deadline of the current industrial task is less than the sum of the current time and the time required to complete the current industrial task: if so, go to step 8; otherwise, discard the current industrial task and remove it from the current urgent priority ready queue.
[0037] Step 8: Determine if the remaining system resources are greater than the resources required by the current industrial task. If yes, use the remaining resources to process the current industrial task. After the current industrial task is completed, remove it from the current sorted urgent priority ready queue and return to step 1. If no, retain the context of the current industrial task and preempt the resources of the currently executing industrial task. After the current industrial task is completed, remove it from the current sorted urgent priority ready queue and return to step 1.
[0038] In situations where resources are insufficient, urgent tasks employ a preemptive mechanism. This means that if a higher-priority task arrives during the execution of the currently executing task, the higher-priority task will preempt the resources of the currently executing task. The advantages of preemption are good real-time performance, fast response, and the ability to prioritize the time constraints of high-priority tasks.
[0039] Step 9: Take the head task of the current sorted normal priority ready queue as the current industrial task, and determine whether the deadline of the current industrial task is less than the sum of the current time and the time required to complete the current industrial task: if so, go to step 10; otherwise, discard the current industrial task and delete it from the current sorted normal priority ready queue.
[0040] Step 10: Determine if the remaining resources of the current system are greater than the resources required by the current industrial task. If yes, use the reserved resource mechanism to process the current industrial task. After the current industrial task is processed, remove it from the current urgent priority ready queue and return to step 1. If no, the current industrial task needs to continue waiting in the queue and return directly to step 1.
[0041] Because resource reservation offers advantages such as low network latency, high link utilization, and suitability for transmitting bursty services, this invention employs a resource reservation mechanism to reserve certain resources for emergency tasks when scheduling ordinary tasks, thereby reducing the context switching overhead of faulty tasks preempting ordinary tasks. In a preferred embodiment of this invention, considering the random burst nature of emergency tasks, the Poisson distribution in discrete probability distributions is suitable for describing the number of random events occurring per unit time. The probability function P(X=k) of the Poisson distribution is:
[0042]
[0043] Where λ is the average number of emergency tasks occurring per unit time, and k is the number of emergency tasks occurring within the system's operating time range.
[0044] Therefore, the resource reservation mechanism used in this invention is to reserve resources that follow a Poisson distribution as the unit time changes, wherein the parameter λ in the Poisson distribution probability function needs to be provided by factory record data or experts.
[0045] Because existing optimization-based scheduling algorithms are computationally intensive and time-consuming in decision-making, they are unsuitable for real-time industrial scenarios. Therefore, this invention references fixed-priority algorithms and uses hierarchical queues for industrial tasks with different priorities, taking into account the characteristics of industrial tasks: Characteristic ①: Level 1 industrial tasks must be processed promptly to prevent the entire industrial system from crashing. Therefore, queue Q1 is set up to store Level 1 industrial tasks and is eligible to execute preemptive algorithms. Level 2 to 5 industrial tasks are stored in queue Q2. Characteristic ②: Non-periodic real-time industrial tasks (Level 2 and 3 industrial tasks) often have earlier deadlines; periodic real-time industrial tasks (Level 4 industrial tasks) have deadlines that increase with the current time; non-periodic non-real-time industrial tasks (Level 5 industrial tasks) have deadlines that can be infinite. Therefore, an urgency value calculation formula is set up, which is inversely proportional to the inherent priority of the industrial task and inversely proportional to the deadline of the industrial task. Further sorting based on urgency value is performed on this hierarchical queue, combining fixed-priority algorithms, preemptive scheduling algorithms, and resource reservation scheduling algorithms to overcome the shortcomings of each algorithm.
[0046] It should be noted that although the embodiments described above are illustrative, they are not intended to limit the invention. Therefore, the invention is not limited to the specific embodiments described above. Any other embodiments obtained by those skilled in the art under the guidance of this invention without departing from its principles are considered to be within the protection scope of this invention.
Claims
1. A task scheduling optimization method for industrial data, characterized in that, The steps include the following: Step 1: Determine if any new industrial tasks arrive during the execution of existing industrial tasks. If yes, proceed to Step 2; otherwise, proceed to Step 5. Step 2: According to the inherent priority of the industrial task, it is assigned to the corresponding priority ready queue. Among them, the fault handling industrial task is assigned to the current emergency priority ready queue, and the warning handling industrial task, error handling industrial task, periodic real-time industrial task and non-periodic non-real-time industrial task is assigned to the current normal priority ready queue. Step 3: Calculate the urgency value of each industrial task in the current urgent priority ready queue and the current normal priority ready queue; Industrial Tasks emergency value for: , In the formula, For industrial tasks The deadline; For industrial tasks The inherent priority; ; Step 4: Based on the urgency value of the industrial tasks, sort the industrial tasks in the current urgent priority ready queue and the current normal priority ready queue from largest to smallest to obtain the current sorted urgent priority ready queue and the current sorted normal priority ready queue. Step 5: Determine if the number of currently executed industrial tasks is less than the number of enqueued industrial tasks: if it is less, proceed to step 6; if it is equal, the industrial task scheduling ends. Step 6: Determine if the current urgent priority ready queue is empty: If not empty, proceed to step 7; if empty, proceed to step 9. Step 7: Take the head task of the current urgent priority ready queue as the current industrial task, and determine whether the deadline of the current industrial task is less than the sum of the current time and the time required to complete the current industrial task: if so, go to step 8; otherwise, discard the current industrial task and remove it from the current urgent priority ready queue. Step 8: Determine if the remaining system resources are greater than the resources required by the current industrial task. If yes, use the remaining resources to process the current industrial task. After the current industrial task is completed, remove it from the current sorted urgent priority ready queue and return to step 1. If no, retain the context of the current industrial task and preempt the resources of the currently executing industrial task. After the current industrial task is completed, remove it from the current sorted urgent priority ready queue and return to step 1. Step 9: Take the head task of the current sorted normal priority ready queue as the current industrial task, and determine whether the deadline of the current industrial task is less than the sum of the current time and the time required to complete the current industrial task: if so, go to step 10; otherwise, discard the current industrial task and delete it from the current sorted normal priority ready queue. Step 10: Determine whether the remaining resources of the current system are greater than the resources required by the current industrial task. If yes, use the reserved resource mechanism to process the current industrial task. After the current industrial task is processed, remove it from the current sorted normal priority ready queue and return to step 1. If not, the current industrial task needs to continue to wait in the queue and return directly to step 1.
2. The task scheduling optimization method for industrial data according to claim 1, characterized in that, In step 10, the reserved resources follow a Poisson distribution.
Citation Information
Patent Citations
Cloud resource queue hierarchical scheduling system and method for comprehensive management system of data center
CN108563495A
Container cloud-oriented task preemption scheduling method and system
CN111399989A