Kernel resource allocation method and device for power Internet of Things equipment

By dynamically allocating kernel resources in power IoT devices, dividing tasks into real-time and non-real-time task groups, and adjusting them according to CPU allocation weight values ​​and scheduling priorities, the problem of insufficient or oversupply of resources caused by static resource allocation is solved, and the problem of insufficient or oversupply of resources is improved. Resource utilization efficiency and task processing success rate.

CN119248504APending Publication Date: 2025-01-03CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411493310.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Power IoT devices face insufficient or oversupply of resources caused by static resource allocation in terms of core resource management, which reduces resource utilization efficiency and task processing success rate and efficiency.

Method used

Using dynamic kernel resource allocation method, the pending tasks are divided into real-time task groups and non-real-time task groups, and dynamically allocate and adjust CPU time according to pre-configured CPU allocation weight values ​​and scheduling priority to ensure the resource requirements of real-time tasks. Priority is given to meeting, and multi-objective constraints are detected and adjusted based on actual load and operation data.

Benefits of technology

It improves resource utilization efficiency and task processing success rate, promptly handles real-time tasks, solves the problem of unbalanced resource utilization when competition between real-time tasks and non-real-time tasks, and achieves more efficient resource management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248504A_ABST
    Figure CN119248504A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a kernel resource allocation method and device for power Internet of Things equipment. The method comprises the steps of obtaining a plurality of target tasks to be processed; determining first CPU time and second CPU time according to the CPU allocation weight values of the real-time task group and the non-real-time task group; performing first scheduling processing according to the scheduling priority of the target task, the first CPU time and the second CPU time; according to the current CPU utilization rate in the current scheduling period, the first CPU time and the scheduling priority are adjusted, and task processing is carried out based on the adjusted information; detecting a plurality of target constraint conditions according to the actual operation data in the current scheduling period, and determining a current constraint condition satisfaction rate; and if the current constraint condition satisfaction rate is smaller than a preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority are adjusted, and task processing of the next scheduling period is performed based on the adjusted information, so that dynamic allocation of kernel resources is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to power technology, and in particular to a kernel resource allocation method and device for a power Internet of Things device. Background Art

[0002] Driven by the global energy transformation and the rapid development of information technology, the power Internet of Things (IoT) has become one of the core technologies of smart grids. The power Internet of Things combines sensors, smart devices and communication technologies to achieve real-time monitoring and intelligent management of power systems.

[0003] The core of smart grid lies in its ability to process large amounts of real-time data. The interconnection between devices enables the grid to monitor and control various types of power equipment in real time, thereby achieving refined management. For example, smart meters on the user side can upload power consumption data in real time, smart sensors on the distribution network can monitor power quality and equipment status, and monitoring systems on the power generation side can optimize power generation strategies. The efficient processing and analysis of these data depends on the powerful computing power and resource management capabilities of power IoT devices.

[0004] Although power IoT devices have made significant progress in hardware and communication technology, they still face many challenges in kernel resource management. Traditional resource allocation methods mainly use static fixed allocation strategies, which can lead to insufficient or excessive resources, reducing resource utilization efficiency and task processing success rate and efficiency. Summary of the invention

[0005] The embodiments of the present invention provide a kernel resource allocation method and device for an electric power Internet of Things device to achieve dynamic allocation of kernel resources, thereby improving resource utilization efficiency and task processing success rate and efficiency.

[0006] In a first aspect, an embodiment of the present invention provides a kernel resource allocation method for a power Internet of Things device, comprising:

[0007] Acquire multiple target tasks to be processed by the power Internet of Things device, where the multiple target tasks include a real-time task group and a non-real-time task group, where the real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task;

[0008] Allocate the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determine a first CPU time corresponding to the real-time task group and a second CPU time corresponding to the non-real-time task group, wherein the CPU allocation weight value corresponding to the real-time task group is greater than the CPU allocation weight value corresponding to the non-real-time task group;

[0009] Performing a first scheduling process on each target task according to the pre-configured scheduling priority, first CPU time and second CPU time of each target task, wherein the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task;

[0010] According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are adjusted, and the task is processed based on the adjusted current first CPU time and current scheduling priority;

[0011] According to the actual operation data of each real-time task in the current scheduling cycle, multiple target constraint conditions are detected to determine the current constraint satisfaction rate corresponding to the real-time task group;

[0012] If the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are adjusted, and the task processing of the next scheduling cycle is performed based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

[0013] In a second aspect, an embodiment of the present invention further provides a kernel resource allocation device for a power Internet of Things device, comprising:

[0014] A target task acquisition module, used to acquire multiple target tasks to be processed by the power Internet of Things device, the multiple target tasks include a real-time task group and a non-real-time task group, the real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task;

[0015] A CPU total time allocation module is used to allocate the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determine the first CPU time corresponding to the real-time task group and the second CPU time corresponding to the non-real-time task group, wherein the CPU allocation weight value corresponding to the real-time task group is greater than the CPU allocation weight value corresponding to the non-real-time task group;

[0016] The first scheduling processing module is used to perform the first scheduling processing on each target task according to the pre-configured scheduling priority, the first CPU time and the second CPU time of each target task, wherein the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task;

[0017] A first information adjustment module, used for adjusting the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task according to the current CPU usage rate of each real-time task in the current scheduling cycle, and performing task processing based on the adjusted current first CPU time and current scheduling priority;

[0018] The satisfaction rate determination module is used to detect multiple target constraint conditions according to the actual operation data of each real-time task in the current scheduling cycle, and determine the current constraint condition satisfaction rate corresponding to the real-time task group;

[0019] The second information adjustment module is used to adjust the current first CPU time, the current second CPU time and the current scheduling priority of each target task if the current constraint satisfaction rate is less than the preset satisfaction rate, and perform task processing in the next scheduling cycle based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

[0020] One embodiment of the above invention has the following advantages or beneficial effects:

[0021] By dividing multiple target tasks to be processed into real-time task groups and non-real-time tasks, and pre-configuring the CPU allocation weight value corresponding to the real-time task group to be greater than the CPU allocation weight value corresponding to the non-real-time task group, and the scheduling priority of the real-time task to be higher than the scheduling priority of the non-real-time task, it can be ensured that the resource demand of the real-time task is met first, the real-time task is processed in time, and the problem of unbalanced resource utilization when the real-time task and the non-real-time task compete is solved. By dynamically adjusting the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task according to the current CPU usage rate of each real-time task in the current scheduling cycle, the actual load change is responded to in time to ensure the rapid processing of the real-time task. By detecting multiple target constraints according to the actual operation data of each real-time task in the current scheduling cycle, the current constraint satisfaction rate corresponding to the real-time task group is determined, and when the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are dynamically adjusted, so that the real-time task can meet multiple target constraints, thereby improving the resource utilization efficiency and the task processing success rate and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 It is a flow chart of a kernel resource allocation method for a power Internet of Things device provided by an embodiment of the present invention;

