Task processing method and device

By obtaining resource consumption information and device status information of pending tasks, determining the operating status of pending tasks and processing pending tasks, the problem of resource competition in electronic devices when processing background tasks is solved, and performance is improved.

CN119759516APending Publication Date: 2025-04-04VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411781654.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

When electronic devices deal with complex background tasks, they may lead to resource competition, resulting in insufficient memory resources of CPU, GPU, or NPU, and thus performance degradation.

Method used

By obtaining resource consumption information and device status information of pending tasks, the operation status of pending tasks is determined, and the pending tasks are processed when allowed to run, thereby avoiding resource competition.

Benefits of technology

Improve the performance of electronic devices when processing pending tasks in the background, and avoid performance degradation caused by insufficient resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759516A_ABST
    Figure CN119759516A_ABST
Patent Text Reader

Abstract

The present application discloses a task processing method, device, electronic device and readable storage medium, belonging to the technical field of electronic devices. The method comprises: obtaining resource consumption information and device status information of a task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating state of the electronic device; determining the operating state of the task to be processed based on the resource consumption information and the device status information; and processing the task to be processed when the operating state of the task to be processed is allowed to run.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of electronic equipment, and specifically relates to a task processing method and device. Background Art

[0002] With the development of electronic device technology, electronic devices can handle various complex tasks in the foreground and background at the same time. The resources consumed by different tasks and the events that occupy resources may not be consistent.

[0003] In the related art, when an electronic device processes a series of background tasks, it usually processes these background tasks in series. Since the hardware resources of the electronic device are limited, for example, the memory resources of the central processing unit (CPU), graphics processing unit (GPU), or embedded neural network processing unit (NPU), etc., when processing complex background tasks and processing foreground tasks at the same time, resource competition may occur.

[0004] Thus, as the complexity of the task increases, it may lead to insufficient CPU, GPU, or NPU memory resources, resulting in reduced performance of the electronic device. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a task processing method and device, which can improve the performance of an electronic device when processing tasks to be processed in the background.

[0006] In a first aspect, an embodiment of the present application provides a task processing method, which includes: obtaining resource consumption information and device status information of the task to be processed, the resource consumption information being used to characterize the amount of resources consumed in processing the task to be processed, and the device status information being used to characterize the current operating status of the electronic device; determining the operating status of the task to be processed based on the resource consumption information and the device status information; and processing the task to be processed when the operating status of the task to be processed is allowed to run.

[0007] In the second aspect, an embodiment of the present application provides a task processing device, which includes: an acquisition module, a determination module and a processing module; the acquisition module is used to acquire resource consumption information and device status information of the task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating status of the electronic device; the determination module is used to determine the operating status of the task to be processed based on the resource consumption information and device status information acquired by the acquisition module; the processing module is used to process the task to be processed when the operating status of the task to be processed determined by the determination module is allowed to run.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0009] In a 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] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0011] In a 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, resource consumption information and device status information of the task to be processed are obtained, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating state of the electronic device; based on the resource consumption information and the device status information, the operating state of the task to be processed is determined; and when the operating state of the task to be processed is allowed to run, the task to be processed is processed. In this scheme, the electronic device obtains the resource consumption information and the device status information of the task to be processed, and uses the computing power of the electronic device to determine the amount of resources consumed in processing the task to be processed, whether it can be run in the current operating state of the electronic device, and processes the task to be processed when the electronic device determines that the task to be processed is in the operating state, thereby avoiding competition between resources when there are multiple tasks to be processed, resulting in insufficient resources, and thus improving the performance of the electronic device in processing the tasks to be processed. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a flowchart of a task processing method provided in an embodiment of the present application;

[0014] Figure 2 It is a flowchart of a task processing method provided in an embodiment of the present application;

[0015] Figure 3 This is a schematic diagram of a task scheduling framework structure provided by an embodiment of the present application;

[0016] Figure 4 is a structural diagram of a task processing device provided in an embodiment of the present application;

[0017] Figure 5 is a structural diagram of a task processing device provided in an embodiment of the present application;

[0018] Figure 6 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;

[0019] Figure 7 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0021] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0022] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "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)".

[0023] The logo in this application refers to text, symbols, images, etc. used to indicate information. Logos or other containers can be used as carriers to display information, including but not limited to text logos, image logos, symbol logos, etc.

