Task management method and related device

By recording the task execution time and frequency points, calculating the load ratio, identifying high-load tasks and transferring them to small-core processors, the problem of insufficient system resources caused by high-load tasks is solved, reducing system load and power consumption, and improving user experience.

WO2025148726A1PCT designated stage expired Publication Date: 2025-07-17HONOR DEVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/143343
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-10
Filing Date
2024-12-27
Publication Date
2025-07-17

AI Technical Summary

Technical Problem

High load tasks lead to insufficient resources of smart electronic equipment, resulting in system lag and affecting user experience.

Method used

By recording the execution time and processor frequency of the task, calculating the normalized execution time, determining the load ratio of the task, identifying high-load tasks, and transferring them to the small-core processor for execution through a core binding or usage clamping mechanism, reducing system load and power consumption.

Benefits of technology

Accurately identify high-load tasks, avoid them affecting the execution of critical tasks, reduce system power consumption, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024143343_17072025_PF_FP_ABST
    Figure CN2024143343_17072025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are a task management method and a related device. The method comprises: recording an execution start time and an execution end time of a task each time same is executed within a statistical window; collecting a frequency point of a processor of an electronic device when executing the task; on the basis of the execution start time, the execution end time, and the frequency point, calculating a normalized execution duration of the task; on the basis of the normalized execution duration of the task, determining an in-window load of the task; on the basis of the in-window load of the task and the statistical window, determining an in-window load ratio of the task; and if the in-window load ratio of the task is greater than or equal to a preset threshold, determining the task to be a high-load task, and on the basis of a preset policy, managing and controlling the task. The embodiments of the present application can accurately identify high-load tasks and manage and control same, thereby avoiding the impact of the high-load tasks on the execution of critical tasks and effectively reducing system power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Task management method and related equipment

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on January 10, 2024, with application number 202410041940.9 and application name “Task Management Method and Related Equipment”, the entire contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of intelligent terminal technology, and in particular to a task management method and related equipment. Background Art

[0004] When running applications on smart electronic devices like smartphones and personal computers, they generate numerous tasks. Some of these high-load tasks take a long time to execute, increasing the system load on these devices. For example, increased utilization of resources like processors and memory can lead to insufficient system resources for handling critical scenarios or tasks, causing system lags and impacting the user experience. Summary of the Invention

[0005] In view of the above, it is necessary to provide a task management method to solve the problem that high-load tasks occupy too much system resources and result in insufficient system resources for processing critical tasks.

[0006] In the first aspect, the present application provides a task management method, which is applied to an electronic device, and the method includes: recording the start execution time and end execution time of each execution of a task within a statistical window; collecting the frequency when the processor of the electronic device executes the task; calculating the normalized execution duration of the task based on the start execution time, the end execution time and the frequency; determining the in-window load of the task based on the normalized execution time; determining the in-window load ratio of the task based on the in-window load of the task and the statistical window; if the in-window load ratio of the task is greater than or equal to a preset threshold, determining that the task is a high-load task, and managing the task according to a preset strategy.

[0007] Through the above technical solution, the normalized execution time of the task can be accurately calculated based on the execution time of each execution of the task in the statistical window and the processor frequency, and then the load of the task in the statistical window can be accurately determined, and the load ratio of the task in the statistical window can be determined based on the load of the task in the statistical window. According to the load ratio of the task in the statistical window, whether the task is a high-load task can be accurately identified, and high-load tasks can be managed and controlled, effectively reducing the processor load and reducing system power consumption.

[0008] In one possible implementation, the recording of the start execution time and the end execution time each time the task is executed within the statistical window includes: creating a task listener, monitoring the thread executing the task within the statistical window through the task listener, recording the creation time of the thread as the start execution time, and recording the destruction time of the thread as the end execution time.

[0009] Through the above technical solution, the start execution time and the end execution time of a task in each execution process can be accurately determined.

[0010] In one possible implementation, collecting the frequency of the processor of the electronic device when executing the task includes: collecting the real-time processor frequency every preset time period during the execution of the task; and determining the maximum frequency or average frequency of the multiple collected processor frequencies as the frequency of the processor when executing the task.

[0011] Through the above technical solution, the frequency point when the processor executes a task can be accurately determined.

[0012] In one possible implementation, the normalized execution duration of the task is calculated based on the start execution time, the end execution time and the frequency, including: calculating the difference between the end execution time and the start execution time to obtain the execution duration of the task; calculating the product of the execution duration of the task, the ratio between the frequency and the maximum frequency of the processor, and the computing power of the processor to obtain the normalized execution duration.

[0013] Through the above technical solution, the normalized execution time of the task can be accurately calculated, and the calculation standards of the task execution time corresponding to different types of processors and different processor frequencies can be unified, thereby avoiding the differences in task execution time when the task runs on different types of processors and different processor frequencies.

[0014] In one possible implementation, the in-window load of the task is determined based on the normalized execution time of the task, including: if the task is executed multiple times within the statistical window, calculating the sum of all normalized execution times when the task is executed multiple times within the statistical window to obtain the in-window load of the task; if the task is executed once within the statistical window, determining the normalized execution time when the task is executed within the statistical window as the in-window load of the task.

[0015] Through the above technical solution, the load of the task in the statistical window can be accurately calculated based on the number of times the task is executed in the statistical window and the execution duration of each execution.

[0016] In a possible implementation, determining the in-window load ratio of the task based on the in-window load of the task and the statistical window includes: calculating the ratio between the in-window load of the task and the statistical window to obtain the in-window load ratio of the task.

[0017] Through the above technical solution, the load ratio of the task in the statistical window can be accurately determined, and the load ratio of the task in the statistical window can be used as a judgment basis for high-load tasks, thereby accurately determining whether the task is a high-load task.

[0018] In a possible implementation, managing and controlling the task according to a preset strategy includes: binding the task to a small-core processor of the electronic device, and having the small-core processor execute the task.

[0019] Through the above technical solution, high-load tasks are performed by the small-core processor by binding the cores, which can prevent high-load tasks from preempting the processing resources of critical tasks, reduce the processor load, and reduce system power consumption.

