A method, device and computer readable storage medium for task scheduling

Through the task scheduling method, the Modbus protocol and greedy algorithm are used to prioritize high-priority tasks, solving the problem of inefficiency of equipment in the existing technology and achieving efficient data collection and transmission.

CN113806053BActive Publication Date: 2024-11-15PIPECHINA SOUTH CHINA CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111124079.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-24
Publication Date
2024-11-15
Estimated Expiration
2041-09-24

AI Technical Summary

Technical Problem

When the existing communication system connects multiple devices, reading data through polling results in inefficient equipment and unable to effectively handle large amounts of data acquisition and transmission.

Method used

Using the task scheduling method, by obtaining task and task information, including priority and Modbus communication information parameters, the task is added to the corresponding task queue, and sending tasks to the device through the Modbus protocol, using greedy algorithms to prioritize high-priority tasks, and Reassign and delete tasks when an error occurs, avoiding polling and accessing sequentially.

Benefits of technology

It improves the work efficiency and user experience of the equipment, ensures priority processing of high-priority tasks, reduces the time for data collection and transmission, and avoids equipment misprocessing and blockage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113806053B_ABST
    Figure CN113806053B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, and computer-readable storage medium for scheduling tasks, and relates to the field of communication technology. By acquiring tasks and task information, wherein the task information at least includes the priority of the task and Modbus communication information parameters, the task is added to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameters, and the tasks in each task queue are respectively sent to the device corresponding to the task through the Modbus protocol. It can be seen that this method can process multiple tasks at the same time, effectively avoiding the sequential access to each task by the polling method, improving the working efficiency of the device and the user's experience, and at the same time, this method preferentially assigns the task whose task information includes the task with high priority and Modbus communication information parameters to the device that can process this task, and can give priority to the task with high priority.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a task scheduling method, device, and computer-readable storage medium. Background Art

[0002] The Modbus protocol (Modbus is an OSI model application layer protocol) is usually used in the communication application layer of general equipment. It is simple, efficient, user-friendly, and reliable. Modbus can be used not only on the local area network, but also on the wide area network and the Internet. It does not use dedicated hardware, but all uses standard Ethernet hardware, so it has been widely used. With the development of factory intelligence, the scale of factory access equipment and instruments continues to increase, and the data acquisition system needs to access more and more equipment, which requires us to collect and read more and more data. At present, when various communication systems connect multiple instruments or control devices, the general solution is to add these devices and instruments to the connection queue, and then traverse and poll each device in turn to access and read data from the device.

[0003] Since data is currently written or read in a polling manner, the next data is processed after one data is processed, resulting in low device efficiency.

[0004] In view of the above technology, finding a method for quickly processing data is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0005] The purpose of this application is to provide a method, device, and computer-readable storage medium for task scheduling.

[0006] In order to solve the above technical problems, the present application provides a task scheduling method, including:

[0007] Acquire a task and task information, wherein the task information at least includes a priority of the task and Modbus communication information parameters;

[0008] Adding the task to a task queue corresponding to the device according to the priority of the task and the Modbus communication information parameter;

[0009] The tasks in each of the task queues are sent to the devices corresponding to the tasks respectively through the Modbus protocol.

[0010] Preferably, after obtaining the task and task information, the method further includes:

[0011] Put the task in the main task queue.

[0012] Preferably, the task information also includes a collection time of the task, and the collection time is a time interval between the start and completion of collection of the task.

[0013] Preferably, the priority of the task is negatively correlated with the collection time of the task.

[0014] Preferably, adding the task to a task queue corresponding to the device according to the priority of the task and the Modbus communication information parameter comprises:

[0015] The tasks with high priority in the main task queue are assigned to the task queue through a greedy algorithm.

[0016] Preferably, after sending the tasks in each of the task queues to the devices corresponding to the tasks respectively through the Modbus protocol, the method further includes:

[0017] Determine whether the task is sent incorrectly;

[0018] If so, the sending error task is sent to the main task queue for reallocation.

[0019] Preferably, after sending the sending error task to the main task queue for reallocation, the method further includes:

[0020] Determine whether the number of times the reallocated task is allocated is greater than a threshold;

[0021] If so, delete the task.