[0024] It should be noted that the task processing method provided in the embodiments of the present application can be executed by electronic devices such as mobile phones, tablet computers, laptop computers, PDAs, and vehicle-mounted electronic devices. In some embodiments of the present application, the task processing method provided in the embodiments of the present application is described by taking the electronic device as the execution subject to execute the task processing method as an example.

[0025] Since the hardware resources of electronic devices are limited, such as the resources of a CPU, a GPU, or an NPU, the tasks that the electronic device can process at the same time may exceed the capacity of the current electronic device hardware.

[0026] In the related art, one solution is to use a background processing method to run the processing of part of the tasks in the background. When running these tasks in the background, conflicts with the tasks being processed in the foreground may occur.

[0027] Specifically, electronic devices usually perform simple serial processing of a series of processing tasks in the background. This simple queue processing may lead to waste of system resources or bottlenecks when processing complex tasks. Or when processing with foreground tasks at the same time, resource competition may occur, resulting in slow memory allocation due to insufficient memory, or the performance of electronic devices may decline due to insufficient resources of the CPU, GPU, and NPU. This phenomenon becomes more obvious as the algorithm complexity increases and the computing power requirements increase.

[0028] Therefore, how to arrange the background to use limited resources when processing tasks, quickly process tasks, and achieve optimal performance of electronic devices becomes a key issue. In order to optimize the performance of electronic device systems, improve data processing efficiency and resource utilization, the embodiment of the present application provides a task processing method.

[0029] In the task processing method provided in the embodiment of the present application, the electronic device obtains the resource consumption information and device status information of the task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating state of the electronic device; then, based on the resource consumption information and the device status information, the operating state of the task to be processed is determined; and when the operating state of the task to be processed is allowed to run, the task to be processed is processed. In this scheme, the electronic device obtains the resource consumption information and the device status information of the task to be processed, and uses the computing power of the electronic device to determine the amount of resources consumed in processing the task to be processed, whether it can be run in the current operating state of the electronic device, and processes the task to be processed when the electronic device determines that the task to be processed is in the operating state, thereby avoiding competition between resources when there are multiple tasks to be processed, resulting in insufficient resources, and thus improving the performance of the electronic device in processing tasks to be processed.

[0030] The task processing method, device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0031] The execution subject of the task processing method provided in the embodiment of the present application may be a task processing device. Exemplarily, the task processing device may be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The task processing method provided in the embodiment of the present application will be exemplarily described below using an electronic device as an example.

[0032] The present application embodiment provides a task processing method. Figure 1 FIG. 1 is a flowchart of a task processing method provided by an embodiment of the present application, which can be applied to electronic devices. Figure 1 As shown, the task processing method provided in the embodiment of the present application may include the following steps 201 to 203.

[0033] Step 201: The electronic device obtains resource consumption information and device status information of a task to be processed.

[0034] In some embodiments of the present application, the above resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed.

[0035] In some embodiments of the present application, the resource consumption information includes at least one of the following:

[0036] The amount of memory used to process pending tasks.

[0037] Power consumption for processing pending tasks,

[0038] Process the temperature change value of the task to be processed,

[0039] Process the hardware load of the tasks to be processed.

[0040] Exemplarily, the memory size occupied by the above-mentioned processing of the task to be processed may be the memory size required by the electronic device when processing the task to be processed.

[0041] Exemplarily, the power consumption of processing the task to be processed may be the power value consumed by the electronic device when processing the task to be processed, or the remaining power value after consumption.

[0042] Exemplarily, the temperature change value for processing the task to be processed may be a rising value, a falling value, or a changed temperature value of the electronic device when processing the task to be processed.

[0043] Exemplarily, the hardware load condition of processing the task to be processed may be the load condition of a CPU, a GPU, or an NPU.

[0044] In some embodiments of the present application, the above-mentioned device status information is used to represent the current operating status of the electronic device.

[0045] In some embodiments of the present application, the electronic device can obtain device status information through a system status monitoring module.

[0046] In some embodiments of the present application, the device status information includes at least one of the following:

[0047] The current power of the electronic device,

[0048] The current temperature of the electronic device,

[0049] The current hardware load of the electronic device,

[0050] The current resource usage of electronic devices,

[0051] The current screen status of the electronic device.