[0024] Figure 2A flowchart of a method for allocating core resources of a power Internet of Things device provided by an embodiment of the present invention;

[0025] Figure 3 A flowchart of a method for allocating core resources of a power Internet of Things device provided by an embodiment of the present invention;

[0026] Figure 4 It is a flowchart of a kernel resource allocation method for a power Internet of Things device provided by an embodiment of the present invention;

[0027] Figure 5 A schematic structural diagram of a core resource allocation device for an electric power Internet of Things device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0029] Figure 1 This is a flowchart of a method for allocating kernel resources of a power Internet of Things device provided by an embodiment of the present invention. This embodiment can be applied to the case where the CPU time and scheduling priority of the power Internet of Things device are dynamically allocated and adjusted. The method can be executed by a kernel resource allocation device of the power Internet of Things device, which can be implemented by software and / or hardware and integrated into the power Internet of Things device. Figure 1 As shown, the method specifically comprises the following steps:

[0030] S110. Acquire multiple target tasks to be processed by the power Internet of Things device, where the multiple target tasks include a real-time task group and a non-real-time task group. The real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task.

[0031] Among them, the power Internet of Things device can refer to any power device in the power Internet of Things. The target task can refer to the task that the power Internet of Things device needs to process. A real-time task refers to a task that needs to be responded to quickly and has strict requirements on the processing time, that is, the processing delay of the real-time task needs to be less than the preset delay. For example, real-time tasks can be data collection tasks and data processing tasks. Non-real-time tasks refer to tasks that can accept a certain delay, and their processing time is relatively flexible, that is, the processing delay of non-real-time tasks is allowed to be greater than the preset delay. For example, non-real-time tasks can be data analysis tasks and report generation tasks.

[0032] Specifically, all target tasks to be processed by the power Internet of Things device can be classified in advance to obtain a real-time task group and a non-real-time task group. Each real-time task in the real-time task group needs to be processed quickly, and each non-real-time task in the non-real-time task group can be processed when resources are relatively idle.

[0033] S120. Allocate the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determine the first CPU time corresponding to the real-time task group and the second CPU time corresponding to the non-real-time task group, wherein the CPU allocation weight value corresponding to the real-time task group is greater than the CPU allocation weight value corresponding to the non-real-time task group.

[0034] Among them, a control group Cgroup is created for the real-time task group and the non-real-time task group in advance, for example, a control group Cgroup of the real-time task group real_time is created through / sys / fs / cgroup / cpu / real_time, and a control group Cgroup of the non-real-time task group non_real_time is created through / sys / fs / cgroup / cpu / non_real_time. The control group Cgroup is used to limit resources and manage tasks in the task group. The CPU allocation weight value cpu.shares of the real-time task group is used to characterize the proportion of the first CPU time allocated by the real-time task group. The CPU allocation weight value cpu.shares of the non-real-time task group is used to characterize the proportion of the second CPU time allocated by the non-real-time task group. The first CPU time refers to the total CPU time that can be used by all real-time tasks in the real-time task group. The second CPU time refers to the total CPU time that can be used by all non-real-time tasks in the non-real-time task group. Since the CPU allocation weight value corresponding to the pre-configured real-time task group is greater than the CPU allocation weight value corresponding to the non-real-time task group, the initially allocated first CPU time is greater than the second CPU time.

[0035] Specifically, the total CPU time of the power Internet of Things device is allocated according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and the first CPU time corresponding to the real-time task group and the second CPU time corresponding to the non-real-time task group are obtained. For example, the CPU allocation weight value of the real-time task group is 512, and the CPU allocation weight value of the non-real-time task group is 256, then the first CPU time obtained by the real-time task group is twice the second CPU time obtained by the non-real-time task group. It should be noted that the sum of the first CPU time and the second CPU time is the total CPU time of the power Internet of Things device. By utilizing the configured CPU allocation weight value, it can be ensured that the real-time task group obtains more CPU time, thereby ensuring that the real-time task obtains sufficient resources. By creating and configuring Cgroups for different task categories, effective CPU resource management can be implemented in the operating system kernel.

[0036] S130. Perform a first scheduling process on each target task according to the pre-configured scheduling priority, first CPU time, and second CPU time of each target task, wherein the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task.

[0037] Among them, the scheduling priority refers to the priority of the process used to process the target task, which can be used to characterize the order in which the target tasks are processed. The scheduling priority of a real-time task is higher than that of a non-real-time task, thereby ensuring that the real-time task has priority in obtaining CPU resources during scheduling. For example, the scheduling priority of a real-time task is configured to 10, and the scheduling priority of a non-real-time task is set to 1. The lower the value, the lower the scheduling priority. The configured scheduling priority is the initial priority when the task starts processing. The scheduling priority of each target task can be dynamically adjusted and updated as the scheduling process progresses.

[0038] Specifically, the first CPU time is allocated to obtain the CPU time corresponding to each real-time task in the real-time task group, and the second CPU time is allocated to obtain the CPU time corresponding to each non-real-time task in the non-real-time task group, thereby obtaining the CPU time corresponding to each target task. According to the pre-configured scheduling priority and CPU time of each target task, the scheduling and processing of each target task begins in the first scheduling cycle. Each target task is scheduled and processed periodically. Since the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task, the real-time task can obtain CPU time and resources first during debugging, ensuring that the resource requirements of the real-time task are met first and can be responded to and processed in a timely manner, while also providing necessary resource support for the non-real-time task.

[0039] For example, when allocating real-time tasks in a multi-core system, the load of each core can be collected, and the real-time tasks can be allocated to the core with the lowest load for processing, thereby further ensuring the processing speed of the real-time tasks and improving resource utilization.

[0040] S140. According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are adjusted, and task processing is performed based on the adjusted current first CPU time and current scheduling priority.

[0041] Among them, the current scheduling cycle can refer to the scheduling cycle in which the current moment is. The current scheduling cycle can be each scheduling cycle in turn. The current CPU usage rate refers to the actual CPU usage rate of the real-time task in the current scheduling cycle. The current first CPU time refers to the first CPU time allocated by the real-time task group at the current moment. The current scheduling priority refers to the scheduling priority set for the real-time task at the current moment. The first CPU time and the scheduling priority are both dynamically adjusted and updated.

