Task management and control method, electronic equipment and computer readable storage medium

By adjusting the computing resource usage of high-frequency tasks in electronic devices, the problems of high-power consumption and performance degradation caused by abnormal high-load tasks are solved, power consumption savings and performance improvements are achieved, and user experience impact is avoided.

CN119292737APending Publication Date: 2025-01-10HONOR DEVICE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310841594.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-10
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The prior art cannot effectively solve the problems of high CPU power consumption and performance degradation caused by abnormally high load tasks, and traditional methods will affect the user experience, resulting in frequent crashes of applications.

Method used

By obtaining the operation information of the electronic device core, determine the target core for high-frequency operation, and adjust the computing resource usage of the task when specific conditions are met, reduce the CPU frequency, avoid directly stopping the task, and ensure user experience.

Benefits of technology

Without affecting the user experience, it saves system power consumption, reduces CPU power consumption and heat generation, and improves the working performance of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119292737A_ABST
    Figure CN119292737A_ABST
Patent Text Reader

Abstract

The invention provides a task management and control method, electronic equipment and a computer readable storage medium, and relates to the technical field of computers. The task management and control method is applied to the electronic equipment, and comprises the following steps: in response to first running information of a plurality of kernels, determining a target kernel in the plurality of kernels; wherein the first operation information is used for indicating the operation states of the plurality of kernels; obtaining a first task running in the target kernel, wherein the running duration of the first task is greater than or equal to a preset running duration; determining a CPU (Central Processing Unit) utilization rate of the first task; and under the condition that the CPU utilization rate meets a first condition, adjusting the computing power resource usage amount of the first task. After the electronic equipment determines that the first task needs to be managed and controlled, the computing power resource usage amount of the first task is modified, normal operation of the first task is guaranteed, the kernel operation frequency is effectively reduced, and therefore the power consumption of a CPU and the heating value of the electronic equipment are reduced under the condition that user experience is not affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] The operating system in current electronic devices prioritizes applications running in the central processing unit (CPU) and allocates processing resources to applications with higher priorities, thereby achieving resource allocation. For example, the current common control group (cgroups) technology provides a mechanism for task aggregation and division for the CPU core. Using this technology, electronic devices can divide the tasks being run by the operating system into different groups according to preset rules. Afterwards, the electronic device performs more refined resource control in terms of allocating, sorting, rejecting, managing and monitoring system resources based on the grouping results, thereby increasing the overall efficiency of the processor.

[0003] However, if the application priority corresponding to a task is high, but when the task is executed in the CPU, an infinite loop or other problems occur, then the CPU will prioritize the task in the infinite loop, causing the CPU to always be in a high-frequency and high-load operation state. The above-mentioned scheduling method based on grouping for resource division cannot solve the problem of high CPU power consumption and performance degradation caused by abnormally high-load tasks. Summary of the invention

[0004] In view of this, the present application provides a task control method, an electronic device, and a computer-readable storage medium, which obtains the operating information of the kernel in the electronic device to determine the target kernel running at a high frequency. Afterwards, when there is a task in the target kernel that runs for a long time and the task CPU usage rate meets the conditions, the electronic device adjusts the computing power resource usage of the task. Abnormal tasks running in the CPU can be effectively controlled, and the power consumption of the system can be saved without affecting the user experience, thereby improving the working performance of the electronic device.

[0005] In a first aspect, the present application provides a task management method, which is applied to an electronic device, and the method includes: determining a target core among the multiple cores in response to first operating information of multiple cores; wherein the first operating information is used to indicate the operating status of the multiple cores; obtaining a first task running in the target core, the running time of the first task being greater than or equal to a preset running time; determining a central processing unit (CPU) usage rate of the first task; and adjusting the computing power resource usage of the first task when the CPU usage rate meets a first condition.

[0006] Based on this, the electronic device can determine the target kernel based on the first operating information of the kernel. There is a high possibility that an abnormal task exists in the target kernel determined based on the first operating information, so the electronic device can continue to identify the first task that has been running for a long time in the target kernel to identify the task that needs to be controlled. Then, the CPU usage rate of the first task that needs to be controlled is determined, and it is further confirmed whether the first task needs to be controlled to accurately determine the control object. Then, the electronic device can effectively reduce the frequency of kernel operation by modifying the computing power resource usage of the abnormal task, thereby reducing the power consumption of the CPU and the heat generation of the electronic device.

[0007] In addition, during this process, the electronic device only modifies the computing resource usage of the first task and does not directly stop the first task. Therefore, this solution does not affect the user experience.

[0008] In a possible implementation of the first aspect, the running state includes a first running state and a second running state, the first running state indicates that the running frequency of the kernel is greater than or equal to the preset running frequency, and the second running state indicates that the running frequency of the kernel is less than the preset running frequency; in response to the first running information of the multiple kernels, determining the target kernel among the multiple kernels, including: determining, according to the first running information, the target kernel among the multiple kernels whose duration in the first running state accounts for more than a first ratio in the first cycle. If the kernel is in high-frequency running time for a long time, the kernel may be abnormal. In this way, the electronic device can accurately determine the target kernel with abnormality among the kernels by analyzing the running state of the electronic device.

[0009] In a possible implementation manner of the first aspect, the running state further includes a kernel usage rate, and the kernel usage rate of the target kernel is greater than or equal to a preset kernel usage rate.

[0010] Based on this, the electronic device can detect the non-idle running time of the core. After that, the electronic device calculates the ratio of the non-idle running time of the core to the total running time of the target core to obtain the usage rate of the core. If the calculated ratio is greater than a certain value, the electronic device can consider the core as the target core. In this way, the electronic device can accurately determine the target core with a higher busyness from the cores.

[0011] In a possible implementation of the first aspect, obtaining a first task running in a target kernel includes: sampling the target kernel according to a second period to obtain a plurality of sampling results; and determining the first task based on the sampling results, wherein the number of occurrences of the first task in the plurality of sampling results is greater than or equal to a preset number of times. Since a task running for a long time occupies a large number of running resources, if a task appears a large number of times in the sampling results, the task can be considered to be the first task running in the kernel for a long time.

[0012] In a possible implementation of the first aspect, the first task belongs to a foreground application. When the foreground application is running, it will occupy more computing resources, usage rate, etc. of the kernel, which has a greater impact on the operating performance of the kernel. Background applications generally only occupy a small part of the computing resources. Therefore, tasks belonging to foreground applications can be managed, that is, the first task belongs to the foreground task. Based on this, the electronic device can reduce unnecessary management and control operations and reduce the computing resources occupied by the electronic device management and control.

[0013] In a possible implementation manner of the first aspect, before determining the central processing unit CPU usage of the first task, the method further includes: determining that the first task is not an exempted task, and the electronic device does not limit the computing power resource usage of the exempted task.

[0014] Based on this, electronic devices can avoid controlling exempted tasks, thereby ensuring the stable operation of applications. In addition, electronic devices can also reduce unnecessary control operations and reduce the computing resources occupied by electronic device control.

[0015] In a possible implementation manner of the first aspect, the exempted tasks include one or more of tag infection tasks, tasks belonging to preset types of applications, and tasks pre-specified by a user.

[0016] In a possible implementation of the first aspect, determining a CPU usage rate of a central processing unit (CPU) of a first task includes: detecting a CPU usage rate of the first task to obtain a detection result;

[0017] The first condition includes that the CPU usage in the detection result is greater than or equal to a preset CPU usage.

[0018] In another possible implementation manner of the first aspect, determining a CPU usage rate of the first task includes:

[0019] Detecting the CPU usage of the first task to obtain multiple detection results;

[0020] The first condition includes that the number of detection results with CPU usage greater than or equal to a preset CPU usage is greater than or equal to a preset number, or a second ratio of the number of detection results with CPU usage greater than or equal to the preset CPU usage to the number of multiple detection results is greater than or equal to one of the second preset ratios.