[0052] Exemplarily, the current resource occupation of the electronic device may be the memory occupation size when all tasks of the current electronic device are processed.

[0053] Exemplarily, the current screen state of the electronic device may include a screen-off state or a screen-on state.

[0054] In this way, when determining the tasks to be processed, the electronic device not only calculates the amount of resources consumed by the tasks to be processed, but also further analyzes whether the tasks to be processed meet the current resource consumption situation by obtaining the current operating status of the electronic device, thereby improving the performance of the electronic device.

[0055] Step 202: The electronic device determines the running status of the task to be processed based on the resource consumption information and the device status information.

[0056] In some embodiments of the present application, the above-mentioned running status includes allowing running or waiting for running.

[0057] Exemplarily, the above-mentioned allowing to run means that the pending task can be run directly, that is, the pending task is processed.

[0058] Exemplarily, the above-mentioned waiting to run means that the pending task cannot be run at present, and it is necessary to wait until the running status is allowed to run before processing the pending task.

[0059] Exemplarily, the electronic device may include two queues when processing tasks, a waiting queue and a running queue. If the pending task is allowed to run, the pending task is added to the running queue; if the pending task is waiting to run, the pending task is added to the waiting queue.

[0060] In some embodiments of the present application, the electronic device calculates the resource consumption score of the task to be processed based on the resource consumption information of the task to be processed, and calculates the status score of the electronic device based on the device status information. When the resource consumption score of the task to be processed and the status score of the electronic device meet the executable condition, the task to be processed is determined to be in the allowed execution state; otherwise, when the resource consumption score of the task to be processed and the status score of the electronic device meet the non-executable condition, the task to be processed is determined to be in the waiting execution state.

[0061] Optionally, in some embodiments of the present application, the above step 202 can be specifically implemented by the following steps 202a and 202b, or steps 202a and 202c.

[0062] Step 202a: The electronic device calculates the resource consumption score of the task to be processed based on the resource consumption information through the task scheduling module, and calculates the status score of the electronic device based on the device status information through the task scheduling module.

[0063] In some embodiments of the present application, the resource consumption score is used to characterize the degree of resource consumption required for the electronic device to execute the task to be processed.

[0064] Exemplarily, the higher the resource consumption score is, the more resources the task to be processed consumes; conversely, the lower the resource consumption score is, the fewer resources the task to be processed consumes.

[0065] In some embodiments of the present application, the electronic device multiplies all resource consumption information by corresponding weight values ​​through a task scheduling module to calculate the resource consumption score of the task to be processed.

[0066] Exemplarily, the above resource consumption score = memory occupancy weight * task memory occupancy value + power consumption weight * task power consumption value + temperature rise weight * task temperature rise value + CPU load weight * task CPU load value + GPU load weight * task GPU load value + NPU load weight * task NPU load value +… + other weights * other parameter values.

[0067] In some embodiments of the present application, the above-mentioned state score is used to characterize the current operating environment of the electronic device.

[0068] Exemplarily, the higher the status score is, the better the current operating environment of the electronic device is; conversely, the lower the status score is, the worse the current operating environment of the electronic device is.

[0069] In some embodiments of the present application, the electronic device multiplies all device status information by corresponding weight values ​​through a task scheduling module to calculate a status score of the electronic device.

[0070] Exemplarily, the above status score = system memory weight * system memory available value + system CPU load weight * current system CPU load value + system GPU load weight * current system GPU load value + system NPU load weight * current system NPU load value + system power weight * system power value + system temperature weight * system temperature value +… + other weights * other parameter values.

[0071] In some embodiments of the present application, all the above-mentioned weight values ​​are used to characterize the influence of the corresponding parameter values ​​when the electronic device processes the task to be processed.

[0072] In some embodiments of the present application, all the above weight values ​​may be the default values ​​of the electronic device or may be user-defined.

[0073] Step 202b: When the resource consumption score is less than the product of the state score and the first weight, the electronic device determines that the running state of the task to be processed is allowed to run.

[0074] In some embodiments of the present application, the resource consumption score being less than the product of the state score and the first weight indicates that when the electronic device runs the task to be processed, it will not cause resource competition or insufficient resources, so the task to be processed can be run.

[0075] In some embodiments of the present application, the first weight may be a default value of the electronic device or may be user-defined.