[0042] Specifically, in the current scheduling cycle, i.e., in each scheduling cycle, the current CPU usage of each real-time task can be collected, so as to judge the current load situation of the real-time task based on the current CPU usage. Based on the current CPU usage, the first CPU time corresponding to the real-time task group can be dynamically adjusted to a more suitable CPU time, and the second CPU time of the non-real-time task group can be synchronously adjusted based on the adjusted first CPU time. Based on the current CPU usage, the scheduling priority of each real-time task can also be dynamically adjusted, and based on the adjusted current first CPU time and the current scheduling priority, task processing can continue in the current scheduling cycle. By dynamically adjusting the CPU time and scheduling priority of the real-time task in each scheduling cycle, the processing success rate and efficiency of the real-time task can be effectively improved, and resource utilization can be improved.

[0043] S150 , detecting multiple target constraint conditions according to actual operation data of each real-time task in the current scheduling cycle, and determining the current constraint condition satisfaction rate corresponding to the real-time task group.

[0044] Among them, the actual operation data can be used to characterize the processing performance of each real-time task in the current scheduling cycle. The target constraint condition may refer to the performance requirements that need to be met when the real-time task is processed. The target constraint condition can be set from different processing performance requirements. Exemplarily, multiple target constraints may include but are not limited to: real-time constraint conditions, reliability constraint conditions, resource utilization constraint conditions and energy consumption constraint conditions. Among them, the real-time constraint condition may refer to the average delay of the real-time task group being less than or equal to the preset delay, thereby ensuring that the delay of the real-time task is within an acceptable range. The reliability constraint condition may refer to the task success rate of the real-time task group being greater than or equal to the preset success rate, thereby ensuring the processing success rate of the real-time task. The resource utilization constraint condition may refer to the CPU utilization rate of the real-time task group being greater than or equal to the preset utilization rate, thereby ensuring the resource utilization rate of the real-time task. The energy consumption constraint condition may refer to the total energy consumption of the real-time task group being less than or equal to the preset energy consumption, thereby ensuring the low energy consumption of the real-time task. The current constraint satisfaction rate can be used to characterize the degree to which the current allocation strategy of the real-time task group meets the target constraint condition. The current allocation strategy includes the current first CPU time and the current scheduling priority of the real-time task group.

[0045] Specifically, after the current scheduling cycle ends and before entering the next scheduling cycle, the performance indicators corresponding to the real-time task group are determined based on the actual operation data of each real-time task in the current scheduling cycle, such as the average delay indicator, task success rate, CPU utilization and total energy consumption of the real-time task group. Among them, the average delay indicator is obtained by averaging the processing delays of all real-time tasks, and the processing delay refers to the difference between the actual processing completion time and the expected processing completion time of the real-time task. According to the performance indicators corresponding to the real-time task group, multiple target constraints are detected, that is, each performance indicator is detected to meet the corresponding target constraint conditions, the number of target constraints is determined, and the number is divided by the total number of target constraints to obtain the current constraint satisfaction rate corresponding to the real-time task group, so as to evaluate the rationality and effectiveness of the current allocation strategy based on the current constraint satisfaction rate.

[0046] S160. If the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are adjusted, and the task processing of the next scheduling cycle is performed based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

[0047] Specifically, when the current constraint condition satisfaction rate is less than the preset satisfaction rate, it indicates that the current allocation strategy of the real-time task group is not very suitable and cannot meet the multi-objective constraints. Therefore, it is necessary to directly adjust the current first CPU time, the current second CPU time and the current scheduling priority of each target task to a more suitable situation before entering the next scheduling cycle, so as to perform the task processing of the next scheduling cycle based on a more suitable allocation strategy, so that the real-time task meets the multi-objective constraints such as real-time performance, reliability, resource utilization and energy consumption, thereby effectively ensuring the resource utilization efficiency and the success rate and efficiency of task processing. For example, when the current constraint condition satisfaction rate is less than the preset satisfaction rate, the current first CPU time is increased, and based on the increased current first CPU time, the current second CPU time is synchronously reduced, and the current scheduling priority of the real-time task is increased, and the current scheduling priority of the non-real-time task is reduced, thereby ensuring the priority and efficient processing of the real-time task. When the current constraint condition satisfaction rate is greater than or equal to the preset satisfaction rate, there is no need to adjust the current allocation strategy of the real-time task group, and the task processing of the next scheduling cycle can be performed directly based on the current first CPU time, the current second CPU time and the current scheduling priority of each target task, thereby avoiding the situation of the increase of the scheduler overhead caused by the frequency adjustment, and then ensuring the overall performance.

[0048] The technical scheme of the present embodiment is to divide the multiple target tasks to be processed into real-time task groups and non-real-time tasks, and pre-configure the CPU allocation weight value corresponding to the real-time task group to be greater than the CPU allocation weight value corresponding to the non-real-time task group, and the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task, so as to ensure that the resource demand of the real-time task is met first, and the real-time task is processed in time, and the problem of unbalanced resource utilization when the real-time task and the non-real-time task compete is solved. According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are dynamically adjusted, so as to timely respond to the actual load change and ensure the rapid processing of the real-time task. According to the actual operation data of each real-time task in the current scheduling cycle, multiple target constraints are detected, the current constraint satisfaction rate corresponding to the real-time task group is determined, and when the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are dynamically adjusted, so that the real-time task can meet multiple target constraints, thereby improving the resource utilization efficiency and the task processing success rate and efficiency.

[0049] Figure 2This is a flowchart of a method for allocating kernel resources of a power Internet of Things device provided by an embodiment of the present invention. Based on the above embodiments, this embodiment optimizes the step of "performing a first scheduling process for each target task according to the pre-configured scheduling priority, first CPU time and second CPU time of each target task". The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.

[0050] See also Figure 2 The kernel resource allocation method of a power Internet of Things device provided in this embodiment specifically includes the following steps:

[0051] S210. Acquire multiple target tasks to be processed by the power Internet of Things device, where the multiple target tasks include a real-time task group and a non-real-time task group. The real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task.

[0052] S220, allocating the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determining a first CPU time corresponding to the real-time task group and a second CPU time corresponding to the non-real-time task group.

[0053] S230: Determine the CPU time corresponding to each real-time task based on the expected processing time of each real-time task, the number of CPU cores, the scheduling cycle time, and the first CPU time.

[0054] The expected processing time of the real-time task may refer to the time required for the real-time task processing. The number of CPU cores refers to the total number of CPU cores of the operating system of the power Internet of Things device. The scheduling cycle time refers to the duration of a single scheduling cycle.