[0021] In a second aspect, the present application provides an electronic device, which includes: a kernel high-frequency detection module, used to determine a target kernel among multiple kernels in response to first operating information of multiple kernels; wherein the first operating information is used to indicate the operating status of the multiple kernels; a first task determination module, used to obtain a first task running in the target kernel, the running time of the first task being greater than or equal to a preset running time; a task CPU usage detection module, used to determine the central processing unit CPU usage of the first task; and a computing power resource usage limiting module, used to adjust the computing power resource usage of the first task when the CPU usage meets the first condition.

[0022] In a third aspect, the present application provides an electronic device, comprising a memory and one or more processors; the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code comprises computer instructions; when the processor executes the computer instructions, the electronic device executes the method as in the first aspect and any possible design thereof.

[0023] When the processor executes the computer instructions, the electronic device executes: in response to first operating information of the multiple cores, determining a target core among the multiple cores; wherein the first operating information is used to indicate the operating status of the multiple cores; obtaining a first task running in the target core, wherein the running time of the first task is greater than or equal to a preset running time; determining a central processing unit (CPU) usage rate of the first task; and adjusting the computing resource usage of the first task when the CPU usage rate meets a first condition.

[0024] In a possible implementation manner of the third aspect, the running state includes a first running state and a second running state, the first running state indicates that the running frequency of the kernel is greater than or equal to a preset running frequency, and the second running state indicates that the running frequency of the kernel is less than the preset running frequency;

[0025] When the processor executes the computer instructions, it also causes the electronic device to perform:

[0026] According to the first operation information, a target core is determined, in which the proportion of the duration of being in the first operation state among the multiple cores in the first cycle exceeds the first ratio.

[0027] In a possible implementation manner of the third aspect, the running status further includes a kernel usage rate, and the kernel usage rate of the target kernel is greater than or equal to a preset kernel usage rate.

[0028] In a possible implementation of the third aspect, when the processor executes the computer instruction, the electronic device is further caused to execute: sampling the target core according to the second cycle to obtain a plurality of sampling results;

[0029] The first task is determined based on the sampling results, and the number of times the first task appears in the plurality of sampling results is greater than or equal to a preset number.

[0030] In a possible implementation manner of the third aspect, the first task belongs to a foreground application.

[0031] In a possible implementation manner of the third aspect, when the processor executes the computer instruction, it also causes the electronic device to execute: determining that the first task does not belong to the exempted task, and the electronic device does not limit the computing power resource usage of the exempted task.

[0032] In a possible implementation manner of the third aspect, the exempted tasks include one or more of tag infection tasks, tasks belonging to preset types of applications, and tasks pre-specified by a user.

[0033] In a possible implementation of the third aspect, when the processor executes the computer instruction, it also causes the electronic device to execute: detecting the CPU usage of the first task to obtain a detection result; the first condition includes that the CPU usage in the detection result is greater than or equal to a preset CPU usage.

[0034] In another possible implementation of the third aspect, when the processor executes computer instructions, it also causes the electronic device to perform: detecting the CPU usage of the first task to obtain multiple detection results; the first condition includes that the number of detection results in which the CPU usage is greater than or equal to a preset CPU usage is greater than or equal to a preset number, or a second ratio of the number of detection results in which the CPU usage is greater than or equal to the preset CPU usage to the number of multiple detection results is greater than or equal to one of the second preset ratios.

[0035] In a fourth aspect, the present application provides a computer-readable storage medium, comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect and any possible design thereof.

[0036] In a fifth aspect, the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the method described in the first aspect and any possible design thereof.

[0037] In a sixth aspect, the present application provides a device, which is included in an electronic device, and the device has the function of implementing the behavior of the electronic device in any of the methods in the first aspect and possible implementation methods. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes at least one module or unit corresponding to the above function. For example, a detection module or unit, a judgment module or unit, a restriction module or unit, and a storage module or unit, etc.

[0038] It can be understood that the electronic device described in the second aspect and any possible design thereof, the electronic device described in the third aspect and any possible design thereof, the computer-readable storage medium described in the fourth aspect, and the computer program product described in the fifth aspect are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of an electronic device provided in an embodiment of the present application;

[0040] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0041] Figure 3 A software structure block diagram of an electronic device provided in an embodiment of the present application;

[0042] Figure 4 A flowchart of a task control method provided in an embodiment of the present application;

[0043] Figure 5 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application;

[0044] Figure 6 A schematic diagram of a display interface of an electronic device provided in an embodiment of the present application;

[0045] Figure 7 A schematic diagram of a display interface of another electronic device provided in an embodiment of the present application;

[0046] Figure 8 A flowchart of another task control method provided in an embodiment of the present application;

[0047] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0049] When a user uses an electronic device to run an application, if the application has the following situations, for example, the application runs abnormally, there is an ultra-high load business in the application, etc., the CPU in the electronic device will think that the computing power resources currently allocated to the application are insufficient, so the CPU allocates more computing power resources to the application through resource scheduling. Since the application that has an abnormality in the above process is still in an abnormal running state, and the abnormal running state has not been released, the CPU is always in a high-frequency and high-load running state. The above process will cause a sharp increase in system power consumption, causing the temperature of the electronic device to rise and the standby time to decrease. Moreover, if all the cores in the CPU are occupied, the electronic device may also freeze in operation, resulting in low working performance of the electronic device. At present, in order to deal with the high power consumption problem of electronic devices caused by abnormal application operation, the electronic device will first determine the application with abnormal power consumption, and then directly close the application with abnormal power consumption. However, such a solution will cause the application to flash back, and the user experience is poor. If the problem recurs, it will also cause frequent flashbacks and the application cannot be used, which is difficult to be accepted by users.

[0050] In order to solve the above technical problems, an embodiment of the present application provides a task control method, which identifies abnormal tasks running in the core of the CPU by detecting the usage rate of the core and the usage rate of the running tasks. Afterwards, the electronic device can limit the usage of the CPU by the abnormal tasks, reduce the occupation of the CPU computing resources by the abnormal tasks, so that the CPU adjusts the frequency of the CPU accordingly based on the usage after the limit, and realizes effective core operating frequency control. In this way, the abnormal tasks running in the CPU can be effectively controlled, and the power consumption of the system can be saved without affecting the user experience, and the working performance of the electronic device can be improved.

[0051] The task control method provided in the embodiment of the present application can be applied to the electronic device 100. For example, Figure 1 As shown, the electronic device 100 can be a mobile phone 11, a tablet computer 12, a smart screen 13, a laptop computer 14, a vehicle-mounted device, a wearable device (such as a smart watch), an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an artificial intelligence device, and other terminal devices. The operating system installed in the electronic device 100 includes but is not limited to Or other operating systems. The embodiment of the present application does not limit the specific type of the electronic device 100 and the installed operating system.

[0052] Figure 2 The schematic diagram of the structure of the electronic device 100 is shown. The electronic device 100 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295. It can be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0053] The processor 210 may include one or more processing units, for example, the processor 210 may include a CPU, an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0054] Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions. A memory can also be set in the processor 210 for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory can save instructions or data that the processor 210 has just used or circulated. If the processor 210 needs to use the instruction or data again, it can be directly called from the memory. Repeated access is avoided, the waiting time of the processor 210 is reduced, and the efficiency of the system is improved.