[0076] Step 202c: when the resource consumption score is greater than or equal to the product of the state score and the first weight, the electronic device determines that the running state of the task to be processed is waiting to run.

[0077] In some embodiments of the present application, the resource consumption score being greater than or equal to the product of the state score and the first weight indicates that when the electronic device runs the task to be processed, it may cause resource competition or insufficient resources, so the task to be processed cannot be run.

[0078] Step 203: When the running status of the task to be processed is allowed to run, the electronic device processes the task to be processed.

[0079] In some embodiments of the present application, the electronic device processes the pending tasks through a task processing module.

[0080] Exemplarily, the task processing module is responsible for running the processing task. During the task running process, the resource consumption information of the task is also recorded, including memory usage, CPU, GPU, or NPU load, power consumption and temperature rise. After the task processing is completed, it is necessary to communicate with the task data statistics module and feed back the task resource consumption to the task data statistics module.

[0081] In the task processing method provided in the embodiment of the present application, the electronic device obtains the resource consumption information and device status information of the task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating state of the electronic device; then, based on the resource consumption information and the device status information, the operating state of the task to be processed is determined; and the task to be processed is processed if the operating state of the task to be processed is allowed to run. In this scheme, the electronic device obtains the resource consumption information and the device status information of the task to be processed, and uses the computing power of the electronic device to determine the amount of resources consumed in processing the task to be processed, whether it can be run in the current operating state of the electronic device, and processes the task to be processed if the electronic device determines that the task to be processed is in the operating state, thereby avoiding competition between resources when there are multiple tasks to be processed, resulting in insufficient resources, and thus improving the performance of the electronic device in processing tasks to be processed.

[0082] Optionally, in some embodiments of the present application, before the above step 201, Figure 1 ,like Figure 2 As shown, the task processing method provided in the embodiment of the present application may also include the following steps 301 and 302.

[0083] Step 301: The electronic device obtains the task type of the task to be processed.

[0084] In some embodiments of the present application, the above-mentioned task type may include at least one of the following: image processing, text editing processing, audio processing or computing processing.

[0085] Step 302: The electronic device obtains historical resource consumption information of the first task based on the task type of the task to be processed.

[0086] In some embodiments of the present application, the first task is a task of the same type as the task to be processed.

[0087] In some embodiments of the present application, the historical resource consumption information is the amount of resources consumed by the electronic device in processing the first task.

[0088] In some embodiments of the present application, the above historical resource consumption information includes at least one of the following:

[0089] The memory size occupied by processing the first task,

[0090] The power consumption of processing the first task,

[0091] Process the temperature change value of the first task,

[0092] Process the hardware load of the first task.

[0093] Optionally, in some embodiments of the present application, in combination with the above steps 301 and 302, the above step 201 "the electronic device obtains resource consumption information of the task to be processed" can be specifically implemented through the following step 201a.

[0094] Step 201a: The electronic device obtains resource consumption information of the task to be processed based on the task parameters and historical resource consumption information of the task to be processed through the task resource consumption calculation module.

[0095] In some embodiments of the present application, the above-mentioned task parameters are data contained in the task to be processed. If the task to be processed is image processing, the task parameters include image size, image pixel value or image clarity, etc.

[0096] In some embodiments of the present application, the task resource consumption calculation module evaluates and calculates the resource consumption information of the task to be processed based on the task type and task parameters, and with reference to the historical resource consumption information of the same type of tasks, namely the first task mentioned above.

[0097] In this way, the electronic device can use the task resource consumption calculation module to combine the resource consumption when processing the same task type, so as to calculate the resource consumption of the task to be processed more accurately.

[0098] Optionally, in some embodiments of the present application, before the above step 302, the task processing method provided by the embodiment of the present application may further include the following steps 401 and 402.

[0099] Step 401: The electronic device records resource consumption information of each task through a task data statistics module.

[0100] In some embodiments of the present application, the electronic device records the memory occupancy, CPU, GPU, or NPU load, power consumption value and temperature change value after each task is completed through a task data statistics module.

[0101] In step 402, the electronic device classifies and stores the resource consumption information of each task according to the task type of each task.

[0102] In some embodiments of the present application, the electronic device classifies each task according to the task type through a task data statistics module, and stores the resource consumption information of the same type of tasks in the same folder or the same storage address.