[0020] In a possible implementation, the managing and controlling the task according to a preset strategy includes: setting a usage clamping parameter of the task according to a usage clamping mechanism, so that the task is executed by the small-core processor of the electronic device.

[0021] Through the above technical solution, by setting the task usage clamping parameters, high-load tasks are executed by small-core processors, which can prevent high-load tasks from preempting the processing resources of critical tasks, reduce processor load, and reduce system power consumption.

[0022] In a second aspect, an embodiment of the present application provides a task management method, which is applied to an electronic device, the method comprising: recording the start execution time and end execution time of each execution of a task within a preset time period; collecting the frequency of the task when the processor of the electronic device executes the task; calculating the normalized execution duration of the task based on the start execution time, the end execution time and the frequency; determining the normalized load of the task per second within the preset time period based on the normalized execution duration of the task; obtaining the normalized load per second within a specified statistical window from the normalized load of the task per second within the preset time period, wherein the specified statistical window is less than or equal to the preset time period. ; Determine the actual normalized load of the task within the specified statistical window based on the normalized load of the task per second within the specified statistical window and the window load grading gear, and the correspondence between the statistical window and the actual normalized load; Determine the load gear of the task within the specified statistical window based on the actual normalized load of the task within the specified statistical window and the window load grading gear, and the correspondence between the statistical window and the actual normalized load; If the load gear of the task within the specified statistical window is greater than or equal to the preset threshold gear corresponding to the specified statistical window, determine that the task is a high-load task, and manage the task according to the preset strategy.

[0023] Through the above technical solution, it is only necessary to determine the normalized load of the task per second within a preset time period, and the load grading levels corresponding to different statistical windows can be determined through the correspondence between the window load grading levels, the statistical window and the actual normalized load. There is no need to calculate the load data of different statistical windows at the same time, which reduces data storage overhead and reduces the memory usage of task management data.

[0024] In one possible implementation, the recording of the start execution time and the end execution time of each execution of the task within a preset time period includes: creating a task listener, monitoring the thread that executes the task within each second through the task listener, recording the creation time of the thread as the start execution time of the task, and recording the destruction time of the thread as the end execution time of the task.

[0025] Through the above technical solution, the start execution time and the end execution time of a task in each execution process can be accurately determined.

[0026] In one possible implementation, the normalized execution duration of the task is calculated based on the start execution time, the end execution time and the frequency, including: calculating the difference between the end execution time and the start execution time to obtain the execution duration of the task; calculating the product of the execution duration of the task, the ratio between the frequency and the theoretical maximum frequency of the processor, and the computing power of the processor to obtain the normalized execution duration.

[0027] Through the above technical solution, the normalized execution time of the task can be accurately calculated, and the calculation standards of the task execution time corresponding to different types of processors and different processor frequencies can be unified, thereby avoiding the differences in task execution time when the task runs on different types of processors and different processor frequencies.

[0028] In one possible implementation, the actual normalized load of the task within the specified statistical window is determined based on the normalized load of the task per second within the specified statistical window and the correspondence between the window load grading level, the statistical window and the actual normalized load, including: comparing the normalized load of the task per second within the specified statistical window with the window load grading level, the statistical window and the actual normalized load in a correspondence table to determine the load level of the task per second; determining the actual normalized load corresponding to the load level of the task per second in the correspondence table, and determining the sum of multiple actual normalized loads as the actual normalized load of the task within the specified statistical window.

[0029] Through the above technical solution, the actual normalized load of the task within the specified statistical window can be quickly determined by looking up the table, effectively improving the efficiency of obtaining the actual normalized load of the task.

[0030] In one possible implementation, the load level of the task within the specified statistical window is determined based on the actual normalized load of the task within the specified statistical window, the window load grading level, and the correspondence between the statistical window and the actual normalized load, including: comparing the actual normalized load of the task within the specified statistical window with the window load grading level and the correspondence table between the statistical window and the actual normalized load to determine the load level of the task within the specified statistical window.

[0031] Through the above technical solution, the load level of the task within the specified statistical window can be quickly determined by looking up the table, effectively improving the efficiency of determining the load level of the task.

[0032] In a possible implementation, managing and controlling the task according to a preset strategy includes: binding the task to a small-core processor of the electronic device, and having the small-core processor execute the task.

[0033] Through the above technical solution, high-load tasks are performed by the small-core processor by binding the cores, which can prevent high-load tasks from preempting the processing resources of critical tasks, reduce the processor load, and reduce system power consumption.

[0034] In a possible implementation, the managing and controlling the task according to a preset strategy includes: setting a usage clamping parameter of the task according to a usage clamping mechanism, so that the task is executed by the small-core processor of the electronic device.

[0035] Through the above technical solution, by setting the task usage clamping parameters, high-load tasks are executed by small-core processors, which can prevent high-load tasks from preempting the processing resources of critical tasks, reduce processor load, and reduce system power consumption.

[0036] In a third aspect, the present application provides an electronic device comprising a memory and a processor: wherein the memory is used to store program instructions; the processor is used to read and execute the program instructions stored in the memory, and when the program instructions are executed by the processor, the electronic device performs the above-mentioned task management method.

[0037] In a fourth aspect, the present application provides a chip coupled to a memory in an electronic device, wherein the chip is used to control a processor of the electronic device to execute the above-mentioned task management method.

[0038] In a fifth aspect, the present application provides a computer storage medium storing program instructions. When the program instructions are executed on an electronic device, the processor of the electronic device executes the above-mentioned task management method.

[0039] In addition, the technical effects brought about by the third to fifth aspects can be found in the descriptions of the methods of each design in the above method section, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] FIG1 is a schematic diagram of load types of an electronic device in a key scenario provided by an embodiment of the present application.

[0041] FIG2 is a schematic diagram of task types of an electronic device in a key scenario provided by an embodiment of the present application.

[0042] FIG3 is a schematic diagram of load changes of an electronic device provided in an embodiment of the present application.

[0043] FIG4 is a software architecture diagram of an electronic device provided in an embodiment of the present application.

[0044] FIG5 is a flowchart of a task management method provided in an embodiment of the present application.

[0045] FIG6 is a schematic diagram of time nodes of a task execution process provided by an embodiment of the present application.

[0046] FIG7 is a flowchart of a task management method provided by another embodiment of the present application.