[0055] In some embodiments, the CPU is the computing and control core of the electronic device 100, which is used for information processing and running programs. The kernel is the core of the CPU, and a CPU can have one or more kernels. For example, the kernel of the CPU may include one or more of the CPU large core (which may be referred to as the large core for short), the CPU medium core (which may be referred to as the medium core for short), or the CPU small core (which may be referred to as the small core for short). In a heterogeneous architecture including large cores, medium cores, and small cores, there are differences in performance and processing power between the large cores, medium cores, and small cores. Relatively speaking, the large core has the highest processing power and the strongest performance, the medium core has the second-best processing power and performance, and the small core has the lowest processing power and the weakest performance. Among them, performance can be reflected by computing power or by energy consumption, which is not limited here.

[0056] The operating frequency of the core refers to the operating frequency of the core when it is operating, and the unit is Hertz (Hz). The operating frequency of the core determines the operating speed of the CPU and is one of the indicators that affect the performance of the CPU. Generally speaking, the higher the operating frequency of the core, the shorter the instruction processing cycle, and the less time the core consumes to complete the same number of instructions. Correspondingly, the higher the operating frequency of the core, the more instructions the core can process per unit time, and it can be considered that the core has greater capabilities. Therefore, the higher the maximum operating frequency of the core, the faster the maximum operating speed of the core, which means that the performance of the CPU is better.

[0057] The kernel load refers to the average number of tasks (such as the number of threads, the number of processes, etc.) that the kernel is processing and waiting to be processed over a period of time.

[0058] The kernel utilization rate refers to the proportion of time that the kernel is running in a non-idle state. The kernel utilization rate can reflect how busy the kernel is. For example, if a kernel in a CPU runs in a non-idle state for 0.7 seconds within 1 second, the kernel utilization rate of the CPU is 70%. In some examples, a high kernel utilization rate does not necessarily mean that the kernel load is large. For example, if a thread needs to use a kernel in the CPU for calculation all the time, then the kernel utilization rate of the CPU is 100%, but the CPU load is 1. For another example, if a kernel executes two threads at the same time and there is no idle time during the running process. At this time, the kernel utilization rate is still 100%, but the load becomes 2.

[0059] The CPU usage of a task can reflect the CPU usage of the task. For example, in the above example, within 1s, the idle state running time is 0.7s and the non-idle state running time is 0.3s. Among them, the kernel executes two tasks during the non-idle state running time, among which Task 1 takes 0.2s to execute and Task 2 takes 0.1s to execute. Then the CPU usage of Task 1 is 20% (that is, 0.2s divided by 1s is equal to 20%), and the CPU usage of Task 2 is 10% (that is, 0.1s divided by 1s is equal to 10%).

[0060] Computing resource usage refers to the amount of core computing resources occupied. The core usage of a task refers to the computing resources occupied when the task runs on the core.

[0061] In some embodiments, the electronic device can calculate the computing resource usage based on the per-entity load tracking (PELT) algorithm. The calculated computing resource usage is used to indicate the usage of a task on the kernel, which can indicate the size of the task, also known as the load contribution to the kernel. Therefore, the calculated computing resource usage can currently be used to assist the kernel scheduler in controlling the kernel operating frequency.

[0062] In some examples, the kernel scheduler can increase the operating frequency of the kernel running the task with large computing resource usage so that the task can be processed faster and more timely. For example, if the computing resource usage of task A running on kernel 1 is 1024, and the computing resource usage of task B running on kernel 2 is 500. Then, the kernel scheduler can adjust the operating frequency of kernel 1 to 2.0 GHz and the operating frequency of kernel 2 to 1.0 GHz, so that kernel 1 can quickly process task A.

[0063] In some embodiments, the hardware characteristics of the CPU determine the maximum operating frequency and the minimum operating frequency of each core in the CPU. In the current operating mechanism of the core, the actual operating frequency of the core is generally adjusted based on the current load of the core. For example, if the load of the core increases, the operating frequency of the core can be increased so that the core can process the tasks being processed and the tasks waiting to be processed as soon as possible. In other words, by increasing the operating frequency of the core, it can be ensured that the core processes the tasks in a timely manner.

[0064] The task control method provided in the embodiment of the present application can determine whether an abnormal task occurs based on the CPU usage of each task when the kernel usage rate is high. Afterwards, the electronic device can limit the computing power resource usage of the abnormal task, thereby reducing the occupation of the kernel computing power resources by the abnormal task, thereby reducing the operating frequency of the kernel. In this way, the abnormal tasks running in the CPU can be effectively controlled, and the power consumption of the system can be saved without affecting the user experience, and the working performance of the electronic device can be improved.

[0065] In some embodiments, the processor 210 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0066] In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0067] The charging management module 240 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 240 may receive charging input from a wired charger through the USB interface 230. In some wireless charging embodiments, the charging management module 240 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 240 is charging the battery 242, it may also power the electronic device through the power management module 241.

[0068] The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the external memory, the display screen 294, the camera 293, and the wireless communication module 260. The power management module 241 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 241 can also be set in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 can also be set in the same device.

[0069] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.

[0070] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0071] The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.

[0072] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is transmitted to the application processor. The application processor outputs a sound signal through an audio device, or displays an image or video through the display screen 294.

[0073] The wireless communication module 260 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 260 can be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 210. The wireless communication module 260 can also receive the signal to be sent from the processor 210, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0074] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0075] The electronic device 100 implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs that execute program instructions to generate or change display information.

[0076] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLED, Micro-OLED, quantum dot light-emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 294, where N is a positive integer greater than 1.

[0077] The electronic device 100 can realize the shooting function through the ISP, the camera 293, the video codec, the GPU, the display screen 294 and the application processor.

[0078] The camera 293 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. In some embodiments, the electronic device 100 may include 1 or N cameras 293, where N is a positive integer greater than 1.

[0079] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0080] The internal memory 221 can be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 221. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0081] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the headphone jack 270D, and the application processor.

[0082] The sensor module 280 in the electronic device 100 may include a pressure sensor 280A, a touch sensor 280K, and the like.

[0083] The pressure sensor 280A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 280A can be set on the display screen 294. There are many types of pressure sensors 280A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 280A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 294, the electronic device 100 detects the touch operation intensity according to the pressure sensor 280A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 280A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0084] The touch sensor 280K is also called a "touch panel". The touch sensor 280K can be set on the display screen 294, and the touch sensor 280K and the display screen 294 form a touch screen, also called a "touch screen". The touch sensor 280K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. In other embodiments, the touch sensor 280K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 294.

[0085] The key 290 includes a power key, a volume key, etc. The key 290 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0086] Indicator 292 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0087] The SIM card interface 295 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 295 or pulling it out from the SIM card interface 295. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 295 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 295 can also be compatible with different types of SIM cards. The SIM card interface 295 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0088] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Taking the system as an example, the software structure of the electronic device 100 is exemplified.

[0089] Figure 3 1 is a software structure diagram of the electronic device 100 of an embodiment of the present invention. The electronic device layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, The system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime ( runtime) and system libraries, as well as the kernel layer.

[0090] The application layer can include a series of application packages.

[0091] like Figure 3 As shown, the application package may include applications such as camera, gallery, calendar, call, map, resource management, WLAN, Bluetooth, music, video, short message, resource management, etc.

[0092] Resource management can provide the function of resource management for the CPU. In some examples, resource management can control the tasks of the CPU based on pre-set rules. In other examples, resource management can control the tasks of the CPU based on user operations. For details, please refer to the following embodiments and related diagrams, which will not be repeated here.

[0093] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0094] like Figure 3 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, a kernel scheduler, and the like.

[0095] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0096] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0097] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0098] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).

[0099] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0100] The kernel scheduler can allocate CPU resources according to the resource management regulations. For example, the electronic device can use the kernel scheduler to increase the operating frequency of the kernel according to the number of tasks being executed by the kernel, thereby ensuring that the kernel can quickly complete the task processing. For another example, the electronic device can use the kernel scheduler to limit the computing power resource usage of a certain task being executed.