[0022] In order to solve the above technical problems, the present application also provides a task scheduling device, including:

[0023] An acquisition module, used for acquiring tasks and task information, wherein the task information at least includes the priority of the task and Modbus communication information parameters;

[0024] An adding module, used for adding the task to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameter;

[0025] The sending module is used to send the tasks in each of the task queues to the devices corresponding to the tasks through the Modbus protocol.

[0026] In order to solve the above technical problems, the present application also provides a task scheduling device, including:

[0027] Memory for storing computer programs;

[0028] A processor is used to implement the steps of the above-mentioned task scheduling method when executing the computer program.

[0029] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the task scheduling method described above are implemented.

[0030] The present application provides a method for scheduling tasks, by acquiring tasks and task information, wherein the task information at least includes the priority of the task and Modbus communication information parameters, adding the task to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameters, and sending the tasks in each task queue to the device corresponding to the task through the Modbus protocol. It can be seen that this method can process multiple tasks at the same time, effectively avoiding the sequential access to each task by the polling method, improving the working efficiency of the device and the user's experience, and at the same time, this method preferentially assigns the task whose task information includes the task with high priority and Modbus communication information parameters to the device that can process this task, and can give priority to the task with high priority.

[0031] On this basis, the present application also provides a task scheduling device and a computer-readable storage medium, with the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 A flowchart of a task scheduling method provided in an embodiment of the present application;

[0034] Figure 2 A flowchart of another task scheduling method provided in an embodiment of the present application;

[0035] Figure 3 A structural diagram of a task scheduling device provided in an embodiment of the present application;

[0036] Figure 4 A structural diagram of a task scheduling device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0038] The core of this application is to provide a task scheduling method, device, and computer-readable storage medium.

[0039] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0040] Figure 1 A flowchart of a task scheduling method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the task scheduling method includes:

[0041] S10: Acquire the task and task information, wherein the task information at least includes the priority of the task and Modbus communication information parameters.

[0042] S11: adding the task to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameters.

[0043] S12: Send the tasks in each task queue to the devices corresponding to the tasks through the Modbus protocol.

[0044] It is understandable that with the development of factory intelligence, the scale of factory access equipment and instruments is also increasing, and the data acquisition system needs to access more and more equipment, which requires us to collect and read data on a larger scale. Some important data may need to be collected urgently, which requires us not to use the same processing method for all data, so we need to schedule tasks reasonably. For step S10, to obtain tasks and task information, it should be noted that there is no limitation on task information, but the task information must at least include the priority of the task and the Modbus communication information parameters. The priority determines whether the device will give priority to the task after receiving it, and the Modbus communication information parameters are the standard for which task queue the task will be assigned to.

[0045] In addition, there is no limitation on how to define the priority of a task, which can be the length of the acquisition time of the task, for example, the longer or shorter the acquisition time of the task, the higher or lower the priority of this task, and the priority can also be the size of the task, the larger or smaller the task, the higher or lower the priority of this task, and the present embodiment does not limit how to define the priority of a task, as long as it can make this task be processed preferentially when this condition is met. In addition, in step S11, the task is added to the task queue corresponding to the device by the Modbus communication information parameter, and it can be understood that Modbus is a standard for assigning tasks to which task queue, for example, the standard for task queue 1 to receive tasks is condition A, B or C, and if this task meets any one of the three, this task will be assigned to task queue 1, and it is worth noting that if this task meets the conditions of two or more queues at the same time, it is OK to assign this task to any one, and on this basis, there is no limitation on Modbus communication information, and it is only necessary to enable the task to be accurately assigned to the corresponding task queue.

[0046] For the tasks in each task queue mentioned in step S12, the Modbus protocol is used to send the tasks in each task queue to the devices corresponding to the tasks. It is understandable that after the tasks are assigned to the corresponding task queues, the tasks in the task queues also need to be sent to the devices corresponding to the task queues. In addition, the devices mentioned in step S12 refer to the devices for collecting or reading data, and the number of devices is not limited. In addition, the devices and task queues correspond one to one, that is to say, the current system will have several task queues when connected to several devices, and the task queues corresponding to the devices can only transmit the tasks that this device can handle.