[0047] FIG8 is a schematic diagram of the execution time per second of a task within 10 seconds provided by an embodiment of the present application.

[0048] FIG9 is a schematic diagram of a correspondence table between window load classification gears, statistical windows, and actual execution durations provided in an embodiment of the present application.

[0049] FIG10 is a schematic diagram of window load grading levels of tasks within different designated statistical windows provided by an embodiment of the present application.

[0050] FIG11 is a hardware architecture diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The terms "first" and "second" involved in the embodiments of the present application are for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application. It should be understood that, unless otherwise specified in this application, " / " means or. For example, A / B can mean A or B. "And / or" in this application is merely a way to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. "At least one" means one or more. "Multiple" means two or more than two. For example, at least one of a, b or c can mean: a, b, c, a and b, a and c, b and c, a, b and c. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0053] To facilitate understanding, some illustrations of concepts related to the embodiments of the present application are given for reference.

[0054] A process is a computer program's execution of a data set. It is the fundamental unit of resource allocation and scheduling, and the foundation of operating system architecture. A process is the primary execution entity of a program; in modern thread-oriented computer architectures, a process is a container for threads. A program is a description of instructions, data, and their organization, while a process is the actual entity of the program. A process can be thought of as an independent program, with its own complete data and code space in memory. The data and variables owned by a process belong only to it.

[0055] A thread is the smallest unit of computation within a process and the fundamental unit of processor scheduling. If a process is considered a logical task performed by the operating system, then a thread represents one of many possible subtasks that complete that task. In other words, a thread exists within a process. A process consists of one or more threads, each of which shares the same code and global data.

[0056] Task: includes various actions performed by the user on the computer and the corresponding response events (such as mouse click, right click, opening a dialog box, closing a file, starting a program, etc.). A task can be represented as an activity completed by the software. In the embodiment of the present application, a task can be either a process or a thread. A task can be a series of multiple operations that achieve a certain purpose. For example, reading data and putting the data into memory. This task can be implemented as a process or as a thread (or as an interrupt task).

[0057] As the configuration of smart electronic devices such as smartphones and personal computers becomes increasingly higher, users' performance requirements for smart electronic devices are also getting higher and higher, especially in key scenarios where human-computer interaction is more frequent and visual perception is more obvious, such as starting applications, fingerprint recognition, lighting up the display screen, etc. Fast application startup, fast fingerprint recognition speed, and fast display screen lighting can bring users a better performance experience. However, during the operation of applications in smart electronic devices, a large number of tasks will be generated. During the process of human-computer interaction, in addition to executing tasks in key scenarios, the system also needs to execute tasks generated by other applications or services, such as system tasks and tasks generated by background applications. Among them, the long execution time of some high-load tasks will cause the system load to increase. For example, the occupancy rate of resources such as processors and memory will increase, resulting in insufficient system resources for processing some key scenarios or tasks, which in turn causes the system to freeze, thereby affecting the user experience.

[0058] As shown in Figure 1, in key scenarios such as video playback or responding to user swipe operations, electronic devices typically include main thread / rendering thread load, critical task load, other load, and also background load and system load. As shown in Figure 2, the main thread / rendering thread load can include UI (interface refresh) tasks and Render tasks, while the critical task load can include Poll tasks, Binder (inter-process communication) tasks, and Worker tasks. Other loads include Log tasks, network access tasks, and download tasks. Background load includes background application load and background service load. Background application load is the load caused by applications running in the background, while background service load is the load caused by system services running in the background. Background service load includes Log tasks and HiView (maintenance and testing) tasks. System load includes kernel load and Android operating system load. Kernel load includes KWorker tasks, KThread tasks, and KSwapd tasks, while Android operating system load includes SystemServer tasks, SystemUI tasks, and Launcher tasks. It can be seen from this that even in critical scenarios, the systems of electronic devices need to perform a large number of tasks. If high-load tasks are generated in the system or background, they may seize the processing resources of the large-core processor, resulting in the inability to process critical tasks in critical scenarios in a timely manner. It is also easy to cause the processor to run at a high frequency for a long time, greatly increasing the system power consumption.

[0059] Refer to FIG3 , which is a schematic diagram of load changes in an electronic device provided in an embodiment of the present application. In one embodiment, it is assumed that the electronic device includes three processors, namely CPU0, CPU1, and CPU3, wherein CPU1 executes Task A in the first and fifth statistical windows, the operating frequency of all CPUs in the first statistical window is 600 MHz, and the operating frequency of all CPUs in the fifth statistical window reaches a maximum of 2.3 GHz. CPU0 executes Task A in the third statistical window, and the operating frequency of all CPUs in the third statistical window reaches a maximum of 2.3 GHz. CPU3 executes Task B in all the first to fifth statistical windows. It can be seen that the load of the processor is high when executing Task A, but it may be misjudged as a low-load task by the system due to the short execution time of Task A, and thus no control is performed on Task A, resulting in high system power consumption. The load of the processor is low when executing Task B, but it may be misjudged as a high-load task by the system due to the long execution time of Task B, and thus control is performed on Task B, resulting in Task B not being processed in a timely manner.

[0060] In order to avoid the inability to accurately identify high-load tasks, an embodiment of the present application provides a task management method, which provides a normalized high-load task quantification method, which can accurately identify high-load tasks and manage high-load tasks.

[0061] See Figure 4 for a diagram of the software architecture of an electronic device provided in an embodiment of the present application. A layered architecture divides software into several layers, each with distinct roles and divisions of labor. Layers communicate with each other via software interfaces. For example, the Android system is divided into four layers: application layer 101, framework layer 102, Android runtime and system library 103, hardware abstraction layer 104, kernel layer 105, and hardware layer 106, from top to bottom.

[0062] The application layer 101 may include a series of application packages, such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, device control service, etc.

[0063] The framework layer 102 provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions. For example, the application framework layer may include a window manager, content provider, view system, telephony manager, resource manager, notification manager, etc.