[0101] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0102] Runtime includes core libraries and virtual machines. The runtime is responsible for scheduling and management of the Android system.

[0103] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0104] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0105] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0106] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0107] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0108] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0109] A 2D graphics engine is a drawing engine for 2D drawings.

[0110] The kernel layer is the layer between hardware and software. The kernel layer includes the kernel subsystem and the driver subsystem. The kernel subsystem includes at least one kernel, for example, Kernel or other system kernels. Among them, the driver subsystem at least includes display driver, camera driver, audio driver, and sensor driver.

[0111] In some embodiments, the software structure of the electronic device can be divided into user space and kernel space. The kernel space is an area accessed by the operating system kernel, which is independent of ordinary applications and is a protected memory space. The user space is an area accessible to ordinary applications. Figure 3 As shown, the user space includes the application layer, the application framework layer, and the system library, and the kernel space includes the kernel layer.

[0112] The following is a detailed introduction to the task management method provided in the embodiment of the present application in conjunction with the scenario in which an electronic device runs an application.

[0113] In some embodiments, if the core of the electronic device is at a high operating frequency for a long time, the electronic device can detect the core usage of each core. When it is detected that the core usage of the core exceeds the preset threshold ThA, it can be preliminarily determined that an abnormal thread may be running on the core. The electronic device can sample the core multiple times according to a certain sampling period and sampling number. If the electronic device finds that a thread A appears multiple times in multiple sampling results, it can be considered that the thread A may be a high-load thread. Afterwards, the electronic device can detect the CPU usage of the thread A when it is determined that the thread A belongs to the foreground application. If the CPU usage of thread A is greater than or equal to the preset threshold ThB, the electronic device can consider thread A to be a high-load thread, and the electronic device can continue to determine whether thread A belongs to an exempt thread. If the electronic device determines that thread A is not an exempt thread, the electronic device can reduce the CPU occupation of abnormal thread A by modifying the CPU computing resource usage of thread A, and effectively control the core operating frequency.

[0114] In addition, since the CPU occupancy by the abnormal thread A is reduced, the power consumption of the CPU can also be reduced, the heating of the electronic device can be reduced, and the working performance of the electronic device can be improved.

[0115] Optionally, the exempted thread is, for example, a high-load thread that is preconfigured in the electronic device and allowed to run.

[0116] like Figure 4 As shown, the embodiment of the present application provides a task control method, comprising the following steps:

[0117] Step S401: The electronic device detects the high-frequency operation time ratio of each core according to a preset period T.

[0118] In some embodiments, the electronic device may detect the operating frequency of each core according to a preset period T. If the operating frequency of the core is greater than or equal to the preset operating frequency, the electronic device may consider that the core is in a high-frequency operating state. If within the preset period T, the ratio of the duration of the core in the high-frequency operating state to the total detection duration is greater than or equal to a preset threshold value ThC, the electronic device may consider that the core is in a high-frequency operating state for a long time, and the core may be abnormal.

[0119] For example, there are two cores in the electronic device, including core 1 and core 2. The electronic device detects the operating frequency of core 1 once every 5 seconds, and the total detection time is 2 seconds. If the detection finds that the operating frequency of core 1 is greater than or equal to the preset operating frequency for 1.5 seconds, it can be determined that the high-frequency operating time of core 1 accounts for 75%. The electronic device detects the operating frequency of core 2 once every 5 seconds, and the total detection time is 2 seconds. If the detection finds that the operating frequency of core 2 is greater than or equal to the preset operating frequency for 0.5 seconds, it can be determined that the high-frequency operating time of core 2 accounts for 25%.

[0120] Some examples include Figure 5 As shown, the electronic device can detect the high-frequency running time ratio of the kernel through the kernel high-frequency detection module in the kernel space.

[0121] Step S402: In response to the high-frequency operation time ratio of the target core being greater than or equal to a preset threshold value ThC, the electronic device detects the usage rate of the target core.

[0122] In some embodiments, the target kernel is a kernel whose high-frequency operation time is greater than or equal to a preset threshold value ThC as determined based on the detection in step S401. For example, the preset threshold value ThC is 60%, and it is detected that the high-frequency operation time of kernel 1 is 75%, and the high-frequency operation time of kernel 2 is 25%. It can be determined that the target kernel is kernel 1.

[0123] In some embodiments, the electronic device detects the usage rate of the target kernel to determine the busyness of the target kernel. In some examples, the electronic device can detect the non-idle running time of the target kernel. Afterwards, the electronic device calculates the ratio of the non-idle running time of the target kernel to the total running time of the target kernel to obtain the usage rate of the target kernel. For example, if the non-idle running time of the target kernel is 1.9s and the total running time of the target kernel is 2s, the usage rate of the target kernel is calculated to be 95%.

[0124] Some examples include Figure 5 As shown, the electronic device can detect the usage rate of the target core through the core high frequency detection module in the core space.

[0125] Step S403: In response to the usage rate of the target core being greater than or equal to the preset threshold ThA, the electronic device samples the task currently running in the target core M times according to a preset sampling interval.

[0126] Wherein, M times is a preset sampling number, and the value of M is a positive integer greater than or equal to 2.

[0127] In some embodiments, in step S402, based on the fact that the high-frequency operation time of the target kernel accounts for a proportion greater than or equal to a preset threshold value ThC, it can be determined that the target kernel is in a high-frequency operation state for a long time. Through step S403, the electronic device detects that the usage rate of the target kernel is greater than or equal to the preset threshold value ThA, indicating that the target kernel is in a relatively busy working state. In this way, it can be explained that the target kernel is in a high-frequency operation state for a long time, and there is a high possibility that an abnormal task exists in the target kernel. At this time, the electronic device can further sample the tasks in the target kernel to determine whether there are abnormal tasks in the kernel.

[0128] In some examples, the electronic device can sample the tasks running in the target kernel to identify whether the tasks running in the kernel are abnormal tasks. Among them, the abnormal tasks can be threads, processes, process groups and other different types of management entities, and the specific task type can be determined based on the actual scenario. In some scenarios, abnormal tasks include, for example, a single thread in a dead loop state, a single thread with a long file compression, etc. For example, due to problems in the development process of a third-party application A, when the third-party application A is running in an electronic device, a thread will have a dead loop, and the thread dead loop will cause the CPU to be in a high-frequency and high-load operating state. Therefore, it is necessary to use the above method to identify these dead loop threads as abnormal tasks.

[0129] Some examples include Figure 5 As shown, the electronic device detects through the kernel high-frequency detection module in the kernel space that the kernel is in a high-frequency operation state for a long time, and the usage rate of the kernel is greater than or equal to the preset threshold ThA, then the thread sampling module in the kernel space can be used to sample the threads running in the kernel.

[0130] Step S404: In response to the number of times n that task A appears in multiple sampling results being greater than or equal to the preset number N, the electronic device determines whether task A belongs to a task in the foreground application. If so, execute the following step S405; if not, end the task control process.

[0131] Wherein, N is a positive integer less than or equal to M.

[0132] In some embodiments, when the electronic device samples the task currently running in the target kernel, it can sample according to the predicted sampling interval, and when the number of samplings is M, the sampling process ends. Afterwards, the electronic device determines the tasks that appear in the M samplings and the number of times the tasks appear. Taking the task as a thread as an example, if a thread A runs for a long time in the target kernel, then the thread A will occupy a longer running time of the target kernel. Therefore, by performing multiple samplings according to the preset sampling interval, and based on the number of times thread A appears in the sampling results, it can be accurately determined whether the thread A runs for a long time in the target kernel. Afterwards, the electronic device determines whether the thread A belongs to the thread in the foreground application.

[0133] For example, the electronic device performs sampling at a sampling interval of 400 ms, and performs sampling 5 times in total. If the number of times thread A appears in the sampling result exceeds 3 times, thread A is considered to be a long-running high-load thread.