[0047] It can be seen that the method for scheduling tasks provided in this embodiment obtains tasks and task information, wherein the task information at least includes the priority of the task and the Modbus communication information parameters, adds the task to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameters, and sends the tasks in each task queue to the device corresponding to the task through the Modbus protocol. It can be seen that this method can process multiple tasks at the same time, effectively avoiding the sequential access to each task by the polling method, improving the working efficiency of the device and the user's experience, and at the same time, this method preferentially assigns tasks whose task information contains tasks with high task priority and Modbus communication information parameters to the device that can process this task, and can give priority to tasks with high priority.

[0048] In a specific embodiment, by obtaining the user's tasks and task information, and then adding the tasks to the task queue corresponding to the device according to the task information, this method may cause a new task to appear after the task has just been classified, and further classification is required, resulting in low efficiency. Considering this situation, a new step is added on the basis of the original steps: Figure 2 A flowchart of another task scheduling method provided by an embodiment of the present application, such as Figure 2 As shown, in addition to steps S10, S11, and S12, a step S13 is also included after S10.

[0049] S13: Put the task into the main task queue.

[0050] In the specific implementation, after receiving the user task and task information, the task is added to the corresponding queue. It is easy to cause new tasks to appear after the task has just been classified, and it is necessary to continue to classify. Therefore, after obtaining the user task and task information, the received task is placed in the main queue. It can be understood that placing the task in the main queue improves the execution of the program and avoids the program from being blocked by reading each task. After being placed in the main queue, the tasks are classified according to the task information, which reduces the pressure on the system and improves work efficiency.

[0051] It is worth noting that the number of task queues is consistent with the number of devices, but the number of main task queues is one, that is, the tasks are counted into one queue and then assigned.

[0052] It can be seen that the method provided in this embodiment of placing tasks into the main task queue after acquiring tasks and task information effectively improves the working efficiency of the system and enables the system to classify user tasks more quickly.

[0053] Based on the above embodiment, the task information includes not only the priority of the task and the Modbus communication information parameters, but also the collection time of the task. It is understandable that the task information can include a lot of information, such as the priority of the task, the Modbus communication information parameters, the collection time of the task, etc., but at least includes the priority of the task and the Modbus communication information parameters.

[0054] It is explained that the collection time of a task refers to the time when the device collects data for this task. Specifically, if the start collection time of task A is T1 and the end collection time is T2, then the collection time of task A is the value of T2 minus T1. In addition, the collection time of the task can be set by the user. The user can set the collection time of the task according to the actual situation of the task. When the task is more complicated, a longer time can be set for processing.

[0055] It can be seen that the task information provided in this embodiment includes the collection time of the task, which can better process the task and set the collection time of the task according to the complexity of the task, effectively improving the working efficiency of the device and improving the user experience.

[0056] Based on the above embodiments, the priority of the task is defined. In the specific implementation, the priority is the standard for whether the device will give priority to the task. How to define the priority is also very important. The priority can be defined by the collection time of the task. Specifically, the shorter the collection time of the task, the higher the priority of the task execution. The user can set the collection time of the task to set it as the priority of the task. When there is an urgent task to be processed, the collection time of the task can be shortened. In this way, the higher the priority of the task, the higher the priority of the task can be.

[0057] It is worth noting that setting the length of the task collection time as the priority of the task is only a preferred embodiment, which can be set according to actual conditions. Other methods for defining the priority of the task will not be described in detail in this embodiment.

[0058] It can be seen that the method for defining priority provided in this embodiment derives the priority of executing the task by the length of the task collection time. The device can determine whether to give priority to the task based on the priority of the task, effectively avoiding the problem that tasks that need to be processed urgently cannot be processed immediately, effectively improving the work efficiency of the device and improving the user experience.