[0103] In this way, the electronic device can more quickly query the consumed resources of the same type as the task to be processed by classifying and storing the consumed resources of different task types.

[0104] The embodiment of the present application proposes a task scheduling framework to implement the task processing method provided by the embodiment of the present application. The task scheduling framework realizes the optimal allocation of resources and efficient execution of tasks by calculating and counting the resource requirements of tasks and combining intelligent scheduling algorithms.

[0105] The following is an example of a specific task scheduling framework to illustrate the task processing method provided in the embodiment of the present application.

[0106] Example 1: Figure 3 As shown, the task scheduling framework includes a task resource consumption calculation module 501 , a system status monitoring module 502 , a task data statistics module 503 , a task scheduling module 504 , and a task processing module 505 .

[0107] Task resource consumption calculation module 501: The main task of the task computing power calculation module 501 is to calculate the resource consumption of each task, that is, the above-mentioned resource consumption information.

[0108] Exemplarily, the electronic device first identifies the task type of the task to be processed, and then evaluates the resource consumption information of the task to be processed based on the task type of the task to be processed, task parameters of the task to be processed, such as image size or image pixel value, and referring to statistical data of previous tasks of the same task type.

[0109] Exemplarily, the resource consumption values ​​that need to be evaluated for each task include: memory usage, CPU / GPU / NPU load, power consumption, and temperature change.

[0110] Exemplarily, the statistical data of the tasks of the same task type are obtained through communication with the task data statistics module 503 .

[0111] System status monitoring module 502: The main task of the system status monitoring module 502 is to monitor the status of the electronic device system in the background so that the task scheduling module 504 can determine whether the current task to be processed can be run.

[0112] Exemplarily, the status of the electronic device system is mainly obtained by real-time monitoring of the electronic device's power level, screen off, hardware load, memory usage, temperature, charging status, and other status.

[0113] Task data statistics module 503: The main function of the task data statistics module 503 is to record, count and store the resource consumption information of all historically executed tasks in the electronic device.

[0114] Exemplarily, the resource consumption information of the tasks stored in the task data statistics module 503 is recorded and counted according to the task types.

[0115] Exemplarily, after each task is processed, the task data statistics module 503 needs to record the actual resource consumption information of the task, including memory usage, CPU / GPU / NPU load, power consumption, and temperature change. When calculating the amount of resources consumed by the task to be processed, the task resource consumption calculation module 501 will refer to the statistical data corresponding to the same task type in the task data statistics module 503.

[0116] Task scheduling module 504: The main work of the task scheduling module 504 is to schedule all tasks and decide when and what tasks should be processed.

[0117] Exemplarily, the task scheduling module 504 includes two queues, a waiting queue and a running queue. All pending tasks are initially placed in the waiting queue, and then when the task satisfies the resource consumption score of the pending task < the first weight * the status score of the electronic device, the pending task can be placed in the running queue and started to be processed.

[0118] Task processing module 505: Task processing module 505 is responsible for running tasks to be processed.

[0119] Exemplarily, the task processing module 505 needs to record the resource consumption information of the pending task during its operation, including memory usage, CPU / GPU / NPU load, power consumption, and temperature change. After the pending task is processed, it needs to communicate with the task data statistics module and feed back the task resource consumption to the task data statistics module.

[0120] In this way, electronic devices can efficiently utilize the hardware resources of electronic devices when processing tasks in the background by placing the task scheduling framework in the background to calculate the resource consumption information of the tasks to be processed, so that users can have a smooth user experience under different system load conditions. At the same time, the task scheduling framework not only improves the efficiency of background processing tasks and optimizes the performance of electronic devices, but also can balance the load well and improve the problems of temperature rise and high power consumption during the use of electronic devices.

[0121] Each of the above-mentioned method embodiments, or various possible implementation methods in each method embodiment can be executed separately, or any two or more of them can be executed in combination with each other. The specific implementation method can be determined according to actual usage requirements, and the embodiments of the present application do not limit this.

[0122] The window fuzzy processing method provided in the embodiment of the present application can be executed by an electronic device or a window fuzzy processing device. In the embodiment of the present application, the window fuzzy processing device executing the window fuzzy processing method is taken as an example to illustrate the window fuzzy processing device provided in the embodiment of the present application.