[0055] Specifically, according to the expected processing time of each real-time task, combined with the number of CPU cores and the scheduling cycle time, the first CPU time corresponding to the real-time task group is reasonably allocated to obtain the CPU time corresponding to each real-time task.

[0056] Exemplarily, step S230 may include: determining the CPU time of each real-time task in a single scheduling cycle based on the expected processing time of each real-time task, the number of CPU cores, and the scheduling cycle time; wherein the sum of the CPU time of all real-time tasks in a single scheduling cycle is less than or equal to the first CPU time.

[0057] Specifically, for each real-time task, the expected processing time of the real-time task is divided by the scheduling cycle time to obtain the number of schedulings corresponding to the real-time task, and the expected processing time of the real-time task is divided by the scheduling number to obtain the processing time required for the real-time task in a single scheduling cycle, and the processing time is divided by the number of CPU cores to obtain the CPU time of the real-time task in a single scheduling cycle. After obtaining the CPU time corresponding to each real-time task, it can be detected whether the sum of the CPU time allocated to all real-time tasks is less than or equal to the first CPU time. If so, the first scheduling process can be performed directly according to the CPU time. If not, it is necessary to adjust the CPU time allocated to the real-time task so that the sum of the adjusted CPU time is less than or equal to the first CPU time. For example, the allocation weight value corresponding to each real-time task is determined based on the historical resource demand of each real-time task, and the first CPU time is allocated according to the allocation weight value. Alternatively, the CPU time of the real-time task with less historical resource demand is reduced and adjusted so that the sum of the CPU time of all real-time tasks after adjustment is less than or equal to the first CPU time.

[0058] S240: Determine the CPU time corresponding to each non-real-time task based on the expected processing time of each non-real-time task, the number of CPU cores, the scheduling cycle time, and the second CPU time.

[0059] The expected processing time of the non-real-time task may refer to the time required for the non-real-time task processing. Specifically, according to the expected processing time of each non-real-time task, combined with the number of CPU cores and the scheduling cycle time, the second CPU time corresponding to the non-real-time task group is reasonably allocated to obtain the CPU time corresponding to each non-real-time task.

[0060] Exemplarily, step S240 may include: determining the CPU time of each non-real-time task in a single scheduling cycle based on the expected processing time of each non-real-time task, the number of CPU cores, and the scheduling cycle time; wherein the sum of the CPU time of all non-real-time tasks in a single scheduling cycle is less than or equal to the second CPU time.

[0061] Specifically, for each non-real-time task, the expected processing time of the non-real-time task is divided by the scheduling cycle time to obtain the number of schedulings corresponding to the non-real-time task, and the expected processing time of the non-real-time task is divided by the scheduling number to obtain the processing time required for the non-real-time task in a single scheduling cycle, and the processing time is divided by the number of CPU cores to obtain the CPU time of the non-real-time task in a single scheduling cycle. After obtaining the CPU time corresponding to each non-real-time task, it can be detected whether the sum of the CPU time allocated to all non-real-time tasks is less than or equal to the second CPU time. If so, the first scheduling process can be directly performed according to the CPU time. If not, it is necessary to adjust the CPU time allocated to the non-real-time task so that the sum of the adjusted CPU time is less than or equal to the second CPU time. The CPU time adjustment method of the non-real-time task can refer to the CPU time adjustment method of the real-time task described above, which will not be repeated here.

[0062] S250: Perform initial scheduling processing on each target task according to the pre-configured scheduling priority and CPU time of each target task.

[0063] Specifically, according to the pre-configured scheduling priority and allocated CPU time of each target task, each target task is scheduled and processed in the first scheduling cycle. Each target task is scheduled and processed periodically. Since the scheduling priority of real-time tasks is higher than that of non-real-time tasks, real-time tasks can obtain CPU time and resources first during debugging, ensuring that the resource requirements of real-time tasks are met first and can be responded to and processed in a timely manner, while also providing necessary resource support for non-real-time tasks.

[0064] S260. According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are adjusted, and task processing is performed based on the adjusted current first CPU time and current scheduling priority.

[0065] S270 , detecting multiple target constraint conditions according to actual operation data of each real-time task in the current scheduling cycle, and determining the current constraint condition satisfaction rate corresponding to the real-time task group.

[0066] S280. If the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are adjusted, and the task processing of the next scheduling cycle is performed based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

[0067] The technical solution of this embodiment can more reasonably and accurately determine the CPU time corresponding to each real-time task based on the expected processing time, number of CPU cores, scheduling cycle time and first CPU time of each real-time task, and can also more reasonably and accurately determine the CPU time corresponding to each non-real-time task based on the expected processing time, number of CPU cores, scheduling cycle time and second CPU time of each non-real-time task, thereby achieving reasonable allocation of CPU time of the task group and further ensuring the success rate and efficiency of task output.

[0068] Figure 3 This is a flowchart of a kernel resource allocation method for a power Internet of Things device provided by an embodiment of the present invention. Based on the above embodiments, this embodiment optimizes the step of "adjusting the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task according to the current CPU usage rate of each real-time task in the current scheduling cycle". The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.

[0069] See also Figure 3 The kernel resource allocation method of a power Internet of Things device provided in this embodiment specifically includes the following steps:

[0070] S310. Acquire multiple target tasks to be processed by the power Internet of Things device, where the multiple target tasks include a real-time task group and a non-real-time task group. The real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task.

[0071] S320, allocating the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determining the first CPU time corresponding to the real-time task group and the second CPU time corresponding to the non-real-time task group.

[0072] S330 , performing initial scheduling processing on each target task according to the pre-configured scheduling priority, first CPU time and second CPU time of each target task.

[0073] S340: Determine the current total CPU usage corresponding to the real-time task group according to the current CPU usage of each real-time task in the current scheduling cycle.

[0074] Specifically, the current CPU usage rate of each real-time task in the current scheduling period is added to obtain the current total CPU usage rate corresponding to the real-time task group.

[0075] S350. Determine a target adjustment coefficient corresponding to the real-time task group based on the current total CPU usage rate, and adjust the first CPU time corresponding to the real-time task group based on the target adjustment coefficient to obtain the adjusted current first CPU time.

[0076] The target adjustment coefficient may be used to control the adjustment range of the first CPU time. The target adjustment coefficient may be a coefficient greater than 1 to increase the first CPU time. The target adjustment coefficient may also be a coefficient less than 1 to reduce the first CPU time. The target adjustment coefficient may also be a coefficient equal to 1 to keep the first CPU time unchanged.