[0059] In a specific embodiment, adding a task to a queue corresponding to a device specifically involves assigning a high-priority task in a main task queue to a task queue through a greedy algorithm. The so-called greedy algorithm is a simpler and faster design technique for some optimal solution problems. The characteristic of the greedy algorithm is that it proceeds step by step, often based on the current situation and making the best choice according to a certain optimization measure, without considering various possible overall situations, saving a lot of time that must be spent to exhaust all possibilities to find the optimal solution. The greedy algorithm uses a top-down, iterative method to make successive greedy choices. Each time a greedy choice is made, the problem to be solved is simplified into a smaller sub-problem. Through each step of greedy selection, an optimal solution to the problem can be obtained. Although it is necessary to ensure that a local optimal solution can be obtained at each step, the resulting global solution is sometimes not necessarily the best, so the greedy algorithm does not backtrack. However, there are also some problems with the greedy algorithm. It cannot guarantee that the current solution is the best, because it starts from the local and does not consider it comprehensively, and the greedy algorithm can only determine the feasibility range of certain problems.

[0060] In this embodiment, the greedy algorithm is specifically to obtain the tasks with the shortest time in the main task queue, that is, the tasks with high priority. After obtaining these tasks, it is determined whether the number of tasks obtained is greater than the number of tasks that the device can process. If so, the tasks are assigned to the task queue, and the excess tasks are returned to the main task queue to wait for re-acquisition. If not, the step of returning to the step of obtaining the tasks with the shortest time in the main task queue.

[0061] In addition, the task collection time set by the user must be shorter than the normal task collection time. It is understandable that the tasks that the user wants to process urgently will be read by the greedy algorithm before the normal tasks. In addition, the greedy algorithm ensures that the number of tasks assigned to the main task team each time is the same as the number that the device can handle, effectively ensuring the utilization rate of the device.

[0062] It is worth noting that when the user does not have a task that he or she is eager to process, that is, when the task priority is not set, the greedy algorithm still runs. Each task has its own collection time, and the greedy algorithm can allocate tasks according to the collection time of the task.

[0063] The present embodiment provides a method of allocating tasks in the main task queue to the task queue through a greedy algorithm. This method can obtain the best current choice through a greedy algorithm, and can allocate tasks to users more quickly without missing any tasks, thereby improving the working efficiency of the device and the system and improving the user experience.

[0064] In a specific embodiment, it is possible that a task is assigned to an incorrect device, causing the device to be unable to process the task. Considering this situation, a step is added after the step of sending the task from the task queue to the device corresponding to the task, such as Figure 2 As shown, after step S12, the following steps are also included:

[0065] S14: Determine whether the task is sent incorrectly, if so, proceed to step S15.

[0066] S15: Send the task with the sending error to the main task queue for reallocation.

[0067] It is understandable that after sending a task from a task queue to a device corresponding to the task, the current task may be sent to an inappropriate device, so it is necessary to detect whether the current task is sent incorrectly.

[0068] For step S15, the task with the wrong sending is sent to the main task queue for reallocation. It is worth noting that the task with the wrong sending here may be that the communication information of this task conforms to the current device but cannot be processed by the current device, or the task may be sent to the current device by mistake when allocating tasks.

[0069] It can be seen that the present embodiment provides that, after sending the task to the corresponding device, it is determined whether the sent task is an error. If an error occurs, the task is sent to the main task queue for reallocation. This method effectively avoids the situation where the device mishandles or cannot process the task, thereby improving the working efficiency of the device and the user experience.

[0070] Based on the above embodiment, the erroneous task is sent to the main task queue for reallocation. It is possible that the task is always erroneous and is always allocated. Considering this situation, a new step is added based on step S15, such as Figure 2 As shown, in addition to S13, S14, S15, it also includes:

[0071] S16: Determine whether the number of times the reallocated task is allocated is greater than a threshold, if so, proceed to step S17.

[0072] S17: Delete the task.

[0073] It is understandable that a task sent in error may always be in error. To avoid this, based on the original steps, it is determined whether the number of allocations of the reallocated task is greater than a threshold. If so, the task is deleted.

[0074] It is worth noting that the reallocated tasks are judged instead of all the tasks. In addition, the threshold is not limited and can be 2 or 3. It only needs to be deleted when the task cannot be processed by all current devices.

[0075] It can be seen that the present embodiment provides that after sending the erroneous task to the main task queue for reallocation, the number of allocations of the task is judged. If the number of allocations is greater than the threshold, it means that the task cannot be processed by the current device, and the task is deleted. This method effectively avoids the situation where the erroneous task occupies the main task queue, thereby improving the working efficiency of the device and the system.