[0064] The window manager manages window programs. It can obtain the display size, determine whether a status bar exists, lock the screen, and take screenshots. The content provider stores and retrieves data and makes it accessible to applications. This data can include video, images, audio, incoming and outgoing calls, browsing history and bookmarks, and the phone book. The view system includes visual controls, such as those for displaying text and images. The view system can be used to build applications. The display interface can consist of one or more views. For example, a display interface containing a text notification icon can include a view for displaying text and a view for displaying images. The call manager provides communication functions for electronic devices, such as managing call status (including connected and ended calls). The resource manager provides applications with various resources, such as localized strings, icons, images, layout files, and video files. The notification manager enables applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically, without requiring user interaction. For example, the notification manager is used to notify download completions and message reminders. The notification manager can also be a notification that appears in the system's top status bar in the form of an icon or scrolling text bar, such as a notification from an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message may be displayed in the status bar, a notification sound may be emitted, an electronic device may vibrate, an indicator light may flash, etc.

[0065] The Android Runtime consists of a core library and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system. The core library consists of two parts: one for the Java language's callable functions and the other for the Android core library.

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

[0067] The system library 103 may include multiple functional modules, such as a surface manager, a media library, a 3D graphics processing library (such as OpenGL ES), a 2D graphics engine (such as SGL), and the like.

[0068] The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library supports a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing library implements 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D drawing.

[0069] The hardware abstraction layer 104 runs in the user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer.

[0070] The kernel layer 105 is a layer between hardware and software and includes at least a display driver, a camera driver, an audio driver, and a sensor driver.

[0071] The kernel layer 105 is the core of the electronic device's operating system. It is the first layer of software expansion based on the hardware, providing the most basic operating system functions and the foundation of the operating system. It is responsible for managing the system's processes, memory, device drivers, files, and network systems, and determines the system's performance and stability. For example, the kernel can determine the time an application can operate on a certain piece of hardware.

[0072] The kernel layer 105 includes programs closely related to the hardware, such as interrupt handlers and device drivers. It also includes basic, common, and high-frequency modules, such as the clock management module and the process scheduling module, as well as key data structures. The kernel layer can be set in the processor or stored in internal memory.

[0073] The hardware layer 106 includes the hardware of the electronic device, such as a display screen, buttons, a camera, etc.

[0074] Refer to FIG5 , which is a flowchart of a task management method provided in an embodiment of the present application. The method is applied to an electronic device and includes:

[0075] S101, recording the start execution time and end execution time of each task executed within the statistical window.

[0076] In one embodiment of the present application, a statistical window refers to a time window for performing statistical analysis of task loads. After the electronic device is powered on, a task management process is created, and a timer begins timing the statistical window. When the task management process detects that the processor has started processing a task, it marks the timer's timing. For example, taking task C as an example, the timer records the start time of task C. When the processor detects that it has finished processing task C, the timer is again marked to record the end time of task C. The statistical window can be pre-set as needed, for example, to 1 second, 3 seconds, 5 seconds, or other time periods.

[0077] In one embodiment of the present application, the task management process can create a task listener, and monitor the thread executing task C within the statistical window through the task listener. When it is monitored that the thread executing task C is created, the thread creation time is recorded using a timer, and the thread creation time is used as the start execution time of task C. When it is monitored that the thread executing task C is destroyed, the thread destruction time is recorded using a timer, and the thread destruction time is recorded as the end execution time of task C.

[0078] Refer to Figure 6, which is a schematic diagram of the time nodes of the task execution process provided in an embodiment of the present application. For example, the statistical window is 5 seconds, and the statistical window is timed using a timer. When the task listener detects that a thread executing task C is created, the timer is used to record the creation time of the thread as the start execution time of task C. When the task listener detects that a thread executing task C is destroyed, the timer is used to record the destruction time of the thread as the end execution time of task C. In one embodiment of the present application, the timing time of the timer can be the accumulated time based on the start of the statistical window, or it can be the system time, such as Beijing time.

[0079] S102, collecting the frequency points when the processor executes the task.

[0080] In one embodiment of the present application, upon detecting that a processor has begun executing a task, the task management process periodically collects real-time processor frequencies based on a preset time period, thereby collecting multiple processor frequencies and determining the maximum or average frequency of the multiple processor frequencies as the frequency of the processor executing the task. For example, the preset time period may be 5ms, 10ms, or another time period.

[0081] In one embodiment of the present application, the real-time frequency of the processor is automatically stored in the / sys / devices / system / cpu / cpuX / cpufreq / scaling_cur_freq file, where cpuX represents the processor core. The task management process reads this file to collect the real-time frequency of the processor during task execution.

[0082] S103 , calculating the normalized execution duration of the task according to the start execution time, the end execution time, and the frequency of the task execution by the processor.

[0083] In one embodiment of the present application, the calculation formula for calculating the normalized execution time Taskrunningtime of a task based on the start execution time, the end execution time, and the frequency of the processor executing the task is:

[0084] In calculation formula (1), delta (such as the delta shown in Figure 6) is the difference between the end execution time and the start execution time of the task, which can be expressed as the execution duration of the task. Curfreq is the frequency of the processor when executing the task. For example, curfreq can be the maximum frequency or average frequency of multiple frequency points collected during the execution of the task by the processor. Maxfreq is the theoretical maximum frequency of the processor, such as 2.3 GHz, 2.8 GHz, 3.5 GHz or other frequencies. Capacity is the computing power value of the processor, such as 512, 1024, 2048 or other values.

[0085] S104: Determine the in-window load of the task according to the normalized execution time of the task.

[0086] In one embodiment of the present application, the in-window load of a task is the load of the task within the statistical window. If the task is executed multiple times within the statistical window, the sum of all normalized execution times of the task when it is executed multiple times within the statistical window is calculated to obtain the in-window load of the task. If the task is executed once within the statistical window, the normalized execution time of the task when it is executed within the statistical window is determined as the in-window load of the task.

[0087] In one embodiment of the present application, the sum of all normalized execution times of a task when it is executed multiple times within a statistical window is calculated to obtain the calculation formula for the task load window Taskloadwindow:

[0088] In calculation formula (2), n is the total number of task executions within a statistical window.

[0089] S105 , determining the load ratio within the task window according to the load within the task window and the statistical window.

[0090] In one embodiment of the present application, the ratio between the load in the task window and the statistical window is calculated to obtain the load ratio Highloadratewindow in the task window, where the calculation formula is:

[0091] In the calculation formula (3), Taskloadwindow is the load within the task window, and window is the duration of the statistical window.

[0092] S106: Determine whether the task's in-window load ratio is greater than or equal to a preset threshold. If so, proceed to S107. If less than the preset threshold, the task is considered a low-load task, and the process returns to S101.

[0093] In an embodiment of the present application, the preset threshold may be 80%, 90% or other values.

[0094] S107: Determine that the task is a high-load task, and manage the task according to a preset strategy.

[0095] In one embodiment of the present application, if a task is determined to be a high-load task, the task is managed and controlled by binding a core or setting a uclamp (utilization clamping parameter). The core binding operation is to bind the high-load task to the small-core processor, so that the small-core processor processes the high-load task, thereby preventing the large-core processor from processing too many high-load tasks. The method of setting uclamp is to set the utilization clamping parameters of the task according to the utilization clamping mechanism, so that the task is automatically executed by the small-core processor of the electronic device.

[0096] The utilization clamping parameters include tracking signals in two dimensions: CPU Utilization (CPU utilization) and Task Utilization (CPU utilization by tasks). CPU Utilization is used to indicate how busy the CPU is, and the kernel scheduler drives the CPU to adjust its frequency based on CPU Utilization. Task Utilization is used to indicate the CPU utilization of the task set by the user control, indicating the execution priority of the task. Task Utilization can assist the kernel scheduler in performing CPU core selection operations. For example, Task D is not a task in a critical scenario, but is identified as a high-load task. The user space can lower the execution priority of Task D by setting Task D's Task Utilization, so that the kernel scheduler schedules Task D to the small-core processor for execution. For another example, Task E is identified as a low-load task, but it is a task in a critical scenario. The user space can increase the execution priority of Task E by setting Task E's Task Utilization, so that the kernel scheduler schedules Task E to the large-core processor for execution.

[0097] In one embodiment of the present application, the Task Utilization parameter is the range of CPU utilization [util_min, util_max]. By setting the util_max in the Task Utilization parameter of the high-load task to a smaller value, the execution priority of the high-load task is reduced, so that the kernel scheduler schedules the high-load task to the small-core processor for execution.

[0098] As an open ecosystem, the smartphone system allows users to download third-party applications from various channels. If the application version is abnormal or there are system bugs, some abnormally high-load tasks will be generated. Smartphones are also performance- and power-sensitive devices. The generation of these abnormally high loads will introduce performance and power consumption issues such as key tasks preempting the large-core CPU and causing the CPU to run at a high frequency for a long time. Through the above-mentioned embodiments of the present application, the normalized load of the tasks within the statistical window can be determined, and whether the task is a high-load task can be identified based on the normalized load, thereby improving the accuracy of identifying high-load tasks, and when a task is identified as a high-load task, the high-load task can be managed and controlled in a timely manner to prevent high-load tasks from affecting the execution of key tasks.

[0099] In another embodiment of the present application, after determining that the task is a high-load task, it is also determined whether the high-load task is a critical task. If the high-load task is a critical task, there is no need to manage the high-load task. If the high-load task is not a critical task, the high-load task is managed.

[0100] In another embodiment of the present application, it is determined whether the high-load task is a task of the foreground application. If the high-load task is a task of the foreground application, the high-load task is determined to be a critical task; if the high-load task is not a task of the foreground application, the high-load task is determined to be not a critical task.

[0101] In another embodiment of the present application, it is determined whether the high-load task is a task that can perceive a scenario. If the high-load task is a task that can perceive a scenario, the high-load task is determined to be a critical task; if the high-load task is not a task that can perceive a scenario, the high-load task is determined to be a non-critical task. A perceptible scenario refers to a scenario in which a user interface of an electronic device changes.

[0102] In one embodiment, if a large number of tasks are running simultaneously in the electronic device system, statistics on the normalized loads of the large number of tasks in different statistical windows will generate a large amount of data, which may occupy a large amount of memory.

[0103] Refer to FIG7 , which is a flowchart of a task management method provided by another embodiment of the present application. The method is applied to an electronic device and includes:

[0104] S201 , recording the start execution time and the end execution time of each execution of a task within a preset time period.

[0105] In one embodiment of the present application, a task management process is created, and a statistics window is set to 1 second by the task management process. Within a preset time period, a timer starts timing the statistics window. When the task management process detects that a processor has started executing a task, the timer marks the timer's timing and records the start time of the task. When the task management process detects that the processor has finished processing the task, the timer marks the timer's timing again and records the end time of the task, thereby recording the start time and end time of each execution process of the task within 1 second. For example, the preset time period can be 10 seconds, 20 seconds, or other time.

[0106] S202, collecting the frequency points when the processor of the electronic device executes the task.

[0107] S203: Calculate the normalized execution duration of the task based on the start execution time, the end execution time, and the frequency.

[0108] The specific implementation of S202 to S203 is the same as that of S102 to S103 and will not be described in detail here.

[0109] S204 : Determine the normalized load of the task per second within a preset time period according to the normalized execution time of the task.

[0110] In one embodiment of the present application, if the number of times a task is executed per second is multiple times, the sum of all normalized execution times when the task is executed multiple times per second is calculated to obtain the normalized load of the task per second. If the number of times a task is executed per second is once, the normalized execution time when the task is executed per second is determined as the normalized load of the task per second. Based on the normalized load of the task per second, the normalized load of the task per second within a preset time period is obtained. For example, as shown in Figure 8, this is the normalized load of the task per second within 10 seconds.

[0111] S205 , obtaining the normalized load per second in a specified statistical window from the normalized load per second of the task in a preset time period.

[0112] For example, if the statistics window is set to 3 seconds, 5 seconds, 10 seconds, or another time period, and the preset time period is 10 seconds, the normalized load of each second in the first 3 seconds is obtained from the normalized load of the task within 10 seconds. Specifically, the normalized load of the first second is 0.22 seconds, the normalized load of the second second is 0 seconds, and the normalized load of the third second is 0.35 seconds.

[0113] S206 , determining the actual normalized load of the task in the specified statistical window according to the normalized load per second in the specified statistical window, the window load classification level, and the correspondence between the statistical window and the actual normalized load.