[0123] Figure 4 A possible structural diagram of a task processing device involved in an embodiment of the present application is shown. Figure 4 As shown, the task processing device 700 may include: an acquisition module 701 , a determination module 702 and a processing module 703 .

[0124] Among them, the above-mentioned acquisition module 701 is used to obtain the resource consumption information and device status information of the task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating status of the electronic device; the above-mentioned determination module 702 is used to determine the operating status of the task to be processed based on the resource consumption information and device status information obtained by the above-mentioned acquisition module 701; the above-mentioned processing module 703 is used to process the task to be processed when the operating status of the task to be processed determined by the above-mentioned determination module 702 is allowed to run.

[0125] Optionally, in some embodiments of the present application, the above-mentioned determination module 702 is specifically used to:

[0126] The task scheduling module calculates the resource consumption score of the task to be processed based on the resource consumption information obtained by the acquisition module 701, and the task scheduling module calculates the status score of the electronic device based on the device status information;

[0127] When the resource consumption score is less than the product of the state score and the first weight, determining the running state of the task to be processed as allowing running; or,

[0128] When the resource consumption score is greater than or equal to the product of the state score and the first weight, determining the running state of the task to be processed as waiting to run;

[0129] The resource consumption score is used to characterize the extent to which the electronic device consumes resources to execute the task to be processed, and the state score is used to characterize the current operating environment of the electronic device.

[0130] Optionally, in some embodiments of the present application, the above-mentioned acquisition module 701 is also used to obtain the task type of the task to be processed before obtaining the resource consumption information of the task to be processed; the above-mentioned acquisition module 701 is also used to obtain historical resource consumption information of the first task based on the task type of the task to be processed, the first task is a task of the same task type as the task to be processed, and the historical resource consumption information is the amount of resources consumed by the electronic device in processing the first task; the above-mentioned acquisition module 701 is specifically used to obtain the resource consumption information of the task to be processed based on the task parameters and historical resource consumption information of the task to be processed through the task resource consumption calculation module.

[0131] Optionally, in some embodiments of the present application, the resource consumption information includes at least one of the following:

[0132] The amount of memory used to process pending tasks.

[0133] Power consumption for processing pending tasks,

[0134] Process the temperature change value of the task to be processed,

[0135] Process the hardware load of the tasks to be processed.

[0136] Optionally, in some embodiments of the present application, combined with Figure 4 ,like Figure 5 As shown, the above-mentioned device 700 also includes: a storage module 704; the above-mentioned processing module 703 is also used to record the resource consumption information of each task through the task data statistics module before the above-mentioned acquisition module 701 obtains the historical resource consumption information of the first task based on the task type of the task to be processed; the above-mentioned storage module 704 is used to classify and store the resource consumption information of each task recorded by the above-mentioned processing module 703 according to the task type of each task.

[0137] Optionally, in some embodiments of the present application, the acquisition module 701 is specifically used to acquire device status information through a system status monitoring module;

[0138] The device status information includes at least one of the following:

[0139] The current power of the electronic device,

[0140] The current temperature of the electronic device,

[0141] The current hardware load of the electronic device,

[0142] The current resource usage of electronic devices,

[0143] The current screen status of the electronic device.

[0144] In the task processing device provided in the embodiment of the present application, the task processing device obtains the resource consumption information and device status information of the task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current running state of the task processing device; then, based on the resource consumption information and the device status information, the running state of the task to be processed is determined; and when the running state of the task to be processed is allowed to run, the task to be processed is processed. In this scheme, the task processing device obtains the resource consumption information and device status information of the task to be processed, and uses the computing power of the task processing device to determine the amount of resources consumed in processing the task to be processed, whether it can be run in the current running state of the task processing device, and processes the task to be processed when the task processing device determines that the task to be processed is in the running state, thereby avoiding competition between resources when there are multiple tasks to be processed, resulting in insufficient resources, and thus improving the performance of the task processing device in processing the tasks to be processed.

[0145] The task processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0146] The task processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0147] The task processing device provided in the embodiment of the present application can implement each process implemented in the task processing method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0148] Alternatively, if Figure 6 As shown, an embodiment of the present application also provides an electronic device 800, including a processor 801 and a memory 802, wherein the memory 802 stores programs or instructions that can be executed on the processor 801, and when the program or instructions are executed by the processor 801, the various steps of the above-mentioned task processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.