[0134] In some embodiments, the electronic device can determine whether task A belongs to a task in the foreground application in response to the number of times n that task A appears in multiple sampling results being greater than or equal to the preset number of times N, so as to determine whether task A needs to be managed and controlled. Generally, when the foreground application is running, it will occupy more computing resources, usage rate, etc. of the kernel, which has a greater impact on the operating performance of the kernel. However, the background application generally only occupies a small part of the computing resources, and when the background application occupies more computing resources and usage rate of the kernel, the kernel will close the background application in order to ensure the normal operation of the foreground application. Therefore, after sampling and finding that thread A is a high-load thread running for a long time, the electronic device continues to determine whether thread A is a foreground application to determine whether it is necessary to more accurately control thread A that causes the kernel to be in a high-frequency running state for a long time and has a high kernel usage rate. Based on this, the electronic device can reduce unnecessary control operations and reduce the computing resources occupied by electronic device control.

[0135] In some examples, if the electronic device determines that thread A belongs to the application currently running in the foreground, thread A can be recorded and recorded in the thread control list. Afterwards, the electronic device can monitor the running status of all threads in the thread control list to determine whether it is necessary to control the threads in the thread control list based on the monitoring results. For example, all threads in the thread control list are threads in a controlled state. The electronic device can continuously detect the running status of each thread and update and maintain the thread control list based on the running status of the thread. If the electronic device detects that the thread is dead, the CPU usage of the thread drops below the preset threshold ThB, or the application corresponding to the thread changes from the foreground running state to the background running state, or the screen of the electronic device is turned off, or the kernel affinity corresponding to the thread is reset, the thread can be deleted from the thread control list to stop the control of the thread.

[0136] The situation where the kernel affinity corresponding to the thread is reset includes, for example, reassigning a new kernel to the thread and reconfiguring the affinity of the thread to the new kernel.

[0137] Optionally, the electronic device may continuously detect the running status of each thread recorded in the thread control list according to a preset monitoring period.

[0138] Optionally, if the electronic device determines that thread A does not belong to the foreground application currently running in the foreground, the electronic device may stop the subsequent detection steps for thread A.

[0139] Some examples include Figure 5 As shown, the electronic device samples the threads running in the kernel through the thread sampling module in the kernel space, and the thread sampling module can send the sampling results to the abnormal thread reporting module. The electronic device determines the abnormal thread based on the sampling results through the abnormal thread reporting module, and sends the abnormal thread to the foreground thread identification module in the user space, so as to determine whether the abnormal thread belongs to the abnormal thread of the foreground application through the foreground thread identification module.

[0140] Optionally, the foreground application running in the foreground may be an application corresponding to the interface currently displayed on the display screen of the electronic device. It should be noted that the screen content of the foreground application may include not only the screen visible to the user, but also the content without user interface, the content of transparent layer, or the content that is blocked by other application interfaces and is invisible to the user. The operation of these screen contents corresponds to the running threads.

[0141] In some examples, if the electronic device determines that thread A belongs to the foreground application currently running in the foreground, the electronic device can continue to determine whether thread A needs to be controlled through the following steps to more accurately identify the tasks that need to be controlled.

[0142] In response to task A belonging to a task in a foreground application, the electronic device executes the following step S405 to further determine whether thread A needs to be managed.

[0143] Step S405: Determine whether Task A is an exempted task. If not, execute the following step S406; if yes, end the task control process.

[0144] In some embodiments, an exempt task refers to whether the task has exemption. If task A is thread A, and thread A has exemption, it means that the normal operation of thread A will cause the kernel to be in a high-frequency operation state for a long time, and cause the kernel usage rate to be high. Then the electronic device can not control thread A with exemption, so as to ensure the stable operation of the application. If thread A does not have exemption, it means that the normal operation of thread A will not cause the kernel to be in a high-frequency operation state for a long time, and cause the kernel usage rate to be high. Then the electronic device can control thread A that does not have exemption, so as to ensure that the computing power resources occupied by thread A in the kernel are released, and ensure that the power consumption and performance of the electronic device are not affected by thread A.

[0145] In some examples, whether task A has exemptions can be determined based on a user's selection.

[0146] like Figure 6 In the setting interface of a certain application A shown in (a) of FIG. 1 , a resource management control 61 may be displayed. In response to a user clicking operation on the resource management control 61, the electronic device displays the following Figure 6 The interface shown in (b). Figure 6 The interface shown in (b) includes an exemption protection control 62. Figure 6 In the interface shown in (b), the exemption protection control 62 is in the off state. At this time, when the application A is running in the foreground, the task A is thread A, and the thread A does not have the exemption right. That is, in the above step S405, the electronic device can determine that the thread of the application A running in the foreground is not an exempt thread. The electronic device can perform subsequent management and control on the thread of the application A. In response to the user's click operation on the exemption protection control 62, the electronic device displays the following Figure 6 In the interface shown in (c), Figure 6 In the interface shown in (c), the exemption protection control 62 is in the on state. At this time, the thread of the application A running in the foreground has the exemption. That is to say, in the above step S405, the electronic device can determine that the thread of the application A running in the foreground is an exempt thread, and the electronic device will no longer perform subsequent control processing on the thread of the application A.

[0147] In some examples, whether task A has exemption can be automatically identified based on the type of application or task. In some scenarios, task A is thread A. The electronic device can determine whether the type of application corresponding to the thread is a preset application type. For example, the preset application type is a game type, a video type, or a music type, etc. For example, the electronic device determines that thread A corresponds to a game type application, then thread A can be determined to be an exempt thread. In some scenarios, the electronic device can determine whether the type of thread A is a preset thread type. For example, the preset thread type is a rendering type, a positioning type, etc. For example, the electronic device determines that thread A is a rendering type thread, then no matter what type of application thread A belongs to, thread A can be determined to be an exempt thread.

[0148] In some examples, whether task A has exemption can be determined based on whether task A is a tag-infected task. If the task is a thread, since the tag of the tag-infected thread changes dynamically, the life cycle of the tag-infected thread is short. If thread A is a tag-infected thread, it means that thread A will die or end in a short time, then the electronic device can not perform subsequent control on thread A. That is, the electronic device determines that the tag-infected thread is an exempt thread.

[0149] In some embodiments, Figure 5 As shown, the electronic device determines whether the abnormal thread belongs to the foreground abnormal thread through the foreground thread identification module in the user space. Afterwards, if the abnormal thread belongs to the foreground abnormal thread, the electronic device can continue to determine whether the abnormal thread belongs to the exempt thread through the exemption thread identification module in the user space.

[0150] In response to thread A not being an exempt thread, the electronic device executes step S406 to further determine whether thread A needs to be controlled.

[0151] Step S406: Detect the CPU usage of task A according to the preset rules, and determine whether the detection result meets the preset conditions based on the CPU usage of task A in the detection result. If yes, execute the following step S407; if not, end the task control process.

[0152] In some embodiments, the preset rule includes a detection duration. If thread A is not an exempt thread, the electronic device can detect the CPU usage of thread A within the detection duration, and then the electronic device determines the CPU occupancy of thread A based on the obtained CPU usage of thread A, so as to further enable the electronic device to determine whether thread A needs to be controlled. Accordingly, the preset condition can be that the CPU usage of thread A included in the detection result is greater than or equal to the preset threshold ThB.

[0153] In some examples, the electronic device may detect the CPU usage of thread A according to a pre-configured preset detection duration. For example, the preset detection duration is 10s, and the electronic device may detect the CPU usage of thread A once within 10s. After the detection is completed, it is determined whether the CPU usage of thread A within 10s is greater than or equal to the preset threshold ThB. If the CPU usage of thread A obtained by one detection is greater than or equal to the preset threshold ThB, the electronic device may consider thread A to be an abnormal task that runs for a long time and occupies more CPU resources. The electronic device may execute the following step S407 to limit the computing resource usage of thread A.