[0114] Refer to Figure 9, which is a schematic diagram of a table of correspondences between window load grading levels, statistical windows, and actual normalized loads provided in one embodiment of the present application. In one embodiment of the present application, the normalized load per second within a specified statistical window is compared with the table of correspondences between the window load grading levels, statistical windows, and actual normalized loads to determine the load grading per second within the specified statistical window. The actual normalized load corresponding to the load grading per second within the specified statistical window is determined based on the table of correspondences between the load grading per second within the specified statistical window and the window load grading levels, statistical windows, and actual normalized loads. The sum of multiple actual normalized loads corresponding to the load grading per second within the specified statistical window is calculated to obtain the actual normalized load of the task within the specified statistical window.

[0115] For example, the specified statistical window is 3 seconds. Combined with Figure 8, it can be seen that the normalized load of the task per second within 3 seconds is 0.22 seconds (indicating that the normalized load of the task within the first second is 0.22 seconds), 0 (indicating that the normalized load of the task within the second second is 0 seconds), and 0.35 seconds (indicating that the normalized load of the task within the third second is 0.35 seconds). Combined with Figure 9, it can be seen that 0.22 seconds corresponds to the load classification of 2 levels in 1 second, and 0.35 seconds corresponds to the load classification of 3 levels in 1 second; the actual normalized load corresponding to level 2 is 0.25 seconds, and the actual normalized load corresponding to level 3 is 0.38 seconds. Therefore, the actual normalized load of the task within 3 seconds is 0.25 seconds + 0.38 seconds = 0.63 seconds.

[0116] For another example, the specified statistical window is 5 seconds. Combined with Figure 8, it can be seen that the normalized load of the task per second within 5 seconds is 0.22 seconds, 0, 0.35 seconds, 0 (indicating that the normalized load of the task within the 4th second is 0 seconds), and 0.6 seconds (indicating that the normalized load of the task within the 5th second is 0.6 seconds). Combined with Figure 9, it can be seen that 0.22 seconds corresponds to the load classification of 2 levels in 1 second, 0.35 seconds corresponds to the load classification of 3 levels in 1 second, and 0.6 seconds corresponds to the load classification of 5 levels in 1 second. The actual normalized load corresponding to level 2 is 0.25 seconds, the actual normalized load corresponding to level 3 is 0.38 seconds, and the actual normalized load corresponding to level 5 is 0.63 seconds. The actual normalized load of the task within 5 seconds is 0.25 seconds + 0.38 + 0.63 seconds = 1.26 seconds.

[0117] For another example, if the statistical window is specified to be 10 seconds, combined with Figure 8, the normalized load of the task per second within 10 seconds is 0.22 seconds, 0, 0.35 seconds, 0, 0.6 seconds, 0 (indicating that the normalized load of the task within the 7th second is 0 seconds), 0 (indicating that the normalized load of the task within the 8th second is 0 seconds), 0.2 seconds (indicating that the normalized load of the task within the 9th second is 0.2 seconds), 0 (indicating that the normalized load of the task within the 9th second is 0 seconds), 0.1 seconds (indicating that the normalized load of the task within the 10th second is 0.1 seconds). Combined with Figure 9, it can be seen that 0.22 seconds corresponds to the load classification of 1 second. The load level is 2, 0.35 seconds corresponds to 3 levels in 1 second, 0.6 seconds corresponds to 5 levels in 1 second, 0.2 seconds corresponds to 2 levels in 1 second, and 0.1 seconds corresponds to 1 level in 1 second. The actual normalized load corresponding to level 2 is 0.25 seconds, the actual normalized load corresponding to level 3 is 0.38 seconds, the actual normalized load corresponding to level 5 is 0.63 seconds, and the actual normalized load corresponding to level 1 is 0.13 seconds. The actual normalized load of the task within 10 seconds is 0.25 seconds + 0.38 seconds + 0.63 seconds + 0.25 seconds + 0.13 seconds = 1.64 seconds.

[0118] S207 , determining the load level of the task in the specified statistical window according to the actual normalized load of the task in the specified statistical window, the window load classification level, and the correspondence between the statistical window and the actual normalized load.

[0119] In one embodiment of the present application, the actual normalized load of the task in the specified statistical window is compared with the window load classification level and the correspondence table between the statistical window and the actual normalized load to determine the load level of the task in the specified statistical window.

[0120] For example, the actual normalized load of the task within the 3-second statistical window is 0.63 seconds. By referring to the correspondence table between the window load classification level, statistical window and actual normalized load in Figure 9, it can be seen that the actual normalized load of the 3-second statistical window when the load classification is level 1 is 0.38 seconds, and the actual normalized load when the load classification is level 2 is 0.75 seconds. The actual normalized load of the task within the 3-second statistical window of 0.63 seconds is greater than 0.38 seconds and less than 0.75 seconds. Therefore, the load classification of the task within the 3-second statistical window is level 2.

[0121] For another example, the actual normalized load of the task within the 5-second statistical window is 1.26 seconds. By referring to the correspondence table between the window load classification level and the actual normalized load in Figure 9, it can be seen that the actual normalized load of the 5-second statistical window is 1.25 seconds when the load classification is level 2, and the actual normalized load is 1.88 seconds when the load classification is level 3. The actual normalized load of the task within the 5-second statistical window of 1.26 seconds is greater than 1.25 seconds and less than 1.88 seconds. Therefore, the load classification of the task within the 5-second statistical window is level 3.

[0122] For another example, the actual normalized load of the task within the 10-second statistical window is 1.64 seconds. By referring to the correspondence table between the window load classification level and the actual normalized load in Figure 9, it can be seen that the actual normalized load of the 10-second statistical window when the load classification is level 1 is 1.25 seconds, and the actual normalized load when the load classification is level 2 is 2.5 seconds. The actual normalized load of the task within the 10-second statistical window of 1.64 seconds is greater than 1.25 seconds and less than 2.5 seconds. Therefore, the load classification of the task within the 10-second statistical window is level 2.