[0149] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0150] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0151] The electronic device 100 includes but is not limited to components such as 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.

[0152] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 7 The electronic device structure 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 certain components, or arrange the components differently, which will not be described in detail here.

[0153] Among them, the above-mentioned processor 110 is used to obtain resource consumption information and device status information of the task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating status of the electronic device; the above-mentioned processor 110 is used to determine the operating status of the task to be processed based on the above-mentioned resource consumption information and device status information; the above-mentioned processor 110 is used to process the task to be processed when the operating status of the task to be processed is allowed to run.

[0154] Optionally, in some embodiments of the present application, the processor 110 is specifically configured to:

[0155] Calculate the resource consumption score of the task to be processed based on the resource consumption information through the task scheduling module, and calculate the status score of the electronic device based on the device status information through the task scheduling module;

[0156] When the resource consumption score is less than the product of the state score and the first weight, determining the running state of the task to be processed as allowing running; or,

[0157] When the resource consumption score is greater than or equal to the product of the state score and the first weight, determining the running state of the task to be processed as waiting to run;

[0158] The resource consumption score is used to characterize the extent to which the electronic device consumes resources to execute the task to be processed, and the state score is used to characterize the current operating environment of the electronic device.

[0159] Optionally, in some embodiments of the present application, the above-mentioned processor 110 is also used to obtain the task type of the task to be processed before obtaining the resource consumption information of the task to be processed; the above-mentioned processor 110 is also used to obtain historical resource consumption information of the first task based on the task type of the task to be processed, the first task is a task of the same task type as the task to be processed, and the historical resource consumption information is the amount of resources consumed by the electronic device to process the first task; the above-mentioned processor 110 is specifically used to obtain the resource consumption information of the task to be processed based on the task parameters and historical resource consumption information of the task to be processed through the task resource consumption calculation module.

[0160] Optionally, in some embodiments of the present application, the resource consumption information includes at least one of the following:

[0161] The amount of memory used to process pending tasks.

[0162] Power consumption for processing pending tasks,

[0163] Process the temperature change value of the task to be processed,

[0164] Process the hardware load of the tasks to be processed.

[0165] Optionally, in some embodiments of the present application, combined with Figure 4 ,like Figure 5As shown, the above-mentioned device 700 also includes: a memory 109; the above-mentioned processor 110 is also used to record the resource consumption information of each task through a task data statistics module before obtaining the historical resource consumption information of the first task based on the task type of the task to be processed; the above-mentioned memory 109 is used to classify and store the resource consumption information of each task recorded by the above-mentioned processor 110 according to the task type of each task.

[0166] Optionally, in some embodiments of the present application, the processor 110 is specifically configured to obtain device status information through a system status monitoring module;

[0167] The device status information includes at least one of the following:

[0168] The current power of the electronic device,

[0169] The current temperature of the electronic device,

[0170] The current hardware load of the electronic device,

[0171] The current resource usage of electronic devices,

[0172] The current screen status of the electronic device.

[0173] In the electronic device provided in the embodiment of the present application, the electronic device obtains the resource consumption information and device status information of the task to be processed, the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating state of the electronic device; then, based on the resource consumption information and the device status information, the operating state of the task to be processed is determined; and when the operating state of the task to be processed is allowed to run, the task to be processed is processed. In this scheme, the electronic device obtains the resource consumption information and the device status information of the task to be processed, and uses the computing power of the electronic device to determine the amount of resources consumed in processing the task to be processed, whether it can be run in the current operating state of the electronic device, and processes the task to be processed when the electronic device determines that the task to be processed is in the operating state, thereby avoiding competition between resources when there are multiple tasks to be processed, resulting in insufficient resources, and thus improving the performance of the electronic device in processing tasks to be processed.

[0174] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video 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 a touch panel 1071 and at least one of 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. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0175] 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, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. 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 (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0176] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.

[0177] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned task processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0178] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0179] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned task processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0180] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0181] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned task processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0182] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other 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 reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0183] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0184] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A task processing method, applied to an electronic device, characterized in that: The method comprises: Acquire resource consumption information and device status information of the task to be processed, wherein the resource consumption information is used to characterize the amount of resources consumed in processing the task to be processed, and the device status information is used to characterize the current operating state of the electronic device; Determining the running status of the task to be processed based on the resource consumption information and the device status information; When the running status of the task to be processed is that the running is allowed, the task to be processed is processed.