[0154] In other embodiments, the preset rules include detection duration and detection times. If thread A does not belong to the exempted thread, the electronic device may perform multiple detections on the CPU usage of thread A, and the duration of each detection is the detection duration in the preset rules, so as to further determine whether thread A needs to be controlled based on the CPU usage of thread A in the detection result. For example, the electronic device may detect the CPU usage of thread A according to the pre-configured preset detection duration and detection times. For example, the preset detection duration is 10s and the detection times are 2 times. The electronic device may perform the first detection on the CPU usage of thread A within 10s, and after the first detection is completed, continue to perform the second detection on the CPU usage of thread A within the next 10s. After multiple detections of thread A according to the pre-configured detection times, it is determined whether the detection results meet the preset conditions based on the CPU usage of thread A in the detection results, and further determines whether thread A needs to be controlled.

[0155] In some examples, the preset condition includes that the CPU usage of thread A in each detection result is greater than or equal to the preset threshold ThB. If the CPU usage of thread A in each detection result is greater than or equal to the preset threshold ThB, then thread A can be considered to be an abnormal task that runs for a long time and occupies more CPU resources. For example, the preset threshold ThB is 75%, and the CPU usage of thread A is detected twice. In the two detection results, the CPU usage of thread A is greater than or equal to 75%, then the electronic device can consider thread A to be a thread that needs to be controlled. If the CPU usage of thread A is detected twice, in which the CPU usage of thread A is greater than or equal to 75% in one detection result, and in the other detection result, the CPU usage of thread A is less than or equal to 75%, then the electronic device can consider that thread A does not occupy the CPU for a long time, and it can be determined that thread A is not a thread that needs to be controlled. Through the above method, the electronic device can accurately identify threads with high CPU usage but do not occupy CPU computing resources for a long time, for example, thread A with high CPU usage but not an infinite loop. Based on the above process, the electronic device will not limit the computing resource usage of the identified thread A. The electronic device can ensure the correct operation of the application, avoid freezing of the application, and improve the stability of the application operation.

[0156] In other examples, the preset conditions include any one of the following conditions: the number of detection results for which the CPU usage of thread A is greater than or equal to the preset threshold ThB is greater than or equal to the preset number, or the ratio of the number of detection results for which the CPU usage of thread A is greater than or equal to the preset threshold ThB to the number of detections is greater than or equal to the preset ratio. The preset threshold ThB is 75%, and the CPU usage of thread A is detected 5 times. For example, when the preset number is 3, if the CPU usage of thread A in 4 of the 5 detection results is greater than or equal to 75%, the CPU usage of thread A in the remaining 1 detection result is less than or equal to 75%. Then, the electronic device may consider that thread A occupies the CPU for a long time, and thread A may be determined to be a thread that needs to be controlled. For another example, when the preset ratio is 50%, if the CPU usage of thread A in 3 of the 5 detection results is greater than or equal to 75%, the CPU usage of thread A in the remaining 2 detection results is less than or equal to 75%. Then, the ratio of the number of detection results for which the CPU usage of thread A is greater than or equal to the preset threshold ThB to the number of detections is 60%. If the ratio is greater than or equal to the preset ratio of 50%, the electronic device may consider that thread A has occupied the CPU for a long time and determine that thread A is a thread that needs to be controlled. In this way, through the above method, the electronic device can accurately identify the thread that needs to be controlled. Based on the above process, the electronic device will not limit the computing power resource usage of the identified thread A, and the electronic device can ensure the correct operation of the application, avoid the jamming of the application, and improve the stability of the application operation.

[0157] Optionally, the electronic device detects the CPU usage of task A according to a preset detection duration and detection times. Afterwards, based on the CPU usage of thread A in the detection result, the electronic device determines that the detection result meets the preset conditions and can display a prompt interface to prompt the user whether the electronic device needs to control the application corresponding to task A. For example, Figure 7 The interface shown includes a prompt message "It is detected that the application has excessive power consumption. Please confirm whether the application needs to be controlled." Figure 7 The interface shown also includes a control control 71 and an ignore control 72. In response to the user clicking the control control 71, the electronic device may execute step S407 to control thread A. In response to the user clicking the ignore control 72, the electronic device may not control thread A.

[0158] In some embodiments, in step S404, if the electronic device determines that thread A belongs to an application currently running in the foreground, the electronic device can record thread A and record it in the thread control list. The electronic device continues to detect the CPU usage of each task in the thread control list. If the CPU usage of a second task in the thread control list is less than the preset threshold ThB, the electronic device can delete the second task from the thread control list. In this way, the electronic device can continuously control the tasks in the thread control list, and update the tasks in the thread control list in a timely manner, so as to control based on the real-time actual situation of the task and ensure the accuracy of task control.

[0159] In some embodiments, Figure 5 As shown, the electronic device can continue to obtain the running data of thread A through the thread load detection module in the user space to determine the CPU usage of thread A, thereby determining whether the CPU usage of thread A meets the preset conditions.

[0160] After the electronic device detects Task A and determines that the detection result meets the preset conditions, subsequent steps can be executed to limit the computing power resource usage of Task A.

[0161] Step S407: The electronic device limits the computing resource usage of task A.

[0162] In some embodiments, since computing resource usage refers to the amount of core computing resources occupied, the electronic device calculates the computing resource usage through the PELT algorithm to indicate the size of the task based on the computing resource usage.

[0163] In some examples, task A is thread A, and the electronic device can determine whether the computing resource usage of thread A is greater than or equal to the preset threshold value ThE to determine whether thread A is a large task. For example, the computing resource usage of thread A calculated by the electronic device based on the PELT algorithm is 1024, and the preset threshold value ThE is 500. Then, the electronic device will consider thread A to be a large task. In the current processing method, the electronic device may increase the operating frequency of the kernel through the kernel scheduler so that the kernel increases the processing speed and quickly completes the thread A. However, if thread A is an abnormal task, simply increasing the operating frequency of the kernel may not be able to quickly complete the thread A.

[0164] Based on this, in some embodiments, the electronic device can limit the computing power resources occupied by task A in the kernel by limiting the computing power resource usage of task A, thereby adjusting the kernel operating frequency. For example, the computing power resource usage of thread A calculated by the electronic device based on the PELT algorithm is 1024, and the preset threshold value ThE is 500. Then, the electronic device will consider thread A to be a large task that requires more computing power resources. However, through the judgment of steps S401-S406, the electronic device believes that thread A is actually an abnormal task and needs to control thread A. At this time, the electronic device can limit the computing power resource usage of task A so that the kernel scheduler of the electronic device can reduce the operating frequency of the kernel accordingly based on the limited computing power resource usage. Avoid the electronic device directly obtaining a larger computing power resource usage based on the calculation, and adjust the operating frequency of the kernel accordingly.

[0165] In some examples, the computing power resource usage in actual applications can be a util value, or a uclamp value, etc. The following takes the util value as an example to illustrate the limitation of the computing power resource usage of task A by the electronic device. The electronic device calculates that the util value of task A is 1024, and the util value is greater than or equal to the preset threshold value 500, then the electronic device considers task A to be a "big" task. Accordingly, the operating frequency of the electronic device kernel will be at a high level for a long time due to the existence of the task, which will lead to problems such as high power consumption and reduced performance of the kernel. For example, through the judgment of steps S401-S406, the electronic device determines that task A is an abnormal task that causes the kernel operating frequency to increase. For example, if task A is an infinite loop task, and the task A does not actually require a high completion time, the electronic device can modify the util value of task A to 400, and the electronic device will treat the task as a "small" task. Correspondingly, the operating frequency of the electronic device kernel will decrease accordingly based on the modified util value, which can then reduce the power consumption of the kernel and improve the performance of the kernel.