[0123] Referring to Figure 10, based on the normalized load of the task per second within 10 seconds, it can be determined that within the specified statistical window of 1 second, the window load classification level of the 1st second task is level 2, the window load classification level of the 3rd second task is level 3, the window load classification level of the 5th second task is level 5, the window load classification level of the 8th second task is level 2, and the window load classification level of the 10th second task is level 1; within the specified statistical window of 3 seconds, the window load classification level of the first 3-second task is level 2, the window load classification level of the second 3-second task is level 2, and the window load classification level of the third 3-second task is level 1; within the specified statistical window of 5 seconds, the window load classification level of the first 5-second task is level 3, and the window load classification level of the second 5-second task is level 1; within the specified statistical window of 10 seconds, the window load classification level of the task is level 2.

[0124] S208: Determine whether the task's load level within the specified statistical window is greater than or equal to the preset threshold level corresponding to the specified statistical window. If the task's load level within the specified statistical window is greater than or equal to the preset threshold level corresponding to the specified statistical window, the process proceeds to S206. If the task's load level within the specified statistical window is less than the preset threshold level corresponding to the specified statistical window, the task is considered a low-load task, and the process returns to S201.

[0125] S209: Determine that the task is a high-load task, and manage the task according to a preset strategy.

[0126] The specific implementation of S209 is the same as that of S107 and will not be described in detail here.

[0127] In the above-mentioned embodiment of the present application, it is only necessary to record the normalized load of the task per second within a preset time period, and the load grading levels corresponding to different statistical windows can be determined through the correspondence between the window load grading levels, the statistical window and the actual normalized load. There is no need to calculate the load data of different statistical windows at the same time, which reduces the data storage overhead and the memory usage of the task management data.

[0128] The embodiment of the present application further provides an electronic device 100, as shown in Figure 11. The electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device. The embodiment of the present application does not impose any special restrictions on the specific type of the electronic device 100.

[0129] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0130] It should be understood that the structure illustrated in the embodiments 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, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

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

[0132] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0133] Processor 110 may also include a memory for storing instructions and data. In one embodiment of the present application, the memory in processor 110 is a cache memory. The memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use an instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces processor 110 latency, and thus improves system efficiency.

[0134] In one embodiment of the present application, the processor 110 may include one or more interfaces. The interfaces 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.

[0135] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In one embodiment of the present application, the processor 110 may include multiple I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface, thereby realizing the touch function of the electronic device 100.

[0136] The I2S interface can be used for audio communication. In one embodiment of the present application, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In one embodiment of the present application, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.

[0137] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In one embodiment of the present application, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In one embodiment of the present application, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, thereby realizing the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0138] The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In one embodiment of the present application, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In one embodiment of the present application, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through a Bluetooth headset.

[0139] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. MIPI interfaces include the Camera Serial Interface (CSI) and the Display Serial Interface (DSI). In one embodiment of the present application, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0140] The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or a data signal. In one embodiment of the present application, the GPIO interface can be used to connect the processor 110 to the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0141] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. The interface can also be used to connect other electronic devices 100, such as augmented reality devices.

[0142] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0143] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device 100 via the power management module 141.

[0144] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

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

[0146] 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 antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0147] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In one embodiment of the present application, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In one embodiment of the present application, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0148] 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 being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In one embodiment of the present application, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0149] The wireless communication module 160 can provide wireless communication solutions including Wireless Local Area Networks (WLAN) (such as Wireless Fidelity (Wi-Fi) network), 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 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0150] In one embodiment of the present application, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, 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).

[0151] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. The GPU is a task-management microprocessor that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0152] The display screen 194 is used to display images, videos, etc. The display screen 194 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), a mini-LED, a micro-LED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In one embodiment of the present application, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.

[0153] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0154] The ISP is used to process data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then transmitted to the ISP for processing and converted into an image visible to the naked eye. The ISP can also perform algorithmic optimization on image noise, brightness, and skin color. The ISP can also optimize parameters such as exposure and color temperature of the captured scene. In one embodiment of the present application, the ISP can be located in camera 193.

[0155] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In one embodiment of the present application, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0156] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0157] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0158] The NPU is a neural network (NN) computing processor that rapidly processes input information and continuously self-learns by drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain. The NPU enables intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.

[0159] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0160] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.

[0161] Non-volatile memory may include disk storage devices and flash memory.

[0162] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; it can be divided into single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage specification; it can be divided into universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.

[0163] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0164] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0165] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory.

[0166] The internal memory 121 or the external memory interface 120 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 110. The one or more computer programs include multiple instructions. When the multiple instructions are executed by the processor 110, the screen display detection method executed on the electronic device 100 in the above embodiment can be implemented to realize the screen display detection function of the electronic device 100.

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

[0168] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In one embodiment of the present application, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0169] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0170] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0171] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0172] The headphone jack 170D is used to connect a wired headphone and can be a USB interface 130 or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.

[0173] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0174] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0175] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0176] The SIM card interface 195 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 or removing it from the SIM card interface 195. 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 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 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 one embodiment of the present application, 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. An embodiment of the present application also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on the electronic device 100, the electronic device 100 executes the above-mentioned related method steps to implement the task management method in the above-mentioned embodiment.

[0177] An embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute the above-mentioned related steps to implement the task management method in the above-mentioned embodiment.

[0178] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory to enable the chip to execute the task management method in the above-mentioned method embodiments.

[0179] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.

[0180] 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.

[0181] In the several embodiments provided in this 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 merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, 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.

[0182] Units described as separate components may or may not be physically separate, and 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 places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0183] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0184] 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, 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 and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0185] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A task management method, applied to an electronic device, characterized in that The method includes: Recording the start execution time and the end execution time of each execution of the task within the statistical window; Collecting the frequency points when the processor of the electronic device executes the task; Calculating the normalized execution duration of the task according to the start execution time, the end execution time and the frequency points; Determining the load within the window of the task according to the normalized execution duration of the task; Determining the load ratio within the window of the task according to the load within the window of the task and the statistical window; If the load ratio within the window of the task is greater than or equal to a preset threshold, determining that the task is a high-load task and controlling the task according to a preset policy.

2. The task management method according to claim 1, characterized in that The recording of the start execution time and the end execution time of each execution of the task within the statistical window includes: Creating a task listener, listening to the thread that executes the task within the statistical window through the task listener, recording the creation time of the thread as the start execution time, and recording the destruction time of the thread as the end execution time.