[0077] Specifically, based on the current total CPU utilization rate corresponding to the real-time task group, the actual resource usage of the real-time task group in the current scheduling cycle can be determined, thereby determining the target adjustment coefficient that matches it. The target adjustment coefficient is multiplied with the first CPU time corresponding to the real-time task group to obtain a multiplication result. The multiplication result can be directly used as the current first CPU time after adjustment, or the multiplication result can be compared with the maximum CPU time of the real-time task group. If it does not exceed the maximum CPU time, the multiplication result is used as the current first CPU time after adjustment, otherwise the maximum CPU time is used as the current first CPU time after adjustment. Wherein, the maximum CPU time can be pre-configured, the CPU time that the real-time task group uses the most in a scheduling cycle. For example, the maximum CPU time that the real-time task group can use in a scheduling cycle (such as 100ms) is 50ms, thereby utilizing the maximum CPU time to limit the range of variation of the first CPU time of the real-time task group.

[0078] Exemplarily, "determining the target adjustment coefficient corresponding to the real-time task group based on the current total CPU usage" in step 350 may include: if the current total CPU usage is less than or equal to the first usage, then determining that the target adjustment coefficient corresponding to the real-time task group is the first coefficient, and the first coefficient is less than 1; if the current total CPU usage is greater than the first usage and less than the second usage, then determining that the target adjustment coefficient corresponding to the real-time task group is 1; if the current total CPU usage is greater than or equal to the second usage, then determining that the target adjustment coefficient corresponding to the real-time task group is the second coefficient, and the second coefficient is greater than 1.

[0079] Specifically, the current total CPU usage Less than or equal to the first usage rate, such as When , it indicates that the resource utilization is low and the CPU time can be reduced. At this time, the target adjustment coefficient corresponding to the real-time task group is determined to be a first coefficient less than 1, such as 0.8, thereby reducing the first CPU time and improving resource utilization. When the current total CPU utilization is greater than the first utilization and less than the second utilization, such as When , it indicates that the resource utilization is within a reasonable range and there is no need to adjust the CPU time. At this time, the target adjustment coefficient corresponding to the real-time task group is determined to be 1 to keep the first CPU time unchanged. When the current total CPU utilization is greater than or equal to the second utilization, for example , it indicates that the resource utilization is high and the CPU time can be increased. At this time, the target adjustment coefficient corresponding to the real-time task group is determined to be a second coefficient greater than 1, such as 1.5, thereby increasing the first CPU time to ensure the success rate and speed of real-time task processing.

[0080] S360. Based on the current CPU usage of each real-time task in the current scheduling cycle, determine the current priority change of each real-time task, and adjust the scheduling priority of each real-time task based on the current priority change to obtain the adjusted current scheduling priority.

[0081] Specifically, for each real-time task, the current CPU usage rate of the real-time task in the current scheduling cycle can be divided by a preset coefficient to obtain the current priority change of the real-time task. The higher the current CPU usage rate, the greater the current priority change, so that the real-time task is processed in priority to other real-time tasks, thereby ensuring that the real-time task can obtain sufficient resources and improve the success rate of task processing. The scheduling priority of the real-time task is added to the current priority change to obtain the addition result. The addition result can be directly determined as the current scheduling priority of the real-time task after adjustment. The addition result can also be compared with the scheduling priority (such as 10) of the initial configuration of the real-time task. If it is higher than the scheduling priority of the initial configuration, the addition result is used as the adjusted current scheduling priority, otherwise the scheduling priority of the initial configuration is used as the adjusted current scheduling priority, thereby avoiding the situation where the scheduling priority of the real-time task after adjustment is lower than the scheduling priority of the non-real-time task, thereby ensuring the priority processing of the real-time task.

[0082] S370. Continue to process tasks based on the adjusted current first CPU time and current scheduling priority in the current scheduling cycle.

[0083] S380: Detect multiple target constraint conditions according to the actual operation data of each real-time task in the current scheduling cycle, and determine the current constraint condition satisfaction rate corresponding to the real-time task group.

[0084] S390. If the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are adjusted, and the task processing of the next scheduling cycle is performed based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

[0085] The technical solution of this embodiment determines the target adjustment coefficient corresponding to the real-time task group based on the current total CPU usage corresponding to the real-time task group, and more reasonably adjusts the first CPU time corresponding to the real-time task group based on the target adjustment coefficient, and determines the current priority change of each real-time task based on the current CPU usage of each real-time task in the current scheduling cycle, and more reasonably adjusts the scheduling priority of each real-time task based on the current priority change, thereby further improving resource utilization and the success rate and speed of real-time task processing.

[0086] Figure 4 This is a flowchart of a method for allocating kernel resources of a power Internet of Things device provided by an embodiment of the present invention. Based on the above embodiments, this embodiment optimizes the step of "adjusting the current first CPU time, the current second CPU time and the current scheduling priority of each target task". The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.

[0087] See also Figure 4 The kernel resource allocation method of a power Internet of Things device provided in this embodiment specifically includes the following steps:

[0088] S410. Acquire multiple target tasks to be processed by the power Internet of Things device, where the multiple target tasks include a real-time task group and a non-real-time task group. The real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task.

[0089] S420, allocating the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determining a first CPU time corresponding to the real-time task group and a second CPU time corresponding to the non-real-time task group.

[0090] S430 , performing initial scheduling processing on each target task according to the pre-configured scheduling priority, first CPU time, and second CPU time of each target task.

[0091] S440. According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are adjusted, and task processing is performed based on the adjusted current first CPU time and current scheduling priority.

[0092] S450: Detect multiple target constraint conditions according to the actual operation data of each real-time task in the current scheduling cycle, and determine the current constraint condition satisfaction rate corresponding to the real-time task group.

[0093] S460: If the current constraint satisfaction rate is less than the preset satisfaction rate, when the current total CPU usage rate corresponding to the real-time task group is greater than or equal to the preset usage rate, increase the current first CPU time, and adjust the current second CPU time based on the increased current first CPU time.

[0094] Specifically, when the current constraint satisfaction rate is less than the preset satisfaction rate, it can be detected that the current total CPU usage rate corresponding to the real-time task group is greater than or equal to the preset usage rate. If the current total CPU usage rate corresponding to the real-time task group is greater than or equal to the preset usage rate, it indicates that the resource usage of the real-time task group is high. In order to ensure that the real-time task is quickly and successfully processed, the current first CPU time can be appropriately increased, and the total CPU time is subtracted from the increased current first CPU time to obtain the adjusted current second CPU time, thereby achieving the effect of increasing the current first CPU time of the real-time task group and reducing the current second CPU time of the non-real-time task group. If the current total CPU usage rate corresponding to the real-time task group is less than the preset usage rate, there is no need to adjust the current first CPU time and the current second CPU time, and the task processing of the next scheduling cycle can be directly performed according to the current first CPU time and the current second CPU time.

