Task execution method and device, storage medium and intelligent court terminal
By evaluating the load level of candidate application of smart station terminals and performing tasks according to task priorities, the problem of resource allocation imbalance is solved, load balancing and resource utilization optimization is achieved, and the system's responsiveness and reliability are improved.
Patent Information
- Application Number
- CN202510338355.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-07-08
AI Technical Summary
The existing task execution method is difficult to evaluate the resource consumption characteristics of each application when multiple applications are run simultaneously, resulting in an imbalance in resource allocation and affecting the operation efficiency of smart station terminals.
By obtaining the tasks to be executed from the task allocation table of the smart station terminal, determining the candidate applications, and calculating the load degree based on the minimum number of processing tasks, the maximum number of processing tasks and the number of tasks in execution, selecting the application with the lowest load as the target application, and executing tasks according to the task priority, avoiding resource allocation imbalance.
It realizes load balancing and resource utilization optimization, ensures timely completion of critical tasks, improves the system's responsiveness and reliability, eliminates blind call and waste of resources, and improves the overall operation efficiency of the terminal.
Smart Images

Figure CN120276841A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a task execution method, apparatus, storage medium, and intelligent substation area terminal. Background Art
[0002] With the development of smart grids, intelligent substation area terminals play an increasingly important role in the distribution network. This terminal needs to process a large amount of real-time data and execute various functions such as power quality monitoring, fault detection and location, and load management. To support these functions, more and more application programs are integrated into the intelligent substation area terminal to provide a convenient operation interface and enhanced function modules. Therefore, how to efficiently execute the tasks of these application programs is particularly crucial.
[0003] Currently, existing task execution methods usually rely on simple priority or first-come, first-served principles. This method may perform well when the number of application programs is small or resources are sufficient, but when multiple application programs are running simultaneously, existing methods are difficult to evaluate the resource consumption characteristics of each application program, resulting in unbalanced resource allocation and thus affecting the operation efficiency of the intelligent substation area terminal.
[0004] Therefore, there is an urgent need to propose a new method to solve the above problems. Summary of the Invention
[0005] The present invention provides a task execution method, apparatus, storage medium, and intelligent substation area terminal, which can better evaluate the load conditions of each application program, determine target execution tasks based on the load conditions of each application program, thereby avoiding unbalanced resource allocation and improving the operation efficiency of the intelligent substation area terminal.
[0006] In a first aspect, embodiments of the present invention provide a task execution method, which includes:
[0007] Obtain each to-be-executed task assigned to the target communication port of the intelligent substation area terminal from the task allocation table of the intelligent substation area terminal, and determine the application programs assigned to the to-be-executed tasks from the application programs installed in the intelligent substation area terminal to obtain each candidate application program;
[0008] Calculate the load level of each candidate application program according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program;
[0009] Determine the candidate application program with the lowest load level as the target application program, and determine the target task from the to-be-executed tasks of the target application program according to the priority of the to-be-executed tasks of the target application program;
[0010] Control the target application program to execute the target task through the target communication port.
[0011] For the technical solution of the present invention, first, obtain each to-be-executed task assigned to the target communication port of the intelligent substation area terminal from the task assignment table of the intelligent substation area terminal, and determine the application programs assigned to each to-be-executed task from the application programs installed on the intelligent substation area terminal, so as to obtain each candidate application program, which provides a data basis for determining and calculating the load levels of each candidate application program later. Then, calculate the load levels of each candidate application program according to the minimum processing task quantity, maximum processing task quantity, and number of tasks in execution of each candidate application program, which can better evaluate the resource consumption characteristics of each candidate application program and provides a data basis for determining the target application program later. After that, determine the candidate application program with the lowest load level as the target application program, and determine the target task from the to-be-executed tasks of the target application program according to the priorities of the to-be-executed tasks of the target application program, avoiding the problem of a single application program being overloaded and the resulting imbalance in terminal resource allocation, thereby improving the overall operation efficiency of the terminal and realizing the optimization of load balancing and resource utilization rate. At the same time, determining the target task from the to-be-executed tasks of the target application program according to the priorities ensures the timely completion of key tasks and further improves the responsiveness and reliability of the system. Finally, control the target application program to execute the target task through the target communication port, eliminating the phenomenon of blind resource invocation and waste, effectively avoiding the situation of resource idleness or over-occupation, significantly improving the resource utilization rate, and solving the problem in the prior art that it is difficult to evaluate the resource consumption characteristics of each application program, resulting in an imbalance in resource allocation and thus affecting the operation efficiency of the intelligent substation area terminal.
[0012] In a second aspect, an embodiment of the present invention further provides a task execution device, which includes:
[0013] An obtaining module, configured to obtain each to-be-executed task assigned to the target communication port of the intelligent substation area terminal from the task assignment table of the intelligent substation area terminal, and determine the application programs assigned to each to-be-executed task from the application programs installed on the intelligent substation area terminal, so as to obtain each candidate application program;
[0014] A calculating module, configured to calculate the load levels of each candidate application program according to the minimum processing task quantity, maximum processing task quantity, and number of tasks in execution of each candidate application program;
[0015] A determining module, configured to determine the candidate application program with the lowest load level as the target application program, and determine the target task from the to-be-executed tasks of the target application program according to the priorities of the to-be-executed tasks of the target application program;
[0016] An execution module, configured to control the target application program to execute the target task through the target communication port.
[0017] In a third aspect, an embodiment of the present invention further provides a storage medium containing computer-executable instructions, characterized in that the computer-executable instructions are used to execute any one of the task execution methods in the first aspect when executed by a computer processor.
[0018] In a fourth aspect, an embodiment of the present invention further provides an intelligent substation area terminal, characterized in that the intelligent substation area terminal includes:
[0019] At least one processor; and a memory communicatively connected to the at least one processor;
[0020] Wherein, the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute any one of the task execution methods in the first aspect.
[0021] It should be noted that the above computer instructions can be stored in whole or in part on a computer-readable storage medium. Among them, the computer-readable storage medium can be packaged together with the processor of the task execution device, or can be packaged separately from the processor of the task execution device. This application does not make any limitations in this regard.
[0022] For the descriptions of the second aspect, the third aspect, and the fourth aspect in this application, reference can be made to the detailed description of the first aspect; and for the beneficial effects of the descriptions of the second aspect, the third aspect, and the fourth aspect, reference can be made to the analysis of the beneficial effects of the first aspect, which will not be elaborated here.
[0023] In this application, the names of the above task execution devices do not constitute limitations on the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those of this application and fall within the scope of the claims of this application and their equivalent technologies.
[0024] These aspects or other aspects of this application will be more clearly understood in the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0026] Figure 1 It is a flowchart of a task execution method provided by an embodiment of the present invention;
[0027] Figure 2Flowchart of another task execution method provided by an embodiment of the present invention;
[0028] Figure 3 Structural schematic diagram of a task execution device provided by an embodiment of the present invention;
[0029] Figure 4 Structural schematic diagram of an intelligent substation area terminal provided by an embodiment of the present invention. Detailed implementation manners
[0030] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present invention, rather than limiting the present invention. Additionally, it should be noted that for the sake of description, only parts related to the present invention are shown in the drawings rather than all structures.
[0031] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone.
[0032] The terms "first" and "second" in the specification and drawings of this application are used to distinguish different objects or different processes for the same object, rather than to describe the specific order of the objects.
[0033] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally further include other unlisted steps or units, or may optionally further include other steps or units inherent to these processes, methods, products, or devices.
[0034] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operations are completed, but it may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc. In addition, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.
[0035] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific manner.
[0036] In the description of the present application, unless otherwise specified, the meaning of "a plurality of" refers to two or more.
[0037] Figure 1 FIG. is a flowchart of a task execution method provided for an embodiment of the present invention. This embodiment is applicable to the situation where an intelligent substation terminal avoids resource allocation imbalance when multiple application programs are running concurrently. This method can be executed by a task execution device, which can be implemented in a hardware / software manner. The device can be integrated into the intelligent substation terminal. As Figure 1 shown, the specific steps are as follows:
[0038] Step 110: Obtain each task to be executed assigned to the target communication port of the intelligent substation terminal from the task allocation table of the intelligent substation terminal, and determine the application programs assigned to each task to be executed from the application programs installed in the intelligent substation terminal, so as to obtain each candidate application program.
[0039] Specifically, the intelligent substation terminal refers to an intelligent device used for substation management in the power system, which can realize various functions such as data acquisition, transmission, processing and communication with other devices. It can install multiple application programs to execute different tasks and is the core carrier of the entire task execution process. The task allocation table refers to a data structure or database table used to store and manage the information of each task to be executed in the intelligent substation terminal, including the corresponding relationship between the task to be executed and the communication port and the corresponding relationship between the task to be executed and the application program. The target communication port refers to a specific port determined according to the actual situation or requirements in the intelligent substation terminal for executing the target task. The task to be executed refers to the task waiting to be executed in the intelligent substation terminal, which is generated by the application programs installed in the intelligent substation terminal. The application program refers to a software program installed on the intelligent substation terminal that can realize specific functions (such as data acquisition). The candidate application program refers to the program screened from all the application programs installed in the intelligent substation terminal according to the task to be executed.
[0040] In specific implementation, based on the port number of the target communication port, each task to be executed assigned to the target communication port can be filtered out from the task allocation table of the intelligent substation area terminal, and then based on the identity identification numbers of each task to be executed, the identity identification numbers of the matching application programs can be filtered out from the task allocation table. Finally, according to the determined identity identification numbers of the application programs, the application programs assigned to each task to be executed are determined from the application programs installed on the intelligent substation area terminal, and each candidate application program is obtained.
[0041] In this embodiment, by obtaining each candidate application program, a data basis is provided for determining and calculating the load level of each candidate application program later.
[0042] Step 120: Calculate the load level of each candidate application program according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program.
[0043] Specifically, the minimum number of processing tasks refers to the minimum number of tasks that the application program can process simultaneously set in advance according to the actual situation or requirements. The maximum number of processing tasks is the maximum number of tasks that the application program can process simultaneously set in advance according to the actual situation or requirements. The number of tasks in execution refers to the number of tasks that the application program is currently executing. The load level refers to a quantitative index calculated through the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of the application program, which is used to measure the busyness degree and resource utilization of the application program and reflects the resource consumption characteristics of the application program.
[0044] In specific implementation, for the current candidate application program, the load level of the current candidate application program = (the number of tasks in execution of the current candidate application program - the minimum number of processing tasks of the current candidate application program) / (the maximum number of processing tasks of the current candidate application program - the minimum number of processing tasks of the current candidate application program).
[0045] In this embodiment, calculating the load level of each candidate application program according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program can better evaluate the resource consumption characteristics of each candidate application program and provide a data basis for determining the target application program later.
[0046] Step 130: Determine the candidate application program with the lowest load level as the target application program, and determine the target task from the tasks to be executed of the target application program according to the priorities of the tasks to be executed of the target application program.
[0047] Specifically, the target application refers to the application with the lowest load level selected from each candidate application. The target task refers to the task to be currently executed selected from the tasks to be executed of the target application according to the priority of the task. The priority of the task to be executed refers to an importance identifier set in advance for each task to be executed according to the actual situation or requirements.
[0048] In specific implementation, after obtaining the load levels of each candidate application, the candidate application with the lowest load level can be determined as the target application, and then, among the tasks to be executed corresponding to the target application, the task to be executed with the highest priority is determined as the target task.
[0049] In this embodiment, by selecting the application with the lowest load as the target application, the problem of a single application being overloaded and the resulting imbalance in terminal resource allocation is avoided, thereby improving the overall operating efficiency of the terminal and achieving the optimization of load balancing and resource utilization. At the same time, determining the target task from the tasks to be executed of the target application according to the priority ensures the timely completion of critical tasks and further improves the responsiveness and reliability of the system.
[0050] Step 140: Control the target application to execute the target task through the target communication port.
[0051] In specific implementation, after determining the target task, a connection can be established between the target application and the target communication port according to the configuration information of the target communication port (such as port number, protocol type, etc.). Then, the detailed parameters of the target task (such as execution conditions, input data, etc.) are extracted from the task allocation table, and finally, the task parameters are passed to the target application through the target communication port. After receiving the task parameters, the target application executes the target task.
[0052] In this embodiment, through the above steps, the phenomenon of blind resource invocation and waste is eliminated, the situation of resource idleness or over-occupation is effectively avoided, and the resource utilization rate is significantly improved.
[0053] In the embodiment of the present invention, first, each to-be-executed task assigned to the target communication port of the intelligent substation area terminal is obtained from the task assignment table of the intelligent substation area terminal, and the application programs assigned to each to-be-executed task are determined from the application programs installed in the intelligent substation area terminal, obtaining each candidate application program, which provides a data basis for determining the load level of each candidate application program later. Then, the load level of each candidate application program is calculated according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program, which can better evaluate the resource consumption characteristics of each candidate application program and provides a data basis for determining the target application program later. After that, the candidate application program with the lowest load level is determined as the target application program, and the target task is determined from the to-be-executed tasks of the target application program according to the priority of the to-be-executed tasks of the target application program, avoiding the problem of a single application program being overloaded and the resulting imbalance in terminal resource allocation, thereby improving the overall operation efficiency of the terminal and realizing the optimization of load balancing and resource utilization rate. At the same time, determining the target task from the to-be-executed tasks of the target application program according to the priority ensures that critical tasks are completed in a timely manner, further improving the responsiveness and reliability of the system. Finally, the target application program is controlled to execute the target task through the target communication port, eliminating the phenomenon of blind resource invocation and waste, effectively avoiding the situation of resource idleness or over-occupation, significantly improving the resource utilization rate, and solving the problem that it is difficult to evaluate the resource consumption characteristics of each application program in the prior art, resulting in an imbalance in resource allocation and thus affecting the operation efficiency of the intelligent substation area terminal.
[0054] Figure 2 FIG. 4 is a flowchart of another task execution method provided by an embodiment of the present invention. This embodiment is a specific implementation based on the above embodiment. In this embodiment, the method may further include:
[0055] Step 210: Obtain each to-be-executed task assigned to the target communication port of the intelligent substation area terminal from the task assignment table of the intelligent substation area terminal.
[0056] Step 211: Determine whether there are immediate execution tasks and important execution tasks among the to-be-executed tasks.
[0057] If there are immediate execution tasks and important execution tasks among the to-be-executed tasks, step 212 is executed; if there are no immediate execution tasks and important execution tasks among the to-be-executed tasks, step 215 is executed.
[0058] Specifically, an immediate execution task refers to a task that needs to be executed immediately and cannot be delayed. For example: The immediate execution task can be an agent transmission task. An important execution task refers to a task that needs to be executed preferentially. For example: The important execution task can be a real-time point reading task.
[0059] In a specific implementation, after obtaining each task to be executed, it is possible to determine whether there are immediate execution tasks and important execution tasks among the tasks to be executed according to the attribute information of each task to be executed (such as the business type). For example: If the business type of the immediate execution task is proxy transmission, the business type of the important execution task is real-time point reading, and there are no tasks to be executed with business types of real-time point reading and proxy transmission among the business types of each task to be executed, it is determined that there are no immediate execution tasks and important execution tasks among the tasks to be executed.
[0060] Step 212: Determine whether there are immediate execution tasks among the tasks to be executed.
[0061] If there are immediate execution tasks among the tasks to be executed, execute step 214; if there are no immediate execution tasks among the tasks to be executed, execute step 213.
[0062] In a specific implementation, after determining that there are no immediate execution tasks and important execution tasks among the tasks to be executed, it is possible to determine whether there are immediate execution tasks among the tasks to be executed according to the attribute information of each task to be executed (such as the business type).
[0063] For example: Assume that the business type of the immediate execution task is proxy transmission, and the business type of the important execution task is real-time point reading. When there is a task to be executed with a business type of proxy transmission among the business types of each task to be executed, it can be determined that there are immediate execution tasks among the tasks to be executed. When there are tasks to be executed with business types of both real-time point reading and proxy transmission among the business types of each task to be executed, it can be determined that there are immediate execution tasks among the tasks to be executed.
[0064] Step 213: Determine the important execution task as the target task.
[0065] In a specific implementation, after determining that there are no immediate execution tasks among the tasks to be executed, the important execution task can be determined as the target task. Then, it is possible to control the target application program to execute the target task through the target communication port, ensuring that high-priority tasks (i.e., important execution tasks) are executed first, avoiding low-priority tasks from over-occupying resources and causing high-priority tasks to be unable to be executed in a timely manner, effectively improving the stability of the system.
[0066] Optionally, after determining the important execution task as the target task, it is possible to first determine whether there is available capacity in the task pool of the target application program. If there is available capacity in the task pool, put the target task into the task pool and control the target application program to execute the target task through the target communication port. If there is no available capacity in the task pool, monitor the capacity of the task pool until there is available capacity in the task pool, then put the target task into the task pool and control the target application program to execute the target task through the target communication port.
[0067] Step 214: Determine the task to be executed immediately as the target task.
[0068] In specific implementation, after determining that there is a task to be executed immediately among the tasks to be executed, the task to be executed immediately can be determined as the target task. Then, it is possible to control the target application program to execute the target task through the target communication port, ensuring that the task to be executed immediately can be processed in a timely manner.
[0069] Furthermore, after determining the task to be executed immediately as the target task, it further includes: determining whether there is available capacity in the task pool of the target application program; if there is available capacity in the task pool, putting the target task into the task pool of the target application program, and controlling the target application program to execute the target task through the target communication port; if there is no available capacity in the task pool, suspending the task with the lowest priority in the task pool, putting the target task into the task pool of the target application program, and controlling the target application program to execute the target task through the target communication port.
[0070] Specifically, the task pool refers to the area in the application program for storing target tasks.
[0071] In specific implementation, after determining the task to be executed immediately as the target task, the total capacity information and the used capacity information of its task pool can be obtained through the interface of the target application program, and then, based on the difference between the total capacity and the used capacity, it is determined whether there is available capacity in the task pool of the target application program. If there is available capacity in the task pool, put the target task into the task pool of the target application program, and control the target application program to execute the target task through the target communication port. If there is no available capacity in the task pool, traverse all the tasks in the task pool to find the task with the lowest priority, remove the task from the task pool, and set its status to "suspended". Then, put the target task into the task pool, and control the target application program to execute the target task through the target communication port.
[0072] In this embodiment, through the above steps, the priority status of the task to be executed immediately is clarified. Whether there is available capacity in the task pool or not, the system will give priority to putting the task to be executed immediately into the task pool and executing it as soon as possible. Especially when the task pool capacity is insufficient, the system will suspend low-priority tasks to ensure that the task to be executed immediately can obtain the execution opportunity first. It avoids the situation that the task to be executed immediately cannot be processed due to the full task pool, effectively prevents low-priority tasks from occupying too many resources, resulting in the task to be executed immediately waiting for a long time or even unable to execute, thereby improving the overall stability, reliability, and real-time performance of the system, and ensuring that high-priority tasks can respond and execute quickly.
[0073] Step 215: Determine the application programs assigned to each task to be executed from the application programs installed on the intelligent substation area terminal to obtain each candidate application program.
[0074] Step 216: Calculate the load level of each candidate application according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application.
[0075] In one implementation, step 216 may specifically include: for the current candidate application, when the number of tasks in execution of the current candidate application is less than the minimum number of processing tasks of the current candidate application, the ratio of the number of tasks in execution to the minimum number of processing tasks is determined as the load level of the current candidate application; when the number of tasks in execution is not less than the minimum number of processing tasks but not greater than the maximum number of processing tasks of the current candidate application, calculate the difference between the number of tasks in execution and the minimum number of processing tasks to obtain the current task deviation, calculate the difference between the maximum number of processing tasks and the minimum number of processing tasks to obtain the current task processing capacity difference, and determine the ratio of the current task deviation to the current task processing capacity difference as the load level of the current candidate application; when the number of tasks in execution is greater than the maximum number of processing tasks, calculate the difference between the number of tasks in execution and the maximum number of processing tasks to obtain the current task excess, and determine the ratio of the current task excess to the maximum number of processing tasks as the load level of the current candidate application.
[0076] Specifically, the current minimum number of processing tasks refers to the minimum number of processing tasks of the current candidate application. The number of tasks in execution refers to the number of tasks in execution of the current candidate application. The current maximum number of processing tasks refers to the maximum number of processing tasks of the current candidate application. The current task deviation refers to the difference between the number of tasks in execution and the minimum number of processing tasks. The current task processing capacity difference refers to the difference between the maximum number of processing tasks and the minimum number of processing tasks. The current task excess refers to the difference between the number of tasks in execution and the maximum number of processing tasks.
[0077] Exemplarily, for the current candidate application, assume that the current minimum number of processing tasks is P, the number of tasks in execution is T, and the current maximum number of processing tasks is Q. When T < P, the load level of the current candidate application is T / P. When P ≤ T ≤ Q, the current task deviation is T - P, the current task processing capacity difference is Q - P, and the load level of the current candidate application is (T - P) / (Q - P). When T > Q, the current task excess is T - Q, and the load level of the current candidate application is (T - Q) / Q.
[0078] In this embodiment, through the above steps, the accuracy of the determined load level is improved.
[0079] Step 217: Determine the candidate application with the lowest load level as the target application, and determine the target task from the tasks to be executed of the target application according to the priority of the tasks to be executed of the target application.
[0080] Further, determining the target task from the tasks to be executed of the target application according to the priority of the tasks to be executed of the target application includes: screening out the highest priority from the priorities of each task to be executed to obtain the target priority; determining whether there are at least two tasks to be executed with the target priority; if so, determining the target task from at least two tasks to be executed with the target priority according to the timestamp of the tasks to be executed; if not, determining the task to be executed with the target priority as the target task.
[0081] Specifically, the target priority refers to the highest priority screened out from the priorities of each task to be executed.
[0082] In specific implementation, after determining the target application, the highest priority can be screened out from the priorities of each task to be executed first as the target priority. Then determine whether there are at least two tasks to be executed with the target priority; if so, determine the task to be executed with the earliest timestamp among the tasks to be executed with the target priority as the target task; if not, determine the only task to be executed with the target priority as the target task.
[0083] In this embodiment, through the above steps, it can be ensured that high-priority tasks are executed first, and when multiple tasks have the same highest priority, the task with the earliest timestamp will be selected to ensure that the task that arrives first is executed first, thus avoiding long waiting times for tasks.
[0084] Further, after determining the target task from the tasks to be executed of the target application according to the priority of the tasks to be executed of the target application, it further includes: determining whether there is available capacity in the task pool of the target application; if there is available capacity in the task pool, put the target task into the task pool; if there is no available capacity in the task pool, monitor the capacity of the task pool until there is available capacity in the task pool, and then put the target task into the task pool.
[0085] In a specific implementation, after determining a target task from the tasks to be executed of a target application according to the priority of the tasks to be executed of the target application, the total capacity information and the used capacity information of its task pool can be obtained through the interface of the target application, and then, based on the difference between the total capacity and the used capacity, it is determined whether there is available capacity in the task pool of the target application. If there is available capacity in the task pool, the target task is placed into the task pool of the target application. If there is no available capacity in the task pool, a monitoring mechanism (such as periodic polling, event-driven, etc.) can be started to monitor the capacity of the task pool until there is available capacity in the task pool, and then the target task is placed into the task pool.
[0086] In this embodiment, through the above steps, it can be ensured that the target task can enter the task pool and be executed in a timely manner. When there is available capacity in the task pool, the target task will be immediately incorporated, thus making full use of the task pool resources and avoiding the idle waste of resources. If the task pool is full, by continuously monitoring the capacity of the task pool and waiting for a task to be completed to release available capacity, it not only prevents resources from being occupied by unnecessary tasks, ensures that the task pool is always in a highly efficient utilization state, but also avoids the occurrence of overload situations.
[0087] Step 218: Control the target application to execute the target task through the target communication port.
[0088] Therefore, in the technical solution of the present invention, each to-be-executed task assigned to the target communication port of the intelligent substation area terminal is first obtained from the task assignment table of the intelligent substation area terminal, and then it is determined whether there are immediate execution tasks and important execution tasks among the to-be-executed tasks. If there are immediate execution tasks and important execution tasks among the to-be-executed tasks, it is determined whether there are immediate execution tasks among the to-be-executed tasks. If there are immediate execution tasks among the to-be-executed tasks, the immediate execution tasks are determined as target tasks, and then the target application is controlled to execute the target tasks through the target communication port, ensuring that the immediate execution tasks can be processed in a timely manner. If there are no immediate execution tasks among the to-be-executed tasks, the important execution tasks are determined as target tasks, and then the target application is controlled to execute the target tasks through the target communication port, ensuring that high-priority tasks (i.e., important execution tasks) are executed first, avoiding low-priority tasks from occupying too many resources and causing important tasks to be unable to be executed in a timely manner, thereby improving the overall stability. If there are no immediate execution tasks and important execution tasks among the to-be-executed tasks, the application programs assigned to the to-be-executed tasks are determined from the application programs installed on the intelligent substation area terminal to obtain each candidate application program, providing a data basis for subsequently determining and calculating the load levels of the candidate application programs. Then, according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program, the load levels of the candidate application programs are calculated, which can better evaluate the resource consumption characteristics of each candidate application program and provide a data basis for subsequently determining the target application program. Subsequently, the candidate application program with the lowest load level is determined as the target application program, and the target tasks are determined from the to-be-executed tasks of the target application program according to the priorities of the to-be-executed tasks of the target application program, avoiding the problem of a single application program being overloaded and the resulting imbalance in terminal resource allocation, thereby improving the overall operation efficiency of the terminal and achieving the optimization of load balancing and resource utilization rate. At the same time, determining the target tasks from the to-be-executed tasks of the target application program according to the priorities ensures the timely completion of critical tasks and further improves the responsiveness and reliability of the system. Finally, the target application is controlled to execute the target tasks through the target communication port, eliminating the phenomenon of blind resource invocation and waste, effectively avoiding the situation of resource idleness or over-occupation, significantly improving the resource utilization rate, and solving the problem in the prior art that it is difficult to evaluate the resource consumption characteristics of each application program, resulting in resource allocation imbalance and further affecting the operation efficiency of the intelligent substation area terminal.
[0089] Figure 3 FIG. is a schematic structural diagram of a task execution device provided by an embodiment of the present invention. This device and the task execution methods of the above embodiments belong to the same inventive concept. For the details not described in detail in the embodiment of the task execution device, reference can be made to the embodiments of the above task execution methods.
[0090] As Figure 3 shown, the device includes:
[0091] An acquisition module 310, configured to acquire each to-be-executed task assigned to a target communication port of the intelligent substation terminal from a task assignment table of the intelligent substation terminal, and determine, from application programs installed in the intelligent substation terminal, application programs assigned to the to-be-executed tasks, so as to obtain each candidate application program;
[0092] A calculation module 320, configured to calculate a load level of each candidate application program according to a minimum processing task quantity, a maximum processing task quantity, and a quantity of tasks in execution of each candidate application program;
[0093] A determination module 330, configured to determine a candidate application program with the lowest load level as a target application program, and determine a target task from the to-be-executed tasks of the target application program according to a priority of the to-be-executed tasks of the target application program;
[0094] An execution module 340, configured to control the target application program to execute the target task through the target communication port.
[0095] Based on the above embodiments, the calculation module 320 is specifically configured to:
[0096] For a current candidate application program, when a quantity of current tasks in execution of the current candidate application program is less than a current minimum processing task quantity of the current candidate application program, a ratio of the quantity of current tasks in execution to the current minimum processing task quantity is determined as a load level of the current candidate application program;
[0097] When the quantity of current tasks in execution is not less than the current minimum processing task quantity but not greater than a current maximum processing task quantity of the current candidate application program, a difference between the quantity of current tasks in execution and the current minimum processing task quantity is calculated to obtain a current task deviation amount, a difference between the current maximum processing task quantity and the current minimum processing task quantity is calculated to obtain a current task processing capacity difference, and a ratio of the current task deviation amount to the current task processing capacity difference is determined as a load level of the current candidate application program;
[0098] When the quantity of current tasks in execution is greater than the current maximum processing task quantity, a difference between the quantity of current tasks in execution and the current maximum processing task quantity is calculated to obtain a current task excess amount, and a ratio of the current task excess amount to the current maximum processing task quantity is determined as a load level of the current candidate application program.
[0099] Based on the above embodiments, the apparatus further includes:
[0100] A judgment module, configured to determine whether there are immediate execution tasks and important execution tasks among the to-be-executed tasks after obtaining the to-be-executed tasks assigned to the target communication port of the intelligent substation terminal from the task assignment table of the intelligent substation terminal; if there are no immediate execution tasks and important execution tasks among the to-be-executed tasks, trigger the execution of determining the application programs assigned to the to-be-executed tasks from the application programs installed on the intelligent substation terminal to obtain each candidate application program.
[0101] Based on the above embodiments, the device further includes:
[0102] A target task determination module, configured to, after determining whether there are immediate execution tasks and important execution tasks among the to-be-executed tasks, in the case that there are immediate execution tasks among the to-be-executed tasks, determine the immediate execution tasks as the target tasks; in the case that there are no immediate execution tasks but there are important execution tasks among the to-be-executed tasks, determine the important execution tasks as the target tasks.
[0103] Based on the above embodiments, the device further includes:
[0104] A first storage module, configured to, after determining the immediate execution tasks as the target tasks, determine whether there is available capacity in the task pool of the target application program; if there is available capacity in the task pool, put the target tasks into the task pool of the target application program, and control the target application program to execute the target tasks through the target communication port; if there is no available capacity in the task pool, suspend the task with the lowest priority in the task pool, put the target tasks into the task pool of the target application program, and control the target application program to execute the target tasks through the target communication port.
[0105] Based on the above embodiments, the device further includes:
[0106] A second storage module, configured to, after determining the target tasks from the to-be-executed tasks of the target application program according to the priorities of the to-be-executed tasks of the target application program, determine whether there is available capacity in the task pool of the target application program; if there is available capacity in the task pool, put the target tasks into the task pool; if there is no available capacity in the task pool, monitor the capacity of the task pool until there is available capacity in the task pool, and put the target tasks into the task pool.
[0107] Based on the above embodiments, the determination module 330 is specifically configured to:
[0108] Screen out the highest priority from the priorities of the to-be-executed tasks to obtain the target priority;
[0109] Determine whether there are at least two to-be-executed tasks with the priority being the target priority;
[0110] If there are, then determine the target task from at least two to-be-executed tasks with the priority being the target priority according to the timestamps of the to-be-executed tasks;
[0111] If there are not, then determine the to-be-executed task with the priority being the target priority as the target task.
[0112] The task execution device provided by the embodiments of the present invention can execute the task execution method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method.
[0113] It should be noted that in the embodiments of the above task execution device, the included respective units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the respective functional units are only for the convenience of mutual distinction and are not used to limit the protection scope of the present invention.
[0114] Figure 4 It is a schematic structural diagram of an intelligent substation area terminal provided by an embodiment of the present invention. Figure 4 It shows a block diagram of an exemplary intelligent substation area terminal 4 suitable for implementing the embodiments of the present invention. Figure 4 The shown intelligent substation area terminal 4 is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present invention.
[0115] As Figure 4 shown, the intelligent substation area terminal 4 is presented in the form of a general-purpose computing electronic device. The components of the intelligent substation area terminal 4 may include but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).
[0116] The bus 18 represents one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any bus structure in multiple bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
[0117] The intelligent substation area terminal 4 typically includes a variety of computer system readable media. These media can be any available media accessible by the intelligent substation area terminal 4, including volatile and non-volatile media, removable and non-removable media.
[0118] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The intelligent substation area terminal 4 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used for reading and writing on non-removable, non-volatile magnetic media ( Figure 4 not shown, commonly referred to as a "hard disk drive"). Although Figure 4 not shown in, a disk drive for reading and writing on a removable non-volatile disk (such as a "floppy disk") and an optical disk drive for reading and writing on a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 through one or more data media interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0119] A program / utilities 40 having a set (at least one) of program modules 42 may be stored, for example, in the system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment. The program modules 42 generally perform the functions and / or methods in the embodiments described in the present invention.
[0120] The intelligent substation area terminal 4 may also communicate with one or more external devices 14 (such as a keyboard, a pointing device, a display 24, etc.), and may also communicate with one or more devices that enable a user to interact with the intelligent substation area terminal 4, and / or communicate with any device that enables the intelligent substation area terminal 4 to communicate with one or more other computing devices (such as a network card, a modem, etc.). Such communication may be carried out through the input / output (I / O) interface 22. Also, the intelligent substation area terminal 4 may communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 20. As Figure 4 shown, the network adapter 20 communicates with other modules of the intelligent substation area terminal 4 through the bus 18. It should be understood that although Figure 4 not shown in, other hardware and / or software modules may be used in conjunction with the intelligent substation area terminal 4, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0121] The processing unit 16 executes various functional applications and page displays by running the programs stored in the system memory 28, for example, implementing the task execution method provided by the embodiments of the present invention. The method includes:
[0122] Obtain each task to be executed assigned to the target communication port of the intelligent substation area terminal from the task assignment table of the intelligent substation area terminal, and determine the application programs assigned to the tasks to be executed from the application programs installed on the intelligent substation area terminal, so as to obtain each candidate application program;
[0123] Calculate the load level of each candidate application program according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program;
[0124] Determine the candidate application program with the lowest load level as the target application program, and determine the target task from the tasks to be executed of the target application program according to the priority of the tasks to be executed of the target application program;
[0125] Control the target application program to execute the target task through the target communication port.
[0126] Certainly, those skilled in the art can understand that the processor can also implement the technical solutions of the task execution method provided by any embodiment of the present invention.
[0127] The embodiments of the present invention provide a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements, for example, the task execution method provided by the embodiments of the present invention. The method includes:
[0128] Obtain each task to be executed assigned to the target communication port of the intelligent substation area terminal from the task assignment table of the intelligent substation area terminal, and determine the application programs assigned to the tasks to be executed from the application programs installed on the intelligent substation area terminal, so as to obtain each candidate application program;
[0129] Calculate the load level of each candidate application program according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program;
[0130] Determine the candidate application program with the lowest load level as the target application program, and determine the target task from the tasks to be executed of the target application program according to the priority of the tasks to be executed of the target application program;
[0131] Control the target application program to execute the target task through the target communication port.
[0132] The computer storage medium of the embodiments of the present invention may adopt any combination of one or more computer-readable media. The computer-readable media may be computer-readable signal media or computer-readable storage media. The computer-readable storage media may, for example, but not be limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, the computer-readable storage media may be any tangible medium that contains or stores a program, which can be used by or in combination with an instruction execution system, device, or component.
[0133] The computer-readable signal media may include data signals propagated in a baseband or as part of a carrier wave, which carry computer-readable program codes. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal media may also be any computer-readable media other than the computer-readable storage media, which can send, propagate, or transmit a program for use by or in combination with an instruction execution system, device, or component.
[0134] The program codes contained on the computer-readable media may be transmitted by any appropriate media, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0135] The computer program codes for performing the operations of the present invention may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program codes may be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).
[0136] Those of ordinary skill in the art should understand that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device. They can be concentrated on a single computing device or distributed across a network composed of multiple computing devices. Optionally, they can be implemented using program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0137] In addition, in the technical solution of the present invention, the acquisition, storage, use, processing, etc. of data all comply with the relevant provisions of national laws and regulations.
[0138] Note that the above is only a preferred embodiment of the present invention and the applied technical principle. Those skilled in the art will understand that the present invention is not limited to the specific embodiments here, and various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments only. Without departing from the concept of the present invention, it can also include more other equivalent embodiments, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A task execution method, characterized in that Including: Obtain each to-be-executed task assigned to the target communication port of the intelligent substation area terminal from the task assignment table of the intelligent substation area terminal, and determine the application programs assigned to the to-be-executed tasks from the application programs installed on the intelligent substation area terminal, so as to obtain each candidate application program; Calculate the load levels of the candidate application programs according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of the candidate application programs; Determine the candidate application program with the lowest load level as the target application program, and determine the target task from the to-be-executed tasks of the target application program according to the priorities of the to-be-executed tasks of the target application program; Control the target application program to execute the target task through the target communication port.
2. The task execution method according to claim 1, wherein Calculating the load levels of the candidate application programs according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of the candidate application programs includes: For the current candidate application program, when the number of tasks in current execution of the current candidate application program is less than the current minimum number of processing tasks of the current candidate application program, determine the ratio of the number of tasks in current execution to the current minimum number of processing tasks as the load level of the current candidate application program; When the number of tasks in current execution is not less than the current minimum number of processing tasks but not greater than the current maximum number of processing tasks of the current candidate application program, calculate the difference between the number of tasks in current execution and the current minimum number of processing tasks to obtain the current task deviation amount, calculate the difference between the current maximum number of processing tasks and the current minimum number of processing tasks to obtain the current task processing capacity difference, and determine the ratio of the current task deviation amount to the current task processing capacity difference as the load level of the current candidate application program; When the number of tasks in current execution is greater than the current maximum number of processing tasks, calculate the difference between the number of tasks in current execution and the current maximum number of processing tasks to obtain the current task excess amount, and determine the ratio of the current task excess amount to the current maximum number of processing tasks as the load level of the current candidate application program.
3. The task execution method according to claim 1, characterized in that, After obtaining each to-be-executed task assigned to the target communication port of the intelligent substation area terminal from the task assignment table of the intelligent substation area terminal, it further includes: Determine whether there are immediate execution tasks and important execution tasks among the to-be-executed tasks; If there are no immediate execution tasks and important execution tasks among the to-be-executed tasks, trigger the execution of determining the application programs assigned to the to-be-executed tasks from the application programs installed on the intelligent substation area terminal to obtain each candidate application program.
4. The task execution method according to claim 3, wherein After determining whether there are immediate execution tasks and important execution tasks among the to-be-executed tasks, it further includes: When there is an immediate execution task among the to-be-executed tasks, determine the immediate execution task as the target task; When there is no immediate execution task but there is an important execution task among the to-be-executed tasks, determine the important execution task as the target task.
5. The task execution method according to claim 4, characterized in that After determining the immediately executable task as the target task, the following steps are further included: Determine whether there is available capacity in the task pool of the target application; If there is available capacity in the task pool, put the target task into the task pool of the target application, and control the target application to execute the target task through the target communication port; If there is no available capacity in the task pool, suspend the task with the lowest priority in the task pool, put the target task into the task pool of the target application, and control the target application to execute the target task through the target communication port.
6. The task execution method according to claim 1, wherein After determining the target task from the tasks to be executed of the target application according to the priority of the tasks to be executed of the target application, the following steps are further included: Determine whether there is available capacity in the task pool of the target application; If there is available capacity in the task pool, put the target task into the task pool; If there is no available capacity in the task pool, monitor the capacity of the task pool until there is available capacity in the task pool, and then put the target task into the task pool.
7. The task execution method according to claim 1, characterized in that, Determining the target task from the tasks to be executed of the target application according to the priority of the tasks to be executed of the target application includes: Screen out the highest priority from the priorities of the tasks to be executed to obtain the target priority; Determine whether there are at least two tasks to be executed with the target priority; If so, determine the target task from at least two tasks to be executed with the target priority according to the timestamp of the tasks to be executed; If not, determine the task to be executed with the target priority as the target task.
8. A task execution device, characterized in that, It includes: An acquisition module, configured to acquire each task to be executed assigned to the target communication port of the intelligent substation area terminal from the task allocation table of the intelligent substation area terminal, and determine the application programs assigned to the tasks to be executed from the application programs installed on the intelligent substation area terminal, so as to obtain each candidate application program; A calculation module, configured to calculate the load level of each candidate application program according to the minimum number of processing tasks, the maximum number of processing tasks, and the number of tasks in execution of each candidate application program; A determination module, configured to determine the candidate application program with the lowest load level as the target application program, and determine the target task from the tasks to be executed of the target application program according to the priority of the tasks to be executed of the target application program; An execution module, configured to control the target application program to execute the target task through the target communication port.
9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to execute the task execution method according to any one of claims 1-7.
10. An intelligent substation area terminal, characterized in that, The intelligent substation area terminal includes: At least one processor; and a memory communicatively connected to the at least one processor; Wherein, the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the task execution method according to any one of claims 1-7.