2. The method according to claim 1, characterized in that The determining the running status of the task to be processed based on the resource consumption information and the device status information includes: Calculating the resource consumption score of the task to be processed based on the resource consumption information through a task scheduling module, and calculating the status score of the electronic device based on the device status information through the task scheduling module; In the case where the resource consumption score is less than the product of the state score and the first weight, determining that the running state of the task to be processed is allowed to run; or, When the resource consumption score is greater than or equal to the product of the state score and the first weight, determining that the running state of the task to be processed is waiting to run; The resource consumption score is used to characterize the degree of resource consumption required for the electronic device to execute the task to be processed, and the state score is used to characterize the current operating environment of the electronic device.

3. The method according to claim 1, characterized in that Before obtaining the resource consumption information of the task to be processed, the method further includes: Obtaining the task type of the task to be processed; Based on the task type of the task to be processed, acquiring historical resource consumption information of a first task, the first task being a task of the same task type as the task to be processed, and the historical resource consumption information being the amount of resources consumed by the electronic device in processing the first task; The obtaining of resource consumption information of the task to be processed includes: The resource consumption information of the task to be processed is obtained through a task resource consumption calculation module based on the task parameters of the task to be processed and the historical resource consumption information.

4. The method according to claim 3, characterized in that The resource consumption information includes at least one of the following: the memory size occupied by processing the pending tasks, the power consumption of processing the task to be processed, Processing the temperature change value of the task to be processed, Process the hardware load of the task to be processed.

5. The method according to claim 3, characterized in that: Before acquiring historical resource consumption information of the first task based on the task type of the task to be processed, the method further includes: Through the task data statistics module, the resource consumption information of each task is recorded; The resource consumption information of each task is classified and stored according to the task type of each task.

6. The method according to claim 1, characterized in that The obtaining of device status information includes: Obtaining the device status information through a system status monitoring module; The device status information includes at least one of the following: The current charge of the electronic device, the current temperature of the electronic device, The current hardware load of the electronic device, The current resource usage of the electronic device, The current screen status of the electronic device.

7. A task processing device, characterized in that: The task processing device comprises: an acquisition module, a determination module and a processing module; The acquisition module is used to acquire resource consumption information and device status information of the task to be processed, wherein the resource consumption information is used to represent the amount of resources consumed in processing the task to be processed, and the device status information is used to represent the current operating status of the electronic device; The determining module is used to determine the running status of the task to be processed based on the resource consumption information and the device status information acquired by the acquiring module; The processing module is used to process the task to be processed when the running status of the task to be processed determined by the determination module is that the running is allowed.

8. The device according to claim 7, characterized in that The determination module is specifically used for: Calculating, by a task scheduling module, a resource consumption score of the task to be processed based on the resource consumption information acquired by the acquisition module, and calculating, by a task scheduling module, a status score of the electronic device based on the device status information; In the case where the resource consumption score is less than the product of the state score and the first weight, determining that the running state of the task to be processed is allowed to run; or, When the resource consumption score is greater than or equal to the product of the state score and the first weight, determining that the running state of the task to be processed is waiting to run; The resource consumption score is used to characterize the degree of resource consumption required for the electronic device to execute the task to be processed, and the state score is used to characterize the current operating environment of the electronic device.

9. The device according to claim 7, characterized in that The acquisition module is further used to acquire the task type of the task to be processed before acquiring the resource consumption information of the task to be processed; The acquisition module is further used to acquire historical resource consumption information of a first task based on the task type of the task to be processed, the first task being a task of the same task type as the task to be processed, and the historical resource consumption information being the amount of resources consumed by the electronic device in processing the first task; The acquisition module is specifically used to acquire the resource consumption information of the task to be processed based on the task parameters of the task to be processed and the historical resource consumption information through the task resource consumption calculation module.

10. The device according to claim 7, characterized in that The device also includes: a storage module; The processing module is further configured to record the resource consumption information of each task through the task data statistics module before the acquisition module acquires the historical resource consumption information of the first task based on the task type of the task to be processed; The storage module is used to classify and store the resource consumption information of each task recorded by the processing module according to the task type of each task.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the task processing method according to any one of claims 1 to 6 are implemented.