[0166] Optionally, when limiting the usage of computing power resources, the electronic device may limit the thread based on the preset computing power resource usage. For example, the preset computing power resource usage is 400, and both thread A and thread B detected by the electronic device need to limit the usage of computing power resources, and the original computing power resource usage of thread A is 500, and the original computing power resource usage of thread B is 800. Then, the electronic device will modify the computing power resource usage of thread A to 400 and the computing power resource usage of thread B to 400. That is, when the electronic device determines that the computing power resource usage of a thread needs to be limited, it will modify the computing power resource usage of the thread to the preset computing power resource usage.

[0167] Optionally, when the electronic device limits the usage of computing power resources, it can also limit it based on preset restriction rules. For example, the restriction rules include the correspondence between the original computing power resource usage value range and the original computing power resource usage value after restriction. For example, the restriction rules indicate the correspondence between the original computing power resource usage value range [800, 1024] and 500. Then, after the electronic device determines that thread A is an abnormal task and needs to limit the computing power resource usage of thread A. If the original computing power resource usage value of thread A is within the range of 800-1024, the electronic device modifies the computing power resource usage of thread A to 500.

[0168] Exemplarily, the sum of the computing power resource usage of all threads running on the kernel is 1024, of which the computing power resource usage of thread A is 300, the computing power resource usage of thread B is 300, and the computing power resource usage of thread C is 424. The corresponding operating frequency of the kernel is 2.5GHz. If the electronic device detects that thread C is an abnormal task, based on the above process, the electronic device can modify the computing power resource usage of thread C to 124, so that the electronic device considers thread C to be a small task and reduces the processing resources actually occupied by thread C. Afterwards, if the computing power resource usage of thread A and the computing power resource usage of thread B remain unchanged, the total computing power resource usage of the kernel is reduced to 724 (i.e., the sum of the computing power resource usage of thread A of 300, the computing power resource usage of thread B of 300, and the modified computing power resource usage of thread C of 124), and based on the adjustment mechanism built into the kernel, the operating frequency of the kernel may drop to 1.8GHz.

[0169] Optionally, after the electronic device executes step S407 and limits the computing resource usage of task A, the restriction operation may be recorded. The recorded content may include the restriction object and information about the restriction object, and parameter changes corresponding to the restriction operation. For example, after the electronic device limits the computing resource usage of task A corresponding to the call application from 1024 to 400, the following information may be recorded:

[0170] Restricted time: XX year XX month XX day XX hour XX minute XX second;

[0171] Restricted objects: Call application-Task A;

[0172] Restriction content: Original util value 1024, modified util value 400.

[0173] By recording each time an electronic device performs a computing resource usage limit operation, it can facilitate subsequent backtracking based on the recorded content.

[0174] In this way, by modifying the computing resource usage of abnormal tasks, the frequency of kernel operation can be effectively reduced, thereby reducing the power consumption of the CPU and the heat generated by the electronic equipment.

[0175] The present application provides a task control method, which is applied to electronic equipment. Figure 8 As shown, the method comprises the following steps:

[0176] S801: The electronic device determines a target core among the multiple cores in response to first operation information of the multiple cores.

[0177] The first operation information is used to indicate the operation status of multiple cores.

[0178] In some embodiments, the operating state includes a first operating state and a second operating state, the first operating state indicates that the operating frequency of the core is greater than or equal to a preset operating frequency, and the second operating state indicates that the operating frequency of the core is less than a preset operating frequency; in response to first operating information of multiple cores, determining a target core among the multiple cores, including: determining, based on the first operating information, a target core among the multiple cores whose duration in the first operating state accounts for more than a first ratio within a first cycle.

[0179] In some instances, the electronic device may detect the operating frequency of each core according to a preset period T, where the preset period is the first period. If the operating frequency of the core is greater than or equal to the preset operating frequency, that is, the core is in the first operating state, the electronic device may consider the core to be in a high-frequency operating state. If within the preset period T, the ratio of the duration of the core in the high-frequency operating state (i.e., the duration in the first operating state) to the total detection duration (i.e., the preset period T) is greater than or equal to the preset threshold value ThC, the electronic device may consider that the core is in a high-frequency operating time for a long time, and the core may be abnormal. In this way, the electronic device can accurately determine the target core based on the operating state of the core.

[0180] In some embodiments, the running status also includes a kernel usage rate, and the kernel usage rate of the target kernel is greater than or equal to a preset kernel usage rate.

[0181] In some embodiments, the electronic device detects the usage rate of the kernel to determine the busyness of the kernel. In some examples, the electronic device can detect the non-idle running time of the kernel. After that, the electronic device calculates the ratio of the non-idle running time of the kernel to the total running time of the target kernel to obtain the usage rate of the kernel. If the calculated ratio is greater than a certain value, the electronic device can consider the kernel as the target kernel. In this way, the electronic device can accurately determine the target kernel with a higher busyness from the kernel.

[0182] S802: The electronic device obtains a first task running in a target kernel.

[0183] The running time of the first task is greater than or equal to the preset running time.

[0184] In some embodiments, the electronic device may sample the tasks running in the target kernel to identify whether the tasks running in the kernel are abnormal tasks. That is, obtain the first task running in the target kernel. Exemplarily, the electronic device may sample the target kernel according to the second cycle to obtain multiple sampling results; determine the first task based on the sampling results, and the number of occurrences of the first task in the multiple sampling results is greater than or equal to the preset number.

[0185] Since a task that runs for a long time occupies more running resources, if a task appears more times in the sampling result, it can be considered that the task is the first task that runs for a long time in the kernel.

[0186] In some embodiments, the first task belongs to the foreground application. When the foreground application is running, it will occupy more computing resources, usage rate, etc. of the kernel, which has a greater impact on the running performance of the kernel. Background applications generally only occupy a small part of the computing resources. Therefore, the tasks belonging to the foreground application can be managed, that is, the first task belongs to the foreground task. Based on this, the electronic device can reduce unnecessary management and control operations and reduce the computing resources occupied by the electronic device management and control.

[0187] In some embodiments, before determining the CPU usage of the first task, the method further includes: determining that the first task does not belong to an exempted task, and the electronic device does not limit the computing resource usage of the exempted task.

[0188] In some examples, the exempted tasks include one or more of tag infection tasks, tasks belonging to preset types of applications, and tasks pre-specified by the user.

[0189] Based on this, electronic devices can avoid controlling exempted tasks, thereby ensuring the stable operation of applications. In addition, electronic devices can also reduce unnecessary control operations and reduce the computing resources occupied by electronic device control.

[0190] S803: The electronic device determines a CPU usage rate of the first task.

[0191] S804: When the CPU usage rate satisfies the first condition, the electronic device adjusts the computing resource usage of the first task.

[0192] In some embodiments, when determining the CPU usage of the first task, the electronic device may detect the CPU usage of the first task to obtain a detection result. Then in step S804, the first condition includes that the CPU usage in the detection result is greater than or equal to the preset CPU usage.

[0193] In some examples, when determining the CPU usage of the first task, the electronic device may perform a detection within the detection duration. When the CPU usage of the first task is greater than or equal to the preset CPU usage, the electronic device may adjust the computing resource usage of the first condition.

[0194] In some embodiments, when determining the CPU usage of the first task, the electronic device may detect the CPU usage of the first task to obtain multiple detection results. Then in step S804, the first condition includes one of the following: the number of detection results whose CPU usage is greater than or equal to a preset CPU usage is greater than or equal to a preset number, or the second ratio of the number of detection results whose CPU usage is greater than or equal to the preset CPU usage to the number of multiple detection results is greater than or equal to a second preset ratio.