3. The task management method according to claim 1, characterized in that, The collecting of the frequency points when the processor of the electronic device executes the task includes: During the execution of the task, collecting the real-time processor frequency points at preset time intervals; Determining the maximum frequency point or the average frequency point of the collected multiple processor frequency points as the frequency point when the processor executes the task.

4. The task management method according to claim 1, wherein The calculating of the normalized execution duration of the task according to the start execution time, the end execution time and the frequency points includes: Calculating the difference between the end execution time and the start execution time to obtain the execution duration of the task; Calculating the product of the ratio between the execution duration of the task, the frequency point and the theoretical maximum frequency point of the processor and the computing power of the processor to obtain the normalized execution duration.

5. The task management method according to claim 1, characterized in that The determining of the load within the window of the task according to the normalized execution duration of the task includes: If the number of executions of the task within the statistical window is multiple times, calculating the sum value of all the normalized execution durations of the multiple executions of the task within the statistical window to obtain the load within the window of the task; or If the number of executions of the task within the statistical window is once, determining the normalized execution duration of the task when it is executed within the statistical window as the load within the window of the task.

6. The task management method according to claim 1, characterized in that The determining of the load ratio within the window of the task according to the load within the window of the task and the statistical window includes: Calculating the ratio between the load within the window of the task and the statistical window to obtain the load ratio within the window of the task.

7. The task management method according to claim 1, wherein The controlling of the task according to a preset policy includes: Binding the task to the small-core processor of the electronic device and executing the task by the small-core processor.

8. The task management method according to claim 1, wherein The controlling of the task according to a preset policy includes: Setting the usage clamping parameter of the task according to the usage clamping mechanism so that the task is executed by the small-core processor of the electronic device.

9. A task management method, applied to an electronic device, characterized in that, The method includes: Recording the start execution time and the end execution time of each execution of the task per second within a preset time period; Collect the frequency points when the processor of the electronic device executes the task; Calculate the normalized execution duration of the task according to the start execution time, the end execution time, and the frequency points; Determine the normalized load per second of the task within the preset time period according to the normalized execution duration of the task; Obtain the normalized load per second within a specified statistical window from the normalized load per second of the task within the preset time period, where the specified statistical window is less than or equal to the preset time period; Determine the actual normalized load of the task within the specified statistical window according to the normalized load per second of the task within the specified statistical window, the window load grading levels, and the correspondence between the statistical window and the actual normalized load; Determine the load level of the task within the specified statistical window according to the actual normalized load of the task within the specified statistical window, the window load grading levels, and the correspondence between the statistical window and the actual normalized load; If the load level of the task within the specified statistical window is greater than or equal to the preset threshold level corresponding to the specified statistical window, determine that the task is a high-load task and control the task according to a preset policy.

10. The task management method according to claim 9, wherein, The recording of the start execution time and the end execution time each time the task is executed per second within the preset time period includes: Create a task listener, monitor the thread that executes the task per second through the task listener, record the creation time of the thread as the start execution time of the task, and record the destruction time of the thread as the end execution time of the task.

11. The task management method according to claim 9, wherein The calculating of the normalized execution duration of the task according to the start execution time, the end execution time, and the frequency points includes: Calculate the difference between the end execution time and the start execution time to obtain the execution duration of the task; Calculate the product of the ratio of the execution duration of the task, the frequency points, and the theoretical maximum frequency of the processor, and the computing power of the processor to obtain the normalized execution duration.

12. The task management method according to claim 9, wherein The determining of the normalized load per second of the task within the preset time period according to the normalized execution duration of the task includes: If the task is executed multiple times per second, calculate the sum of all the normalized execution durations when the task is executed multiple times per second to obtain the normalized load of the task per second; or If the task is executed once per second, determine the normalized execution duration when the task is executed per second as the normalized load of the task per second.

13. The task management method according to claim 9, characterized in that, The determining of the actual normalized load of the task within the specified statistical window according to the normalized load per second of the task within the specified statistical window, the window load grading levels, and the correspondence between the statistical window and the actual normalized load includes: Compare the normalized load per second of the task within the specified statistical window with the correspondence table of the window load grading levels and the correspondence between the statistical window and the actual normalized load to determine the load level of the task per second; Determine the actual normalized load corresponding to the load level of the task per second in the corresponding relationship table, and determine the sum of multiple actual normalized loads as the actual normalized load of the task within the specified statistical window.

14. The task management method according to claim 13, wherein The determining the load level of the task within the specified statistical window according to the actual normalized load of the task within the specified statistical window, the window load classification levels, and the corresponding relationship between the statistical window and the actual normalized load includes: Compare the actual normalized load of the task within the specified statistical window with the corresponding relationship table between the window load classification levels and the statistical window and the actual normalized load to determine the load level of the task within the specified statistical window.

15. The task management method according to claim 9, characterized in that, The controlling the task according to a preset policy includes: Bind the task to the small-core processor of the electronic device, and execute the task by the small-core processor.

16. The task management method according to claim 9, wherein The controlling the task according to a preset policy includes: Set the usage clamping parameter of the task according to the usage clamping mechanism so that the task is executed by the small-core processor of the electronic device.

17. An electronic device, characterized in that, The electronic device includes a memory and a processor: Wherein, the memory is used to store program instructions; The processor is used to read and execute the program instructions stored in the memory. When the program instructions are executed by the processor, the electronic device executes the task management method according to any one of claims 1 to 16.

18. A chip, coupled to a memory in an electronic device, characterized in that, The chip is used to control the electronic device to execute the task management method according to any one of claims 1 to 16.

19. A computer storage medium, characterized in that, The computer storage medium stores program instructions. When the program instructions run on the electronic device, the processor of the electronic device executes the task management method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • Task processing method and related equipment

    CN111104209A

  • Load statistics method and device, storage medium and electronic equipment

    CN113138909A

  • Task scheduling method and device and computer system

    CN114253701A

  • Resource scheduling method and device, equipment and storage medium

    CN117093374A

  • Method for Scheduling Multi-Core Processor, Terminal, and Storage Medium

    US20210208935A1