[0076] In the above embodiments, the method for task scheduling is described in detail, and the present application also provides an embodiment corresponding to the device for task scheduling. It should be noted that the present application describes the embodiments of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware.

[0077] The above describes in detail various embodiments corresponding to the method for task scheduling. On this basis, the present application also discloses a task scheduling device corresponding to the above method. Figure 3 This is a structural diagram of a task scheduling device provided in an embodiment of the present application. Figure 3 As shown, the task scheduling device includes:

[0078] An acquisition module 10 is used to acquire tasks and task information, wherein the task information at least includes the priority of the task and Modbus communication information parameters;

[0079] An adding module 11 is used to add the task to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameter;

[0080] The sending module 12 is used to send the tasks in each task queue to the devices corresponding to the tasks through the Modbus protocol.

[0081] Figure 4 A structural diagram of task scheduling provided in another embodiment of the present application, such as Figure 4 As shown, the task scheduling device includes: a memory 20 for storing a computer program;

[0082] The processor 21 is used to implement the steps of the task scheduling method mentioned in the above embodiment when executing a computer program.

[0083] The task scheduling device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.

[0084] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0085] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, the relevant steps of the task scheduling method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, data of the task scheduling method, etc.

[0086] In some embodiments, the task scheduling device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0087] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the device for task scheduling, and may include more or fewer components than those shown in the figure.

[0088] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps recorded in the above method embodiment (are implemented.

[0089] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0090] The above is a detailed introduction to the task scheduling method provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can refer to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

[0091] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

Claims

1. A task scheduling method, characterized in that: include: Acquire a task and task information, wherein the task information at least includes a priority of the task and Modbus communication information parameters; Adding the task to a task queue corresponding to the device according to the priority of the task and the Modbus communication information parameter; Sending the tasks in each of the task queues to the devices corresponding to the tasks respectively through the Modbus protocol; After obtaining the task and task information, the method further includes: Put the task into the main task queue; The adding the task to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameter comprises: The high-priority tasks in the main task queue are assigned to the task queue by a greedy algorithm; wherein, the high-priority tasks in the main task queue are assigned to the task queue by a greedy algorithm, including: obtaining the high-priority tasks in the main task queue, determining whether the number of tasks obtained is greater than the number of tasks that can be processed by the set device, and if so, assigning the tasks to the task queue, and returning the excess tasks to the main task queue to wait for re-acquisition, and if not, returning to the step of obtaining the high-priority tasks in the main task queue.

2. The task scheduling method according to claim 1, characterized in that: The task information also includes the collection time of the task, where the collection time is the time interval between the start and completion of the collection of the task.

3. The task scheduling method according to claim 2, characterized in that: The priority of the task is negatively correlated with the acquisition time of the task.

4. The task scheduling method according to claim 2 or 3, characterized in that: After sending the tasks in each of the task queues to the devices corresponding to the tasks respectively through the Modbus protocol, the method further includes: Determine whether the task is sent incorrectly; If so, the sending error task is sent to the main task queue for reallocation.

5. The method for task scheduling according to claim 4, characterized in that: After sending the sending error task to the main task queue for reallocation, the method further includes: Determine whether the number of times the reallocated task is allocated is greater than a threshold; If so, delete the task.

6. A task scheduling device, characterized in that: include: An acquisition module, used for acquiring tasks and task information, wherein the task information at least includes the priority of the task and Modbus communication information parameters; An adding module, used for adding the task to the task queue corresponding to the device according to the priority of the task and the Modbus communication information parameter; A sending module, used for sending the tasks in each of the task queues to the devices corresponding to the tasks respectively through the Modbus protocol; The device is used to put the task into the main task queue; The adding module is used to allocate high-priority tasks in the main task queue to the task queue through a greedy algorithm; wherein, allocating high-priority tasks in the main task queue to the task queue through a greedy algorithm includes: obtaining high-priority tasks in the main task queue, determining whether the number of acquired tasks is greater than the number of tasks that can be processed by the set device, and if so, allocating the tasks to the task queue, and returning excess tasks to the main task queue to wait for re-acquisition, and if not, returning to the step of obtaining high-priority tasks in the main task queue.

7. A task scheduling device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the task scheduling method as described in any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the task scheduling method according to any one of claims 1 to 5 are implemented.