[0095] S470: Adjust the current scheduling priority of each real-time task according to the task success rate and task delay corresponding to each real-time task.

[0096] Specifically, for each real-time task, according to the task success rate and task delay corresponding to the real-time task, the current scheduling priority of the real-time task is adjusted to a value that matches it. The lower the task success rate and the higher the task delay, the higher the current scheduling priority of the real-time task is adjusted to, so as to improve the processing success rate and efficiency of the real-time task.

[0097] Exemplarily, step S470 may include: determining the current priority adjustment coefficient of each real-time task in the current scheduling cycle based on the task success rate and task delay corresponding to each real-time task; comparing the current priority adjustment coefficient with the previous priority adjustment coefficient corresponding to the previous scheduling cycle to obtain a target real-time task whose current priority adjustment coefficient is greater than the previous priority adjustment coefficient; increasing and adjusting the current scheduling priority of the target real-time task to obtain the adjusted current scheduling priority of the target real-time task.

[0098] Specifically, for each real-time task, based on the task success rate corresponding to the real-time task, the task failure rate corresponding to the real-time task is determined, and the task failure rate and task delay corresponding to the real-time task are weighted and summed, and the result obtained is used as the current priority adjustment coefficient of the real-time task in the current scheduling cycle. The current priority adjustment coefficient of the real-time task in the current scheduling cycle is compared with the previous priority adjustment coefficient corresponding to the previous scheduling cycle, so as to determine whether the processing performance of the current scheduling cycle relative to the previous scheduling cycle decreases due to changes in load and other reasons. The real-time task whose current priority adjustment coefficient is greater than the previous priority adjustment coefficient is used as the target real-time task, so as to obtain the target real-time task whose priority needs to be adjusted. The current scheduling priority of the target real-time task is increased and adjusted, such as determining the priority change amount based on the current priority adjustment coefficient and the previous priority adjustment coefficient, and adding the priority change amount to the current scheduling priority, and the obtained addition result is used as the adjusted current scheduling priority. By increasing the current scheduling priority of the target real-time task, the processing performance of the target real-time task in the next scheduling cycle can be improved, such as improving the CPU resource utilization and the processing success rate.

[0099] It should be noted that since the processing performance of real-time tasks whose current priority adjustment coefficient is less than or equal to the previous priority adjustment coefficient has not decreased, there is no need to adjust the scheduling priority. Task processing can continue to be performed in the next scheduling cycle according to the current scheduling priority, thereby avoiding frequent adjustments to the scheduling priority, thereby reducing scheduling overhead and ensuring overall performance.

[0100] S480: Based on the current CPU usage of each non-real-time task, adjust the current scheduling priority of each non-real-time task.

[0101] Specifically, for each non-real-time task, the current scheduling priority of each non-real-time task is appropriately reduced according to the current CPU usage rate corresponding to the non-real-time task. The lower the current CPU usage rate, the smaller the reduction degree of the current scheduling priority of the non-real-time task.

[0102] Exemplarily, step S480 may include: determining the current priority change of each non-real-time task based on the current CPU usage of each non-real-time task; subtracting the current priority change from the current scheduling priority of each non-real-time task to obtain the adjusted current scheduling priority of the non-real-time task.

[0103] Specifically, for each non-real-time task, the current CPU usage rate of the non-real-time task is set to a preset coefficient to obtain the current priority change of the non-real-time task. The current scheduling priority of the non-real-time task is subtracted from the current priority change to obtain the adjusted current scheduling priority of the non-real-time task, thereby reducing the scheduling priority of the non-real-time task, thereby ensuring the success rate and efficiency of real-time task processing.

[0104] S490: Perform task processing in the next scheduling cycle based on the adjusted current first CPU time, current second CPU time and current scheduling priority.

[0105] The technical solution of this embodiment avoids frequent adjustment of CPU time and ensures overall performance by increasing the current first CPU time when the current total CPU usage rate corresponding to the real-time task group is greater than or equal to the preset usage rate, and adjusting the current second CPU time based on the increased current first CPU time. According to the task success rate and task delay corresponding to each real-time task, the current scheduling priority of each real-time task is adjusted, and based on the current CPU usage rate of each non-real-time task, the current scheduling priority of each non-real-time task is adjusted, so that the real-time task can meet the multi-objective constraints, further improve the resource utilization rate, and reduce the task delay and failure rate.

[0106] The following is an embodiment of a kernel resource allocation device for an electric power Internet of Things device provided in an embodiment of the present invention. The device and the kernel resource allocation method for an electric power Internet of Things device in the above-mentioned embodiments belong to the same inventive concept. For details not fully described in the embodiment of the kernel resource allocation device for an electric power Internet of Things device, reference can be made to the embodiment of the kernel resource allocation method for an electric power Internet of Things device in the above-mentioned embodiments.

[0107] Figure 5 This is a schematic diagram of the structure of a core resource allocation device for a power Internet of Things device provided by an embodiment of the present invention. This embodiment is applicable to the case where the CPU time and scheduling priority of the power Internet of Things device are dynamically allocated and adjusted. Figure 5 As shown, the device specifically includes: a target task acquisition module 510, a CPU total time allocation module 520, a first scheduling processing module 530, a first information adjustment module 540, a satisfaction rate determination module 550 and a second information adjustment module 560.

[0108] Among them, the target task acquisition module 510 is used to obtain multiple target tasks to be processed by the power Internet of Things device, and the multiple target tasks include a real-time task group and a non-real-time task group. The real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task; the CPU total time allocation module 520 is used to allocate the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determine the first CPU time corresponding to the real-time task group and the second CPU time corresponding to the non-real-time task group, wherein the CPU allocation weight value corresponding to the real-time task group is greater than the CPU allocation weight value corresponding to the non-real-time task group; the first scheduling processing module 530 is used to perform the first scheduling processing on each target task according to the pre-configured scheduling priority, first CPU time and second CPU time of each target task, wherein the scheduling priority of the real-time task Higher than the scheduling priority of non-real-time tasks; a first information adjustment module 540, used to adjust the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task according to the current CPU usage rate of each real-time task in the current scheduling cycle, and perform task processing based on the adjusted current first CPU time and current scheduling priority; a satisfaction rate determination module 550, used to detect multiple target constraint conditions according to the actual operation data of each real-time task in the current scheduling cycle, and determine the current constraint condition satisfaction rate corresponding to the real-time task group; a second information adjustment module 560, used to adjust the current first CPU time, the current second CPU time and the current scheduling priority of each target task if the current constraint condition satisfaction rate is less than the preset satisfaction rate, and perform task processing for the next scheduling cycle based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