[0195] In some instances, when determining the CPU usage rate of the first task, the electronic device may perform multiple detections within the detection duration, and the duration of each detection is the detection duration in the preset rule. For example, if the number of detection results with a CPU usage rate greater than or equal to a preset CPU usage rate is greater than or equal to a preset number, it can be indicated that the possibility that the CPU usage rate of the first task is high is relatively high, indicating that the possibility that the first task is an abnormal task is relatively high. For another example, if the second ratio of the number of detection results with a CPU usage rate greater than or equal to a preset CPU usage rate to the number of multiple detection results is greater than or equal to a second preset ratio, it can be indicated that the possibility that the CPU usage rate of the first task is high is relatively high, indicating that the possibility that the first task is an abnormal task is relatively high.

[0196] In some embodiments, the computing power resource usage refers to the amount of kernel computing power resources occupied, and the computing power resource usage is related to the operating frequency of the kernel. Therefore, the operating frequency of the kernel can be adjusted by modifying the computing power resource usage of the first task. For example, the initial computing power resource usage of the first task is large, and the electronic device will think that thread A is a large task that needs to occupy more computing power resources, so the operating frequency of the kernel will be correspondingly higher. If the electronic device reduces the computing power resource usage of the first task when the CPU usage rate meets the first condition. Afterwards, the kernel scheduler of the electronic device reduces the operating frequency of the kernel accordingly based on the limited computing power resource usage. Avoid the electronic device from being at a higher operating frequency all the time. Among them, the kernel scheduler of the electronic device can regulate the operating frequency of the kernel based on the computing power resource usage of the task. Generally, the computing power resource usage is proportional to the operating frequency of the kernel.

[0197] Based on this, the electronic device can determine the target kernel based on the first operating information of the kernel. There is a high possibility that an abnormal task exists in the target kernel determined based on the first operating information, so the electronic device can continue to identify the first task that has been running for a long time in the target kernel to identify the task that needs to be controlled. Then, the CPU usage rate of the first task that needs to be controlled is determined, and it is further confirmed whether the first task needs to be controlled to accurately determine the control object. Then, the electronic device can effectively reduce the frequency of kernel operation by modifying the computing power resource usage of the abnormal task, thereby reducing the power consumption of the CPU and the heat generation of the electronic device.

[0198] In addition, during this process, the electronic device only modifies the computing resource usage of the first task and does not directly stop the first task. Therefore, this solution does not affect the user experience.

[0199] Combination of the above Figure 4-Figure 8 The task control method provided by the embodiment of the present application is described in detail. Fig. 9 The electronic device provided by the embodiments of the present application is described in detail.

[0200] In one possible design, Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device 900 may include: a processing unit 901 and a transceiver unit 902. The electronic device 900 may be used to implement the functions of the electronic device involved in the above method embodiment.

[0201] Optionally, the processing unit 901 is used to support the electronic device 900 to execute Figure 4 S401-S407 in the embodiment are also used to support the electronic device 900 to execute Figure 8S801-S804 in.

[0202] Optionally, the transceiver unit 902 is used to support the electronic device 900 to execute Figure 4 S401-S407 in the embodiment are also used to support the electronic device 900 to execute Figure 8 S801-S804 in.

[0203] Among them, the transceiver unit 902 may include a receiving unit and a sending unit, and may be implemented by a transceiver or a transceiver-related circuit component, and may be a transceiver or a transceiver module. The operations and / or functions of each unit in the electronic device 900 are respectively to implement the corresponding process of the task control method described in the above method embodiment. All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional unit, and for the sake of brevity, they will not be repeated here.

[0204] Optionally, Fig. 9 The electronic device 900 shown may also include a storage unit ( Fig. 9 (not shown), the storage unit stores a program or instruction. When the processing unit 901 and the transceiver unit 902 execute the program or instruction, Fig. 9 The electronic device 900 shown can execute the task control method described in the above method embodiment.

[0205] Fig. 9 The technical effects of the electronic device 900 shown can refer to the technical effects of the task control method described in the above method embodiment, and will not be repeated here.

[0206] In addition to being in the form of electronic device 900, the technical solution provided in the embodiment of the present application may also be a functional unit or chip in the electronic device, or a device used in conjunction with the electronic device.

[0207] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step in the above-mentioned method embodiment.

[0208] The embodiment of the present application also provides a computer program product, including a computer program. When the computer program runs on an electronic device, the electronic device executes each function or step in the above method embodiment.

[0209] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0210] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0211] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0212] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0213] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0214] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A task control method, characterized in that: Applied to electronic equipment, the method comprises: In response to first operation information of a plurality of cores, determining a target core among the plurality of cores; wherein the first operation information is used to indicate the operation status of the plurality of cores; Acquire a first task running in the target kernel, where the running time of the first task is greater than or equal to a preset running time; Determining a CPU usage rate of the first task; When the CPU usage rate satisfies the first condition, the computing resource usage of the first task is adjusted.

2. The method according to claim 1, characterized in that The running state includes a first running state and a second running state, the first running state indicates that the running frequency of the core is greater than or equal to a preset running frequency, and the second running state indicates that the running frequency of the core is less than the preset running frequency; The step of determining a target kernel among the plurality of kernels in response to first operation information of the plurality of kernels comprises: According to the first operation information, the target core is determined, in a first cycle, for which the proportion of the duration of being in the first operation state among the multiple cores exceeds a first ratio.

3. The method according to claim 1 or 2, characterized in that: The running status also includes a kernel usage rate, and the kernel usage rate of the target kernel is greater than or equal to a preset kernel usage rate.

4. The method according to claim 1 or 2, characterized in that: The obtaining the first task running in the target kernel includes: Sampling the target kernel according to a second cycle to obtain a plurality of sampling results; The first task is determined based on the sampling results, and the number of times the first task appears in the multiple sampling results is greater than or equal to a preset number.

5. The method according to any one of claims 1 to 4, characterized in that The first task belongs to the foreground application.

6. The method according to any one of claims 1 to 5, characterized in that Before determining the CPU usage of the first task, the method further includes: It is determined that the first task does not belong to an exempted task, and the electronic device does not limit the computing resource usage of the exempted task.

7. The method according to claim 6, characterized in that The exempted tasks include one or more of tag infection tasks, tasks belonging to preset types of applications, and tasks pre-specified by a user.

8. The method according to any one of claims 1 to 7, characterized in that The determining the CPU usage of the first task includes: Detecting the CPU usage of the first task to obtain a detection result; The first condition includes that the CPU usage in the detection result is greater than or equal to a preset CPU usage.

9. The method according to any one of claims 1 to 7, characterized in that: The determining the CPU usage of the first task includes: Detecting the CPU usage of the first task to obtain multiple detection results; The first condition includes that the number of detection results whose CPU usage is greater than or equal to a preset CPU usage is greater than or equal to a preset number, or a second ratio of the number of detection results whose CPU usage is greater than or equal to the preset CPU usage to the number of the multiple detection results is greater than or equal to one of the second preset ratios.

10. An electronic device, characterized in that: The electronic device comprises: A core high frequency detection module, configured to determine a target core among the multiple cores in response to first operation information of the multiple cores; wherein the first operation information is used to indicate the operation status of the multiple cores; A first task determining module, configured to obtain a first task running in the target kernel, wherein the running time of the first task is greater than or equal to a preset running time; A task central processing unit CPU usage detection module, used to determine the CPU usage of the first task; The computing power resource usage limiting module is used to adjust the computing power resource usage of the first task when the CPU usage rate meets the first condition.

11. An electronic device, characterized in that: The electronic device includes a memory and one or more processors; the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 9.

Citation Information

Cited By

  • Task management method and related apparatus

    WO2026194440A1