System resource allocation method and device, electronic equipment and storage medium
By obtaining system resource application information for high-power consumption tasks in electronic devices and using historical data in the system resource information database for resource allocation, the problem of poor power consumption management flexibility in the prior art is solved, and resource allocation of low power consumption and overall power consumption is reduced.
Patent Information
- Application Number
- CN202510351554.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-06-24
AI Technical Summary
The prior art has poor flexibility when performing power consumption management in electronic devices, especially when handling applications with high power consumption, lacks effective power consumption optimization methods.
By obtaining system resource application information for high-power consumption tasks, and finding matching historical system resource application information in the system resource information database, selecting the task with the lowest historical power consumption as the goal, and allocating system resources based on this information.
It realizes low-power resource allocation for high-power tasks, reduces the overall power consumption of electronic devices, and improves the flexibility of electronic devices in power consumption management.
Smart Images

Figure CN120196444A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communication technologies, and particularly relates to a system resource allocation method, apparatus, electronic device, and storage medium. Background Art
[0002] Currently, with the increase in the functions of application programs in electronic devices, the system resources occupied by the application programs in the electronic devices are also increasing. For example, the occupancy rate of the Central Processing Unit (CPU), which in turn leads to an increasing power consumption of the electronic devices.
[0003] In the prior art, in order to ensure the battery life of the electronic device, when the electronic device is in a low power state, the electronic device can reduce the frequency of the CPU, reduce the screen brightness of the electronic device; or limit the use of application programs in the electronic device, etc., to ensure that the electronic device can have a long battery life.
[0004] However, in the above methods, the electronic device only performs power consumption management from the hardware aspect, and lacks corresponding power consumption optimization methods for application programs with high power consumption. Thus, the flexibility of the electronic device for power consumption management is poor. Summary of the Invention
[0005] The purpose of the embodiments of this application is to provide a system resource allocation method, apparatus, electronic device, and storage medium, which can improve the flexibility of the electronic device for power consumption management.
[0006] In a first aspect, the embodiments of this application provide a system resource allocation method. The system resource allocation method includes: obtaining first system resource application information for a first application program to execute a first task, where the historical power consumption of the first task is greater than or equal to a preset power consumption threshold, and the first system resource application information includes: system resource information required for the first task and task parameter information required for the first task; when there is at least one piece of historical system resource application information corresponding to a second task stored in the first system resource information library, determining, from the first system resource information library, target historical system resource application information corresponding to a target task that matches the system resource information; allocating system resources for the first task based on the target historical system resource application information; where the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among at least one second task, and the historical system resource application information corresponding to a task includes historical system resource information required for a task and historical task parameter information required for a task.
[0007] Second aspect, an embodiment of the present application provides a system resource allocation device, which includes an acquisition module, a determination module, and an allocation module. The acquisition module is configured to acquire first system resource application information for a first application to execute a first task, where the historical power consumption of the first task is greater than or equal to a preset power consumption threshold, and the first system resource application information includes: system resource information required for the first task and task parameter information required for the first task. The determination module is configured to, when there is at least one piece of historical system resource application information corresponding to a second task stored in the first system resource information library, determine, from the first system resource information library, target historical system resource application information corresponding to the target task that matches the system resource information acquired by the acquisition module. The allocation module is configured to perform system resource allocation for the first task based on the target historical system resource application information determined by the determination module; where the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among at least one second task, and the historical system resource application information corresponding to one task includes the historical system resource information required for one task and the historical task parameter information required for one task.
[0008] Third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.
[0009] Fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0010] Fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is configured to run a program or instruction to implement the method described in the first aspect.
[0011] Sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0012] In an embodiment of the present application, the first system resource application information of the first task of the first application can be obtained. The historical power consumption of the first task is greater than or equal to a preset power consumption threshold. The first system resource application information includes: the system resource information required by the first task and the task parameter information required by the first task. Then, when there is at least one piece of historical system resource application information corresponding to a second task stored in the first system resource information library, the target historical system resource application information corresponding to the target task that matches the system resource information is determined from the first system resource information library. Finally, based on the target historical system resource application information, system resources are allocated to the first task. Among them, the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among at least one second task, and the historical system resource application information corresponding to a task includes the historical system resource information required by a task and the historical task parameter information required by a task. In this solution, after obtaining the first system resource application information of the first task with high power consumption, since the target historical system resource application information corresponding to the target task that matches the system resource information in the first system resource application information and has the lowest historical power consumption can be found from the first system resource information library, and a resource allocation operation is performed on the first task. Therefore, when the system resources applied through the target historical system resource application information are used to execute the first task, it can be ensured that the power consumption for executing the first task is low power consumption, thereby reducing the power consumption of the electronic device. Moreover, it can be understood that by adjusting the system resources allocated to high-power tasks, power consumption management can be performed at the application and system levels. In this way, while reducing the power consumption of the electronic device, the flexibility of the electronic device for power consumption management is also improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 is a schematic diagram of the system architecture of the prior art;
[0014] Figure 2 is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0015] Figure 3 is one of the flowcharts of a system resource allocation method provided by an embodiment of the present application;
[0016] Figure 4 is another flowchart of a system resource allocation method provided by an embodiment of the present application;
[0017] Figure 5 is yet another flowchart of a system resource allocation method provided by an embodiment of the present application;
[0018] Figure 6 is still another flowchart of a system resource allocation method provided by an embodiment of the present application;
[0019] Figure 7 It is the fifth flowchart of a system resource allocation method provided by an embodiment of the present application;
[0020] Figure 8 It is the sixth flowchart of a system resource allocation method provided by an embodiment of the present application;
[0021] Figure 9 It is a schematic diagram of establishing a system resource information library provided by an embodiment of the present application;
[0022] Figure 10 It is an interaction flowchart of a system resource allocation method provided by an embodiment of the present application;
[0023] Figure 11 It is one of the structural schematic diagrams of a system resource allocation device provided by an embodiment of the present application;
[0024] Figure 12 It is another structural schematic diagram of a system resource allocation device provided by an embodiment of the present application;
[0025] Figure 13 It is yet another structural schematic diagram of a system resource allocation device provided by an embodiment of the present application;
[0026] Figure 14 It is one of the hardware structural schematic diagrams of an electronic device provided by an embodiment of the present application;
[0027] Figure 15 It is another hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0028] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope protected by the present application.
[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally represents an "or" relationship between the associated objects before and after.
[0030] The terms "at least one (item)", "at least one of", etc. in the description and claims of this application refer to any one, any two or a combination of two or more of the objects it contains. For example, at least one (item) of a, b, and c can represent: "a", "b", "c", "a and b", "a and c", "b and c", and "a, b, and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".
[0031] The following will, with reference to the accompanying drawings, explain in detail the system resource allocation method, device, electronic device, and storage medium provided by the embodiments of this application through specific embodiments and their application scenarios.
[0032] The system resource allocation method, device, electronic device, and storage medium provided by the embodiments of this application can be applied to scenarios such as memory recovery, memory application, or sensor call scenarios.
[0033] The following will specifically explain the system framework in an electronic device in the prior art.
[0034] Exemplarily, as Figure 1 shown, the system framework of an electronic device includes: an application layer 101, an application framework layer 102, and the application framework layer 102 includes a virtual machine 1021, a hardware abstraction layer 103, and a kernel layer 104; the application layer 101 is connected to the application framework layer 102, the virtual machine 1021 in the application framework layer 102 is connected to the hardware abstraction layer 103, and the hardware abstraction layer 103 is connected to the kernel layer 104; among them, the application layer 101 includes at least one application program, and the application framework layer 102 provides various application program interfaces (Application Program Interface, API) to communicate with each application program in at least one application program in the application layer 101; the virtual machine 102 is used to provide a cross-platform, secure, and efficient environment for the application programs in the application layer; the hardware abstraction layer 103 provides a standardized interface for hardware manufacturers to shield the differences of underlying hardware; the kernel layer 104 provides basic system services as an abstraction layer between hardware and software.
[0035] Combined Figure 1 with the memory application scenario, the system resource allocation process in the prior art will be explained and illustrated.
[0036] The application A in the application layer 101 can send a system resource application information, such as a memory application information, to the virtual machine 1021 in the application framework layer 102 through a process; after the virtual machine 1021 receives the system resource application information, it can send the system resource application information to the central processing unit (CPU) of the electronic device; then, after the CPU receives the system resource application information, it can determine the system resource information and task parameter information required by the application A through the system resource application information, and send the pointers of the system resource information and the task parameter information to the virtual machine 1021; finally, the virtual machine 1021 can send the pointers of the system resource information and the task parameter information to the application A to complete the system resource allocation.
[0037] In the above example, when there is a large amount of system resource information and task parameter information required by the application A in the system resource application information, the power consumption of the electronic device is relatively large. Moreover, in the prior art, the electronic device only performs power consumption management from the hardware aspect, and there is a lack of corresponding power consumption optimization methods for applications with high power consumption. Thus, the flexibility of the electronic device in performing power consumption management is poor.
[0038] In the system resource allocation method, device, electronic device, and storage medium provided in the embodiments of the present application, after obtaining the first system resource application information of the first task with high power consumption, since the target historical system resource application information corresponding to the target task that matches the system resource information in the first system resource application information and has the lowest historical power consumption can be found from the first system resource information library, and a resource allocation operation is performed on the first task; therefore, when the system resources applied through the target historical system resource application information are used to execute the first task, it can be ensured that the power consumption of executing the first task is low power consumption, thereby reducing the power consumption of the electronic device; moreover, it can be understood that by adjusting the system resources allocated to high-power tasks, power consumption management can be performed from the application and system levels. Thus, while reducing the power consumption of the electronic device, the flexibility of the electronic device in performing power consumption management is also improved.
[0039] The embodiments of the present application provide a system structure, such as Figure 2As shown in the figure, the system structure includes: an application layer 101, an application framework layer 102. The application framework layer 102 includes a virtual machine 1021, a first system resource information library 1022, a hardware abstraction layer 103, and a kernel layer 104. The application layer 101 is connected to the application framework layer 102. The virtual machine 1021 in the application framework layer 102 is respectively connected to the first system resource information library 1022 and the hardware abstraction layer 103. The hardware abstraction layer 103 is connected to the kernel layer 104. Among them, the application layer 101 includes at least one application program. The application framework layer 102 provides various application program interfaces (Application Program Interface, API) to communicate with each application program in the at least one application program in the application layer 101. The virtual machine 102 is used to provide a cross-platform, secure, and efficient environment for the application programs in the application layer. The first system resource information library 1022 is used to provide power consumption information, resource application information, and task execution parameter information of the same type of applications under different tasks. The hardware abstraction layer 103 provides a standardized interface for hardware manufacturers to shield the differences of underlying hardware. The kernel layer 104 provides basic system services as an abstraction layer between hardware and software.
[0040] Exemplarily, during the process of a thread executing a low-power task A, through a power consumption monitoring service, such as BatteryStatsService, the power consumption generated by the task, the system resource information required by task A, and the task parameter information required by task A are detected and recorded and written into the first system resource information library. Application B applies to execute a high-power task B, and obtains the system resource information required by task B and the task parameter information required by task B through the virtual machine. The virtual machine searches in the first system resource information library for the historical system resource application information and historical system configuration application information corresponding to the task with the lowest power consumption that matches the system resource information required by task B. The virtual machine applies for system resources for task B based on the historical system resource application information and historical system configuration application information corresponding to the task with the lowest power consumption, and returns the applied system resources to task B.
[0041] The execution subject of the system resource allocation method provided in the embodiments of the present application can be a system resource allocation device. The system resource allocation device can be an electronic device or a functional module in an electronic device, such as a virtual machine. Hereinafter, taking an electronic device as an example, the technical solutions provided in the embodiments of the present application will be described.
[0042] The embodiments of the present application provide a system resource allocation method. Figure 3 The flowchart of a system resource allocation method provided in the embodiments of the present application is shown. As Figure 3 shown, the system resource allocation method provided in the embodiments of the present application may include the following steps 201 to step 203.
[0043] Step 201, the electronic device obtains the first system resource application information of the first task of the first application.
[0044] In the embodiment of the present application, the historical power consumption of the first task is greater than or equal to the preset power consumption threshold, and the first system resource application information includes: the system resource information required by the first task and the task parameter information required by the first task.
[0045] Optionally, in the embodiment of the present application, the preset power consumption threshold may be user-defined; or preset by the electronic device.
[0046] Optionally, in the embodiment of the present application, the preset power consumption threshold may be a power consumption range, for example, 30 mAh to 50 mAh, or the preset power consumption threshold may be a fixed value, for example, 30 mAh.
[0047] Optionally, in the embodiment of the present application, the first task may be any one of the following: a memory application task, a memory recycling task, a sensor scheduling task, etc. It can be specifically determined according to actual usage requirements, and the embodiment of the present application does not limit it.
[0048] Optionally, in the embodiment of the present application, the sensor may be any one of the following: an acceleration sensor, a gravity sensor, a vibration sensor, etc. It can be specifically determined according to actual usage requirements, and the embodiment of the present application does not limit it.
[0049] Optionally, in the embodiment of the present application, the system resource information may include at least one of the following: CPU usage rate, memory occupancy rate, input / output (I / O) rate, network bandwidth occupancy, and CPU load, etc. It can be specifically determined according to actual usage requirements, and the embodiment of the present application does not limit it.
[0050] Optionally, in the embodiment of the present application, the task parameter information may include at least one of the following: the number of register usages, the number of process usages, the number of thread usages, process priority, and API interfaces, etc. It can be specifically determined according to actual usage requirements, and the embodiment of the present application does not limit it.
[0051] Optionally, in the embodiment of the present application, the electronic device may receive the first system resource application information of the first task sent by the first application; or, the electronic device may obtain the first system resource application information of the first task from the installation package of the first application when the first application is in an idle running state.
[0052] It should be noted that the specific process of the electronic device obtaining the first system resource application information of the first task from the installation package of the first application can be seen in the following embodiments in detail. To avoid repetition, it will not be elaborated here.
[0053] Optionally, in the embodiments of the present application, during the process of the electronic device historically executing the first task, the electronic device may monitor the power consumption of the first task through a power consumption monitoring service in the application framework layer, such as BatteryStatsService, and store the power consumption and the task identifier of the first task associated in the power consumption memory page; alternatively, the electronic device may obtain the power consumption of historically executing the first task from the PowerProfile stored in the application framework layer.
[0054] Optionally, in the embodiments of the present application, the above task identifier may be any one of the following: text identifier, special symbol identifier, digital identifier, etc. It can be specifically determined according to actual usage requirements, and the embodiments of the present application do not limit it.
[0055] Exemplarily, assuming that the power consumption of historically executing the first task stored in the power consumption memory page of the electronic device is 80 mAh, taking the preset power consumption threshold of 30 mAh as an example; when the virtual machine in the electronic device currently receives the first system resource application information of the first task, the virtual machine may, according to the task identifier of the first task carried in the first system resource application information, find the historical power consumption corresponding to the task identifier from the power consumption memory page as 80 mAh; then, the electronic device may compare 80 mAh with the preset power consumption threshold of 30 mAh to determine that the historical power consumption of the first task is greater than the preset power consumption threshold, thereby determining that the first task is a high-power task.
[0056] Optionally, in the embodiments of the present application, the application architecture layer of the above electronic device includes a virtual machine; the above step 201 may be specifically implemented by the following step 201a.
[0057] Step 201a: The electronic device obtains the first system resource application information for the first application to execute the first task through the virtual machine.
[0058] In the embodiments of the present application, the electronic device may send the first system resource application information to the virtual machine in the application architecture layer through the API interface in the application layer, so that the virtual machine in the application architecture layer can obtain the first system resource application information.
[0059] Step 202: When there is at least one piece of historical system resource application information corresponding to a second task stored in the first system resource information library, the electronic device determines, from the first system resource information library, the target historical system resource application information corresponding to the target task and matching the system resource information.
[0060] In the embodiments of the present application, the task type of the above-mentioned second task is the same as that of the first task, and the above-mentioned target task is the task with the lowest historical power consumption among at least one second task. The historical system resource application information corresponding to a task includes the historical system resource information required by a task and the historical task parameter information required by a task.
[0061] In the embodiments of the present application, the historical power consumption corresponding to each of the at least one second task is less than the above-mentioned preset power consumption threshold.
[0062] Exemplarily, the above-mentioned first system resource information library may be a database.
[0063] Optionally, in the embodiments of the present application, the above-mentioned first system resource information library may store the historical system resource application information and power consumption when the application programs of the same application type execute different tasks historically.
[0064] Exemplarily, the above-mentioned first system resource information library may include: application type identifier, application package name, task identifier, task type identifier, historical system resource information, historical task parameter information, and power consumption.
[0065] Optionally, in the embodiments of the present application, the above-mentioned application type identifier may be any one of the following: text identifier, special symbol identifier, digital identifier, etc. It can be specifically determined according to actual usage requirements, and the embodiments of the present application do not make limitations.
[0066] Optionally, in the embodiments of the present application, the above-mentioned task type identifier may be any one of the following: text identifier, special symbol identifier, digital identifier, etc. It can be specifically determined according to actual usage requirements, and the embodiments of the present application do not make limitations.
[0067] Optionally, in the embodiments of the present application, the above-mentioned task identifier may be any one of the following: text identifier, special symbol identifier, digital identifier, etc. It can be specifically determined according to actual usage requirements, and the embodiments of the present application do not make limitations.
[0068] Exemplarily, as shown in Table 1, the above-mentioned first system resource information library may include the following information.
[0069] Table 1
[0070]
[0071] Optionally, in the embodiments of the present application, the electronic device may, based on the system resource information of the first task, traverse the historical system resource information corresponding to each of at least one second task in the first system resource information library, and then find at least one fifth task corresponding to at least one historical system resource information that is the same as the system resource information of the first task from the historical system resource information corresponding to each second task; then, select a target task with the lowest power consumption from the at least one fifth task, and determine the historical system resource information and historical task parameter information corresponding to the target task according to the corresponding relationship between the target task and the historical system resource application information.
[0072] Example 1, in combination with Table 1 above, taking the first task as calling Sensor 1 as an example, the system resource information included in the first system resource application information in this first task is the sensor frequency value A, and the task parameter information is 50 processes; the virtual machine in the electronic device may traverse the system resource information of the first two tasks in Table 1 above, hereinafter simply referred to as Task 1 and Task 2, based on the sensor frequency value A, and then determine that the historical system resource information of Task 1 and the historical system resource information of Task 2 are the same as the system resource information of the first task, and then determine the task 1 with a power consumption of 30 mAh as the target task, and determine the target historical system resource information corresponding to this task 1 as the sensor frequency value A and the target historical task parameter information as 20 processes according to the corresponding relationship between Task 1 and the historical system resource application information.
[0073] Optionally, in the embodiments of the present application, multiple system resource information libraries may be stored in the electronic device, and each system resource information library among the multiple system resource information libraries corresponds to a different application type.
[0074] Exemplarily, the above multiple system resource information libraries may be stored in the application framework layer of the electronic device.
[0075] Optionally, in the embodiments of the present application, the above application architecture layer further includes: a power consumption monitoring service and a first system resource information library, and the first system resource information library is connected to the virtual machine; the above step 202 may be specifically implemented by the following step 202a.
[0076] Step 202a: The electronic device determines, through the power consumption monitoring service, the target historical system resource application information corresponding to the target task that matches the system resource information from the first system resource information library.
[0077] In the embodiments of the present application, the electronic device may query the target historical system resource application information in the first system resource information library through the power consumption monitoring service in the application architecture layer.
[0078] It should be noted that for the specific query process, please refer to the following embodiments. To avoid repetition, it will not be elaborated here.
[0079] Step 203: The electronic device allocates system resources for the first task based on the target historical system resource application information.
[0080] In the embodiment of the present application, the electronic device can apply for system resources for the first task through the information included in the target historical system resource application information, and allocate the applied system resources to the first task.
[0081] It should be noted that after the above processing, the first task's resource application can no longer be based on the first system resource application information, but can be based on the target historical system resource application information stored in the first system resource information library for system resource application.
[0082] Exemplarily, in combination with the above Example 1, after the virtual machine in the electronic device determines that the target historical system resource information is the sensor frequency value A and the target historical task parameter information is 20 processes, the virtual machine can send the target historical system resource application information to the CPU, and then the CPU can allocate the sensor frequency value A and 20 processes to the first task.
[0083] In the system resource allocation method provided in the embodiments of the present application, an electronic device may obtain first system resource application information of a first task of a first application, where the historical power consumption of the first task is greater than or equal to a preset power consumption threshold, and the first system resource application information includes: system resource information required by the first task and task parameter information required by the first task; then, when there is at least one piece of historical system resource application information corresponding to a second task stored in the first system resource information library, determine, from the first system resource information library, target historical system resource application information corresponding to a target task that matches the system resource information; finally, perform system resource allocation for the first task based on the target historical system resource application information; where the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among at least one second task, and the historical system resource application information corresponding to one task includes historical system resource information required by one task and historical task parameter information required by one task. In this solution, after obtaining the first system resource application information of the first task with high power consumption, since the target historical system resource application information corresponding to the target task that matches the system resource information in the first system resource application information and has the lowest historical power consumption can be found from the first system resource information library, a resource allocation operation is performed on the first task; therefore, when the system resources applied for through the target historical system resource application information are used to execute the first task, it can be ensured that the power consumption for executing the first task is low power consumption, thereby reducing the power consumption of the electronic device; moreover, it can be understood that by adjusting the system resources allocated to high-power tasks, power consumption management can be performed at the application and system levels, so that while reducing the power consumption of the electronic device, the flexibility of the electronic device for power consumption management is also improved.
[0084] Optionally, in the embodiments of the present application, the above first system resource application information further includes a task type identifier corresponding to the task type of the first task; the historical system resource application information corresponding to one task further includes a task type identifier corresponding to the task type of one task.
[0085] Exemplarily, in combination with Figure 3 , such as Figure 4 shown, the system resource allocation method provided in the embodiments of the present application further includes step 301 below.
[0086] Step 301: The electronic device determines, as at least one second task, the task indicated by the task type identifier of the first task in the first system resource information library.
[0087] In the embodiments of the present application, the electronic device may traverse the first system resource information library based on the task type identifier of the first task to determine that the task indicated by the task type identifier that is the same as the task type identifier of the first task is at least one second task.
[0088] Optionally, in the embodiments of the present application, each of the at least one second task may be a task in the same application or tasks in different applications.
[0089] Optionally, in the embodiments of the present application, the second task may be a task in a third application, and the third application has the same application type as the first application.
[0090] It can be understood that after the electronic device obtains the first system resource application information of the first task sent by the first application, it can determine the second task in the third application that matches the system resource information of the first task from the first system resource information library.
[0091] It should be noted that the execution timing of step 301 above may be before step 202 or after step 201, and can be specifically determined according to actual usage requirements, which is not limited in the embodiments of the present application. Exemplarily, the execution timing of step 301 above may be before step 202.
[0092] In the embodiments of the present application, the electronic device can determine at least one second task with the same task type identifier as the first task from the first system resource information library through the task type identifier of the first task, thus improving the accuracy of the electronic device in determining the target task.
[0093] Optionally, in the embodiments of the present application, in combination with Figure 3 , as Figure 5 shown, step 201 above can be specifically implemented through the following step 201b.
[0094] Step 201b: When detecting that the running state of the first application is an idle running state, the electronic device determines the historical tasks in the first application that meet the first condition as the first task, and obtains the historical system resource application information corresponding to the first task.
[0095] In the embodiments of the present application, the above-mentioned meeting the first condition means that the power consumption corresponding to the historical task is greater than or equal to a preset power consumption threshold.
[0096] It should be noted that the above-mentioned idle running state means that the first application is not running.
[0097] In the embodiments of the present application, the electronic device can detect whether the running state of the first application is an idle running state through the above-mentioned power consumption monitoring service BatteryStatsService.
[0098] Optionally, in the embodiments of the present application, at least one historical task application information of the first application program may be stored in the installation package of the first application program, and the historical task application information may include a historical task and historical system resource application information corresponding to the historical task.
[0099] Exemplarily, the electronic device may perform semantic analysis on the binary package code in the installation package of the first application program through a reverse parsing module, locate the keywords of the task and the key code segments corresponding to the task that include system resource applications, and thus generate a first task and historical system resource application information corresponding to the first task according to the keywords and key code segments of the task.
[0100] It should be noted that the specific process of the electronic device taking the historical tasks in the first application program that meet the first condition as the first task can be found in the above embodiments in detail. To avoid repetition, it will not be elaborated here.
[0101] In the embodiments of the present application, the electronic device may obtain the first task of the first application program and the historical system resource application information corresponding to the first task, that is, the above first system resource application information, from the idle first application program, which improves the flexibility of the electronic device to obtain the first system resource application information of the first task.
[0102] Optionally, in the embodiments of the present application, in combination Figure 5 , such as Figure 6 shown, after the above step 202, the system resource allocation method provided by the embodiments of the present application further includes the following step 401.
[0103] Step 401: The electronic device replaces the first system resource application information with target historical system resource application information.
[0104] It should be noted that the process of the electronic device obtaining the target historical system resource application information can be found in the above embodiments in detail. To avoid repetition, it will not be elaborated here.
[0105] Exemplarily, after obtaining the target historical system resource application information, the electronic device may perform binary compilation on the target historical system resource application information to obtain a binary file, and replace the first system resource application information stored in the electronic device with the binary file.
[0106] In the embodiments of the present application, the electronic device may pre-query the target historical system resource application information when the application is idle, and replace the first system resource application information stored in the electronic device with the target historical system resource application information. In this way, when the first task is executed subsequently, it does not affect the execution and response speed of the application, which is equivalent to no need for system intervention during the task execution process, giving the user a better experience.
[0107] Optionally, in the embodiments of the present application, in combination with Figure 3 , as Figure 7 shown, after the above step 203, the system resource allocation method provided by the embodiments of the present application further includes the following step 501 and step 502.
[0108] Step 501: The electronic device obtains second system resource application information for the second application to execute the third task, the system signature of the first application, and the system signature of the second application.
[0109] In the embodiments of the present application, the historical power consumption of the above third task is greater than or equal to a preset power consumption threshold.
[0110] Optionally, in the embodiments of the present application, the electronic device may receive the second system resource application information of the third task sent by the second application; or, the electronic device may obtain the first system resource application information of the third task from the installation package of the second application when the second application is in an idle running state.
[0111] It should be noted that the specific process for the electronic device to determine the historical power consumption of the third task can be found in the above embodiments. To avoid repetition, it will not be elaborated here.
[0112] Optionally, in the embodiments of the present application, the electronic device may parse the installation package of the first application to obtain the system signature of the first application; or, the electronic device may parse the application package name of the first application to obtain the system signature of the first application.
[0113] It should be noted that the process for the electronic device to obtain the system signature of the second application can be found in the above embodiments. To avoid repetition, it will not be elaborated here.
[0114] It can be understood that the system signature refers to a security mechanism used to verify identity, ensure integrity, and authorization in a computer system or software.
[0115] Step 502: When the task type identifier corresponding to the third task in the second system resource application information is the same as the task type identifier of the first task, and the system signature of the second application is the same as the system signature of the first application, the electronic device executes the third task based on the system resources applied for by the target historical system resource application information.
[0116] In the embodiments of the present application, the electronic device may allocate the system resources applied for by the target historical system resource application information to the third task and directly execute the third task without applying for resources from the electronic device again.
[0117] It can be understood that for application security, if different applications do not have this feature, there will be application data security problems. For example, each terminal manufacturer will build in multiple system applications, and these applications usually have the same system signature. Some large Internet program development companies will also have multiple applications of their own, and they usually have the same signature or package name prefix information. For this type of application, when the electronic device executes a task of application A, it will also detect whether there is an application B with the same signature as the application in the background processes. If so, it is considered that they are mutually trusted applications, and the system resources applied for by the background process application B can be reused for application A. For example, sensor monitoring can be reused without having to apply for system resources additionally. In this way, the system power consumption can be optimized from the perspective of system resource application reuse.
[0118] In the embodiment of the present application, when the task type identifier corresponding to the third task in the second system resource application information is the same as the task type identifier of the first task, and the system signature of the second application program is the same as the system signature of the first application program, the electronic device can reuse the system resources applied for through the target historical system resource application information for the third task without having to apply for system resources additionally, reducing the power consumption of the electronic device and improving the flexibility of system resource allocation.
[0119] Optionally, in the embodiment of the present application, in combination with Figure 3 , as Figure 8 shown, before the above step 201, the system resource allocation method provided by the embodiment of the present application further includes the following step 601 and step 602.
[0120] Step 601: The electronic device obtains at least one historical system resource application information corresponding to at least one fourth historical task and the power consumption corresponding to each fourth historical task.
[0121] In the embodiment of the present application, the power consumption corresponding to each fourth historical task in the above at least one fourth historical task is less than a preset power consumption threshold.
[0122] In the embodiment of the present application, the application types of the application programs corresponding to the above at least one fourth historical task are all the same.
[0123] Optionally, in the embodiment of the present application, the electronic device can obtain the historical system resource application information corresponding to each fourth historical task through the process of each fourth historical task in the at least one fourth historical task.
[0124] Exemplarily, each application program executes tasks or applies for system resources in units of processes, and the system allocates resources based on the process number. Therefore, the electronic device can obtain the historical system resource application information from the memory corresponding to the process according to the process number corresponding to the task.
[0125] Exemplarily, the electronic device may obtain the power consumption corresponding to each fourth historical task through the above power consumption memory page or the above power consumption distribution map.
[0126] Step 602: The electronic device stores the historical system resource application information corresponding to each fourth historical task among at least one fourth historical task and the power consumption in an associated manner to generate a first system resource information library.
[0127] In the embodiment of the present application, one piece of historical system resource application information among at least one piece of historical system resource application information corresponds to one power consumption.
[0128] Exemplarily, the electronic device may write the historical system resource application information corresponding to each fourth historical task among at least one fourth historical task and the power consumption into a database according to the one-to-one correspondence relationship through the power consumption monitoring service BatteryStatsService to generate a first system resource information library.
[0129] Exemplarily, as Figure 9 shown, the following uses a specific example to describe in detail the process of the above electronic device generating the first system resource information library. Specifically, it may be implemented through the following steps 20 to 24.
[0130] Step 20: The electronic device records the power consumption of the task execution of all applications in the electronic device through BatteryStatsService in the application framework layer.
[0131] Step 21: The electronic device analyzes the type information of different applications through BatteryStatsService in the application framework layer and classifies the power consumption types according to different application types.
[0132] Step 22: The electronic device sets a power consumption threshold, for example, 100 mAh, for different application type systems through the virtual machine in the application framework layer. Those lower than this threshold can be considered to have good power consumption, and those higher than this threshold can be considered to have average or poor power consumption; then, BatteryStatsService in the application framework layer writes the above power consumption into the power consumption record table corresponding to different application types.
[0133] It can be understood that one application type may correspond to one power consumption record table.
[0134] Exemplarily, as shown in Table 2, taking one application type as video as an example, the power consumption record table may be:
[0135] Table 2
[0136] Application Type Application Package Name Power Consumption Power Consumption Level Video Category com.abc.1 100 mAh Good Video Category com.abc.3 200 mAh Poor
[0137] Step 23: The electronic device monitors the system resource scheduling and power consumption of task execution under different tasks performed by applications of the same type through BatteryStatsService in the application framework layer, and identifies the power consumption records of task execution under different tasks.
[0138] Exemplarily, as shown in Table 3, the power consumption records of different task executions may be:
[0139] Table 3
[0140] Application Type Application Package Name Task Power Consumption Video Category com.abc.1 Sensor 1 Call 30 mAh Video Category com.abc.2 Sensor 1 Call 50 mAh
[0141] Step 24: The virtual machine in the application framework layer of the electronic device can obtain the task scheduling parameters and the system resource parameters applied for by applications with excellent power consumption, and write the task scheduling parameters and the system resource parameters into the database through BatteryStatsService in the application framework layer to generate the first system resource information library.
[0142] In the embodiment of the present application, the above task scheduling parameters are task parameter information, and the above system resource parameters are system resource information.
[0143] In the embodiment of the present application, by adding a first system resource information library, maintaining the power consumption execution history information of different applications, listening to the task parameter requests and system resource requests of applications with poor power consumption, and optimizing the application and system power consumption by reallocating parameters and resources and reusing system resources.
[0144] Exemplarily, as Figure 10 shown, the system resource allocation method provided in the embodiment of the present application will be described in detail through specific examples below. Specifically, it can be implemented through the following steps 30 to 32.
[0145] Step 30: Application 1 sends the first system resource application information of the first task to the virtual machine in the application framework layer.
[0146] In the embodiment of the present application, the above first system resource application information includes: task parameter information of task execution and system resource information.
[0147] Step 31: The virtual machine in the application framework layer receives the first system resource application information, and obtains the reasonable historical system configuration application information and historical system resource application information matching the system resource information from the first system resource information library through the system resource information in the first system resource application information, and applies for system resources for the first task according to the reasonable historical system configuration application information and historical system resource application information.
[0148] In the embodiments of the present application, the above-mentioned reasonable historical task parameter information and historical system resource information are the historical system configuration application information and historical system application resource information corresponding to the above-mentioned target task.
[0149] Step 32: The virtual machine in the application framework layer sends the applied system resources to Application 1.
[0150] In the embodiments of the present application, after obtaining the first system resource application information of the first task with high power consumption, since the target historical system resource application information that matches the system resource information in the first system resource application information and has the lowest power consumption can be found in the first system resource information library, a resource allocation operation is performed on the first task; therefore, when the first task is executed with the system resources applied through the target historical system resource application information, it can be ensured that the power consumption for executing the first task is low power consumption, thereby reducing the power consumption of the electronic device; moreover, it can be understood that by adjusting the resources allocated to high-power tasks, power consumption management can be performed at the application and system levels, so that while reducing the power consumption of the electronic device, the flexibility of the electronic device for power consumption management is also improved.
[0151] Each of the above method embodiments, or various possible implementation manners in each method embodiment, can be executed alone, or, on the premise of no contradiction, can also be executed in combination with each other, which can be specifically determined according to actual usage requirements, and the embodiments of the present application do not limit this.
[0152] It should be noted that for the system resource allocation method provided in the embodiments of the present application, the execution subject can be a system resource allocation device. In the embodiments of the present application, taking the system resource allocation device executing the system resource allocation method as an example, the system resource allocation device provided in the embodiments of the present application is described.
[0153] Figure 11 A possible structural schematic diagram of the system resource allocation device involved in the embodiments of the present application is shown. As Figure 11 shown, the system resource allocation device 70 may include: an acquisition module 71, a determination module 72, and an allocation module 73.
[0154] Among them, an obtaining module 71 is configured to obtain first system resource application information of a first task of a first application, where the historical power consumption of the first task is greater than or equal to a preset power consumption threshold, and the first system resource application information includes: system resource information required by the first task and task parameter information required by the first task. A determining module 72 is configured to, when there is at least one piece of historical system resource application information corresponding to a second task stored in a first system resource information library, determine, from the first system resource information library, target historical system resource application information corresponding to a target task and matching the system resource information obtained by the obtaining module 71. An allocating module 73 is configured to allocate system resources for the first task based on the target historical system resource application information determined by the determining module 72; where the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among at least one second task, and the historical system resource application information corresponding to a task includes historical system resource information required by a task and historical task parameter information required by a task.
[0155] In a possible implementation manner, the above first system resource application information further includes a task type identifier corresponding to the task type of the first task; the historical system resource application information corresponding to a task further includes a task type identifier corresponding to the task type of the task; the above determining module 72 is further configured to determine, as at least one second task, the task indicated by the task type identifier of the first task in the first system resource information library.
[0156] In a possible implementation manner, the above obtaining module 71 is specifically configured to, when detecting that the running state of the first application is an idle running state, determine a historical task in the first application that meets a first condition as the first task, and obtain the historical system resource application information corresponding to the first task, where meeting the first condition means that the power consumption corresponding to the historical task is greater than or equal to the preset power consumption threshold.
[0157] In a possible implementation manner, in combination with Figure 11 , as Figure 12 shown, the system resource allocation device 70 provided in an embodiment of the present application further includes: a replacing module 74. The replacing module 74 is configured to, after the determining module 72 determines, from the first system resource information library, target historical system resource application information corresponding to the target task and matching the system resource information, replace the first system resource application information with the target historical system resource application information.
[0158] In a possible implementation manner, after the allocation module 72 allocates system resources for the first task based on the target historical system resource application information, the obtaining module 71 is further configured to obtain the second system resource application information of the third task in the second application, the system signature of the first application, and the system signature of the second application, where the historical power consumption of the third task is greater than or equal to a preset power consumption threshold. The allocation module 73 is further configured to execute the third task based on the system resources applied for based on the target historical system resource application information when the task type identifier corresponding to the third task in the second system resource application information is the same as the task type identifier of the first task and the system signature of the second application is the same as the system signature of the first application.
[0159] In a possible implementation manner, combined Figure 11 , such as Figure 13 shown, the system resource allocation device 70 provided in the embodiment of the present application further includes: a storage module 75. Before the obtaining module 71 obtains the first system resource application information of the first task in the first application, the obtaining module 71 is further configured to obtain at least one historical system resource application information corresponding to at least one fourth historical task and the power consumption corresponding to each fourth historical task, where the power consumption corresponding to each fourth historical task in the at least one fourth historical task is less than a preset power consumption threshold. The storage module 75 is configured to store the historical system resource application information corresponding to each fourth historical task and the power consumption in an associated manner to generate a first system resource information library; where one historical system resource application information corresponds to one historical power consumption.
[0160] In a possible implementation manner, the application architecture layer of the above electronic device includes a virtual machine; the obtaining module 71 is specifically configured to obtain the first system resource application information for the first application to execute the first task through the virtual machine.
[0161] In a possible implementation manner, the application architecture layer further includes: a power consumption monitoring service and a first system resource information library, and the first system resource information library is connected to the virtual machine; the determining module 72 specifically determines, through the power consumption monitoring service, the target historical system resource application information corresponding to the target task and matching the system resource information from the first system resource information library.
[0162] An embodiment of the present application provides a system resource allocation device. After the system resource allocation device obtains the first system resource application information of a first task with high power consumption, since it can find, from the first system resource information library, the target historical system resource application information corresponding to the target task that matches the system resource information in the first system resource application information and has the lowest historical power consumption, and perform a resource allocation operation on the first task; therefore, when the system resources applied for through the target historical system resource application information are used to execute the first task, it can be ensured that the power consumption of executing the first task is low power consumption, thereby reducing the power consumption of the system resource allocation device; moreover, it can be understood that by adjusting the system resources allocated to high-power tasks, power consumption management can be performed from the application and system levels. Thus, while reducing the power consumption of the system resource allocation device, the flexibility of the system resource allocation device for power consumption management is also improved.
[0163] The system resource allocation device in the embodiment of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than terminals. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. It may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiment of the present application does not make specific limitations.
[0164] The system resource allocation device in the embodiment of the present application may be a device with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems. The embodiment of the present application does not make specific limitations.
[0165] The system resource allocation device provided in the embodiment of the present application can implement each process implemented in the above method embodiment. To avoid repetition, it will not be elaborated here.
[0166] Optionally, as Figure 14As shown in the figure, an embodiment of the present application further provides an electronic device 90, which includes a processor 91 and a memory 92. A program or instruction that can run on the processor 91 is stored on the memory 92. When the program or instruction is executed by the processor 91, each step of the above-mentioned system resource allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here.
[0167] It should be noted that the electronic device in the embodiment of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.
[0168] Figure 15 It is a schematic diagram of the hardware structure of an electronic device for implementing an embodiment of the present application.
[0169] The electronic device 100 includes, but is not limited to: a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110 and other components.
[0170] Those skilled in the art can understand that the electronic device 100 may further include a power source (such as a battery) for supplying power to each component. The power source can be logically connected to the processor 110 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. Figure 15 The structure of the electronic device shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements, which will not be elaborated here.
[0171] Among them, the input unit 104 is used to obtain the first system resource application information for the first application to execute the first task. The historical power consumption of the first task is greater than or equal to a preset power consumption threshold. The first system resource application information includes: the system resource information required for the first task and the task parameter information required for the first task. The processor 110 is used to determine, from the first system resource information library, the target historical system resource application information corresponding to the target task that matches the system resource information when there is at least one piece of historical system resource application information corresponding to a second task stored in the first system resource information library; and based on the target historical system resource application information, perform system resource allocation for the first task; wherein, the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among at least one second task, and the historical system resource application information corresponding to a task includes the historical system resource information required for a task and the historical task parameter information required for a task.
[0172] Optionally, in the embodiments of the present application, the above first system resource application information further includes a task type identifier corresponding to the task type of the first task; the historical system resource application information corresponding to a task further includes a task type identifier corresponding to the task type of the task; the above processor 110 is further configured to determine, in the first system resource information library, the task indicated by the task type identifier of the first task as at least one second task.
[0173] Optionally, in the embodiments of the present application, the above input unit 104 is specifically configured to, when detecting that the running state of the first application is an idle running state, determine the historical tasks in the first application that meet the first condition as the first task, and obtain the historical system resource application information corresponding to the first task, where meeting the first condition means that the power consumption corresponding to the historical task is greater than or equal to a preset power consumption threshold.
[0174] Optionally, in the embodiments of the present application, the above processor 110 is further configured to, after determining, from the first system resource information library, the target historical system resource application information corresponding to the target task that matches the system resource information, replace the first system resource application information with the target historical system resource application information.
[0175] Optionally, in the embodiments of the present application, the above processor 110 is further configured to, after allocating system resources for the first task based on the target historical system resource application information, obtain the second system resource application information for the second application to execute the third task, the system signature of the first application, and the system signature of the second application, where the historical power consumption of the third task is greater than or equal to a preset power consumption threshold; and when the task type identifier corresponding to the third task in the second system resource application information is the same as the task type identifier of the first task, and the system signature of the second application is the same as the system signature of the first application, execute the third task based on the system resources applied for based on the target historical system resource application information.
[0176] Optionally, in the embodiments of the present application, the above processor 110 is further configured to, before obtaining the first system resource application information of the first task in the first application, obtain at least one historical system resource application information corresponding to at least one fourth historical task and the power consumption corresponding to each fourth historical task, where the power consumption corresponding to each fourth historical task is less than a preset power consumption threshold; and associatively store the historical system resource application information and the power consumption corresponding to each fourth historical task to generate a first system resource information library; where one historical system resource application information corresponds to one power consumption.
[0177] Optionally, in the embodiments of the present application, the application architecture layer of the above electronic device includes a virtual machine; the above processor 110 is specifically configured to obtain the first system resource application information for the first application to execute the first task through the virtual machine.
[0178] Optionally, in the embodiments of the present application, the above application architecture layer further includes: a power consumption monitoring service and a first system resource information library, and the first system resource information library is connected to the virtual machine; the processor 110 is specifically configured to determine, through the power consumption monitoring service, target historical system resource application information corresponding to the target task and matching the system resource information from the first system resource information library.
[0179] After the electronic device provided by the embodiments of the present application obtains the first system resource application information of the first task with high power consumption, since the target historical system resource application information corresponding to the target task that matches the system resource information in the first system resource application information and has the lowest historical power consumption can be found from the first system resource information library, a resource allocation operation is performed on the first task; therefore, when the first task is executed using the system resources applied for through the target historical system resource application information, it can be ensured that the power consumption for executing the first task is low power consumption, thereby reducing the power consumption of the electronic device; moreover, it can be understood that by adjusting the system resources allocated to high-power tasks, power consumption management can be performed at the application and system levels, so that while reducing the power consumption of the electronic device, the flexibility of the electronic device for power consumption management is also improved.
[0180] The electronic device provided by the embodiments of the present application can implement each process implemented by the above method embodiments and achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0181] For the beneficial effects of various implementation manners in this embodiment, reference may specifically be made to the beneficial effects of the corresponding implementation manners in the above method embodiments. To avoid repetition, it will not be elaborated here.
[0182] It should be understood that in the embodiments of the present application, the input unit 104 may include a Graphics Processing Unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. The other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, which will not be elaborated here.
[0183] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both a volatile and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 109 in the embodiments of the present application includes but is not limited to these and any other suitable types of memories.
[0184] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor may not be integrated into the processor 110 either.
[0185] The embodiments of the present application also provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0186] Among them, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs.
[0187] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above method embodiments and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0188] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0189] The embodiments of the present application provide a computer program product. The program product is stored in a storage medium and is executed by at least one processor to implement each process of the above system resource allocation method embodiments and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0190] It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article, or device. Without more limitations, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the reverse order according to the functions involved. For example, the described method may be executed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, the features described with reference to certain examples may be combined in other examples.
[0191] Through the description of the above embodiments, those skilled in the art can clearly understand that the above method of the embodiment can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0192] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.
Claims
1. A system resource allocation method, characterized in that: Executed by an electronic device, the method includes: Acquire first system resource application information for a first application program to execute a first task, wherein the historical power consumption of the first task is greater than or equal to a preset power consumption threshold, and the first system resource application information includes: system resource information required for the first task and task parameter information required for the first task; In the case where at least one historical system resource application information corresponding to the second task is stored in the first system resource information repository, determining target historical system resource application information corresponding to the target task and matching the system resource information from the first system resource information repository; Allocating system resources for the first task based on the target historical system resource application information; Among them, the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among the at least one second task, and the historical system resource application information corresponding to a task includes the historical system resource information required for the task and the historical task parameter information required for the task.
2. The method according to claim 1, characterized in that The first system resource application information also includes a task type identifier corresponding to the task type of the first task; the historical system resource application information corresponding to the one task also includes a task type identifier corresponding to the task type of the one task; The method further comprises: Determine the task indicated by the task type identifier of the first task in the first system resource information library as the at least one second task.
3. The method according to claim 1, characterized in that The obtaining of the first system resource application information of the first task of the first application program includes: When it is detected that the running state of the first application is idle, the historical task in the first application that meets the first condition is determined as the first task, and the historical system resource application information corresponding to the first task is obtained. The first condition is met when the power consumption corresponding to the historical task is greater than or equal to the preset power consumption threshold.
4. The method according to claim 3, characterized in that After determining the target historical system resource application information corresponding to the target task and matching the system resource information from the first system resource information library, the method further includes: The first system resource application information is replaced with the target historical system resource application information.
5. The method according to claim 1, characterized in that After allocating system resources for the first task based on the target historical system resource application information, the method further includes: Acquire second system resource application information of a second application executing a third task, a system signature of the first application, and a system signature of the second application, wherein the historical power consumption of the third task is greater than or equal to the preset power consumption threshold; When the task type identifier corresponding to the third task in the second system resource application information is the same as the task type identifier of the first task, and the system signature of the second application is the same as the system signature of the first application, the third task is executed based on the system resources applied for by the target historical system resource application information.
6. The method according to any one of claims 1 to 5, characterized in that Before obtaining the first system resource application information of the first task in the first application, the method further includes: Acquire at least one historical system resource application information corresponding to at least one fourth historical task and power consumption corresponding to each fourth historical task, wherein the power consumption corresponding to each fourth historical task is less than the preset power consumption threshold; The historical system resource application information and power consumption corresponding to each of the fourth historical tasks are associated and stored to generate the first system resource information library.
7. The method according to claim 1, characterized in that The application architecture layer of the electronic device includes a virtual machine; The obtaining of first system resource request information of the first application program executing the first task includes: The first system resource request information of the first application program executing the first task is obtained through the virtual machine.
8. The method according to claim 7, characterized in that The application architecture layer also includes: a power consumption monitoring service and the first system resource information library, wherein the first system resource information library is connected to the virtual machine; Determining the target historical system resource application information corresponding to the target task and matching the system resource information from the first system resource information library includes: The target historical system resource application information corresponding to the target task and matching the system resource information is determined from the first system resource information library through the power consumption monitoring service.
9. A system resource allocation device, characterized in that: The system resource allocation device comprises: an acquisition module, a determination module and an allocation module; The acquisition module is used to acquire first system resource application information for a first application program to execute a first task, the historical power consumption of the first task being greater than or equal to a preset power consumption threshold, and the first system resource application information including: system resource information required for the first task and task parameter information required for the first task; The determination module is used to determine, from the first system resource information repository, target historical system resource application information corresponding to the target task that matches the system resource information acquired by the acquisition module, when at least one historical system resource application information corresponding to the second task is stored in the first system resource information repository; The allocation module is used to allocate system resources for the first task based on the target historical system resource application information determined by the determination module; Among them, the task type of the second task is the same as the task type of the first task, the target task is the task with the lowest historical power consumption among the at least one second task, and the historical system resource application information corresponding to a task includes the historical system resource information required for the task and the historical task parameter information required for the task.
10. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the system resource allocation method according to any one of claims 1 to 8.
11. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the system resource allocation method according to any one of claims 1 to 8 are implemented.