[0109] The technical scheme of the present embodiment is to divide the multiple target tasks to be processed into real-time task groups and non-real-time tasks, and pre-configure the CPU allocation weight value corresponding to the real-time task group to be greater than the CPU allocation weight value corresponding to the non-real-time task group, and the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task, so as to ensure that the resource demand of the real-time task is met first, and the real-time task is processed in time, and the problem of unbalanced resource utilization when the real-time task and the non-real-time task compete is solved. According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are dynamically adjusted, so as to timely respond to the actual load change and ensure the rapid processing of the real-time task. According to the actual operation data of each real-time task in the current scheduling cycle, multiple target constraints are detected, the current constraint satisfaction rate corresponding to the real-time task group is determined, and when the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are dynamically adjusted, so that the real-time task can meet multiple target constraints, thereby improving the resource utilization efficiency and the task processing success rate and efficiency.

[0110] Optionally, the first scheduling processing module 530 includes:

[0111] A first CPU time allocation unit, configured to determine the CPU time corresponding to each real-time task based on the expected processing time of each real-time task, the number of CPU cores, the scheduling cycle time and the first CPU time;

[0112] A second CPU time allocation unit is used to determine the CPU time corresponding to each non-real-time task based on the expected processing time of each non-real-time task, the number of CPU cores, the scheduling cycle time and the second CPU time;

[0113] The first scheduling processing unit is used to perform the first scheduling processing on each target task according to the pre-configured scheduling priority and CPU time of each target task.

[0114] Optionally, the first CPU time allocation unit is specifically configured to:

[0115] Based on the expected processing time of each real-time task, the number of CPU cores, and the scheduling cycle time, the CPU time of each real-time task in a single scheduling cycle is determined; wherein the sum of the CPU time of all real-time tasks in a single scheduling cycle is less than or equal to the first CPU time.

[0116] Optionally, the first information adjustment module 540 includes:

[0117] The current total CPU usage determining unit is used to determine the current total CPU usage corresponding to the real-time task group according to the current CPU usage of each real-time task in the current scheduling cycle;

[0118] A first CPU time adjustment unit is used to determine a target adjustment coefficient corresponding to the real-time task group based on the current total CPU usage rate, and adjust the first CPU time corresponding to the real-time task group based on the target adjustment coefficient to obtain the adjusted current first CPU time;

[0119] The scheduling priority adjustment unit is used to determine the current priority change of each real-time task based on the current CPU usage of each real-time task in the current scheduling cycle, and adjust the scheduling priority of each real-time task based on the current priority change to obtain the adjusted current scheduling priority.

[0120] Optionally, the first CPU time adjustment unit is specifically configured to:

[0121] If the current total CPU usage is less than or equal to the first usage, the target adjustment coefficient corresponding to the real-time task group is determined to be the first coefficient, and the first coefficient is less than 1; if the current total CPU usage is greater than the first usage and less than the second usage, the target adjustment coefficient corresponding to the real-time task group is determined to be 1; if the current total CPU usage is greater than or equal to the second usage, the target adjustment coefficient corresponding to the real-time task group is determined to be the second coefficient, and the second coefficient is greater than 1.

[0122] Optionally, the multiple target constraints include: real-time constraints, reliability constraints, resource utilization constraints, and energy consumption constraints;

[0123] Among them, the real-time constraint condition means that the average delay of the real-time task group is less than or equal to the preset delay; the reliability constraint condition means that the task success rate of the real-time task group is greater than or equal to the preset success rate; the resource utilization constraint condition means that the CPU utilization of the real-time task group is greater than or equal to the preset utilization; the energy consumption constraint condition means that the total energy consumption of the real-time task group is less than or equal to the preset energy consumption.

[0124] Optionally, the second information adjustment module 560 includes:

[0125] A CPU time adjustment unit, configured to increase the current first CPU time when the current total CPU usage rate corresponding to the real-time task group is greater than or equal to a preset usage rate, and adjust the current second CPU time based on the increased current first CPU time;

[0126] A first priority adjustment unit, used to adjust the current scheduling priority of each real-time task according to the task success rate and task delay corresponding to each real-time task;

[0127] The second priority adjustment unit is used to adjust the current scheduling priority of each non-real-time task based on the current CPU usage of each non-real-time task.

[0128] Optionally, the first priority adjustment unit is specifically configured to:

[0129] According to the task success rate and task delay corresponding to each real-time task, determine the current priority adjustment coefficient of each real-time task in the current scheduling cycle; compare the current priority adjustment coefficient with the previous priority adjustment coefficient corresponding to the previous scheduling cycle to obtain the target real-time task whose current priority adjustment coefficient is greater than the previous priority adjustment coefficient; increase and adjust the current scheduling priority of the target real-time task to obtain the adjusted current scheduling priority of the target real-time task.

[0130] Optionally, the second priority adjustment unit is specifically configured to:

[0131] Based on the current CPU usage of each non-real-time task, determine the current priority change of each non-real-time task; subtract the current priority change from the current scheduling priority of each non-real-time task to obtain the adjusted current scheduling priority of the non-real-time task.

[0132] The kernel resource allocation device of the power Internet of Things device provided in the embodiment of the present invention can execute the kernel resource allocation method of the power Internet of Things device provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the kernel resource allocation method of the power Internet of Things device.

[0133] It is worth noting that in the embodiment of the core resource allocation device of the above-mentioned electric power Internet of Things equipment, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0134] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a 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 made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0135] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection 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, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A kernel resource allocation method for a power Internet of Things device, characterized in that: include: Acquire multiple target tasks to be processed by the power Internet of Things device, where the multiple target tasks include a real-time task group and a non-real-time task group, where the real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task; Allocate the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determine a first CPU time corresponding to the real-time task group and a second CPU time corresponding to the non-real-time task group, wherein the CPU allocation weight value corresponding to the real-time task group is greater than the CPU allocation weight value corresponding to the non-real-time task group; Performing a first scheduling process on each target task according to the pre-configured scheduling priority, first CPU time and second CPU time of each target task, wherein the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task; According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are adjusted, and the task is processed based on the adjusted current first CPU time and current scheduling priority; Detect multiple target constraints according to the actual operation data of each real-time task in the current scheduling cycle, and determine the current constraint satisfaction rate corresponding to the real-time task group; If the current constraint satisfaction rate is less than the preset satisfaction rate, the current first CPU time, the current second CPU time and the current scheduling priority of each target task are adjusted, and the task processing of the next scheduling cycle is performed based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

2. The method according to claim 1, characterized in that According to the pre-configured scheduling priority, first CPU time and second CPU time of each target task, each target task is scheduled for the first time, including: Determine the CPU time corresponding to each real-time task based on the expected processing time of each real-time task, the number of CPU cores, the scheduling cycle time and the first CPU time; Determine the CPU time corresponding to each non-real-time task based on the expected processing time of each non-real-time task, the number of CPU cores, the scheduling cycle time and the second CPU time; Each target task is scheduled for the first time according to the pre-configured scheduling priority and CPU time of each target task.

3. The method according to claim 2, characterized in that Based on the expected processing time of each real-time task, the number of CPU cores, the scheduling cycle time, and the first CPU time, the CPU time corresponding to each real-time task is determined, including: Based on the expected processing time of each real-time task, the number of CPU cores, and the scheduling cycle time, determine the CPU time of each real-time task in a single scheduling cycle; The sum of the CPU times of all real-time tasks in a single scheduling cycle is less than or equal to the first CPU time.

4. The method according to claim 1, characterized in that: According to the current CPU usage rate of each real-time task in the current scheduling cycle, the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task are adjusted, including: According to the current CPU usage of each real-time task in the current scheduling cycle, determine the current total CPU usage corresponding to the real-time task group; Based on the current total CPU usage, determine the target adjustment coefficient corresponding to the real-time task group, and based on the target adjustment coefficient, adjust the first CPU time corresponding to the real-time task group to obtain the adjusted current first CPU time; Based on the current CPU usage of each real-time task in the current scheduling cycle, the current priority change of each real-time task is determined, and the scheduling priority of each real-time task is adjusted based on the current priority change to obtain the adjusted current scheduling priority.

5. The method according to claim 4, characterized in that Based on the current total CPU usage, determine the target adjustment coefficient corresponding to the real-time task group, including: If the current total CPU usage is less than or equal to the first usage, determining that the target adjustment coefficient corresponding to the real-time task group is the first coefficient, and the first coefficient is less than 1; If the current total CPU usage is greater than the first usage and less than the second usage, determining that the target adjustment coefficient corresponding to the real-time task group is 1; If the current total CPU usage is greater than or equal to the second usage, the target adjustment coefficient corresponding to the real-time task group is determined to be the second coefficient, and the second coefficient is greater than 1.

6. The method according to claim 1, characterized in that Multiple objective constraints include: real-time constraints, reliability constraints, resource utilization constraints, and energy consumption constraints; Among them, the real-time constraint condition means that the average delay of the real-time task group is less than or equal to the preset delay; the reliability constraint condition means that the task success rate of the real-time task group is greater than or equal to the preset success rate; the resource utilization constraint condition means that the CPU utilization of the real-time task group is greater than or equal to the preset utilization; the energy consumption constraint condition means that the total energy consumption of the real-time task group is less than or equal to the preset energy consumption.

7. The method according to claim 1, characterized in that The current first CPU time, the current second CPU time, and the current scheduling priority of each target task are adjusted, including: When the current total CPU usage rate corresponding to the real-time task group is greater than or equal to the preset usage rate, increase the current first CPU time, and adjust the current second CPU time based on the increased current first CPU time; Adjust the current scheduling priority of each real-time task according to the task success rate and task delay corresponding to each real-time task; Based on the current CPU usage of each non-real-time task, the current scheduling priority of each non-real-time task is adjusted.

8. The method according to claim 7, characterized in that According to the task success rate and task delay corresponding to each real-time task, adjust the current scheduling priority of each real-time task, including: Determine the current priority adjustment coefficient of each real-time task in the current scheduling cycle according to the task success rate and task delay corresponding to each real-time task; Compare the current priority adjustment coefficient with the previous priority adjustment coefficient corresponding to the previous scheduling cycle to obtain the target real-time task whose current priority adjustment coefficient is greater than the previous priority adjustment coefficient; The current scheduling priority of the target real-time task is increased and adjusted to obtain the adjusted current scheduling priority of the target real-time task.

9. The method according to claim 7, characterized in that: Based on the current CPU usage of each non-real-time task, adjust the current scheduling priority of each non-real-time task, including: Based on the current CPU usage of each non-real-time task, determine the current priority change of each non-real-time task; The current scheduling priority of each non-real-time task is subtracted from the current priority change to obtain the adjusted current scheduling priority of the non-real-time task.

10. A kernel resource allocation device for a power Internet of Things device, characterized in that: include: A target task acquisition module, used to acquire multiple target tasks to be processed by the power Internet of Things device, the multiple target tasks include a real-time task group and a non-real-time task group, the real-time task group includes at least one real-time task, and the non-real-time task group includes at least one non-real-time task; A CPU total time allocation module is used to allocate the total CPU time according to the pre-configured CPU allocation weight value of the real-time task group and the CPU allocation weight value of the non-real-time task group, and determine the first CPU time corresponding to the real-time task group and the second CPU time corresponding to the non-real-time task group, wherein the CPU allocation weight value corresponding to the real-time task group is greater than the CPU allocation weight value corresponding to the non-real-time task group; The first scheduling processing module is used to perform the first scheduling processing on each target task according to the pre-configured scheduling priority, the first CPU time and the second CPU time of each target task, wherein the scheduling priority of the real-time task is higher than the scheduling priority of the non-real-time task; A first information adjustment module, used for adjusting the first CPU time corresponding to the real-time task group and the scheduling priority of each real-time task according to the current CPU usage rate of each real-time task in the current scheduling cycle, and performing task processing based on the adjusted current first CPU time and current scheduling priority; The satisfaction rate determination module is used to detect multiple target constraint conditions according to the actual operation data of each real-time task in the current scheduling cycle, and determine the current constraint condition satisfaction rate corresponding to the real-time task group; The second information adjustment module is used to adjust the current first CPU time, the current second CPU time and the current scheduling priority of each target task if the current constraint satisfaction rate is less than the preset satisfaction rate, and perform task processing in the next scheduling cycle based on the adjusted current first CPU time, the current second CPU time and the current scheduling priority.

Citation Information

Cited By

  • 5G gateway resource optimization system and method

    CN119789146A

  • A 5G gateway resource optimization system and method

    CN119789146B