Resource control method and apparatus, and device
By dividing tasks into different groups and dynamically adjusting resource thresholds in electronic devices, the problem of uneven resource allocation is solved, system stability and user experience are improved, and flexible allocation and limitation of resources are achieved.
Patent Information
- Application Number
- PCT/CN2024/140688
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-31
- Filing Date
- 2024-12-19
- Publication Date
- 2025-12-04
AI Technical Summary
In electronic devices, when a large number of background tasks are created, it leads to uneven resource allocation, affecting system stability and user experience. Existing technologies have failed to effectively solve the problem of resource abuse.
By dividing tasks into different groups and dynamically adjusting the resource thresholds for each group, we ensure that important real-time tasks receive more resources and prevent background tasks from excessively consuming resources. We use parameter configuration, statistics, policy control, and dynamic adjustment modules to achieve flexible allocation and limitation of resources.
It improved system stability and user experience, prevented resource abuse, ensured resource allocation for important tasks, and enabled dynamic resource management.
Smart Images

Figure CN2024140688_04122025_PF_FP_ABST
Abstract
Description
A resource control method, apparatus and equipment
[0001] This application claims priority to Chinese Patent Application No. 202410708211.4, filed with the State Intellectual Property Office of China on May 31, 2024, entitled “A Resource Control Method, Apparatus and Equipment”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of terminal communication technology, and in particular to a resource control method, apparatus and device. Background Technology
[0003] With the continuous development of electronic devices, various types of tasks run within them. The device system allocates system resources, including central processing unit (CPU) resources, network resources, and memory resources, to these tasks. Currently, if a background application creates a large number of background tasks while a foreground application creates fewer foreground tasks, more resources will be allocated to the background tasks, while the foreground tasks, receiving fewer resources, will experience lag and other issues. This leads to resource abuse, affecting system stability, performance, and the user experience. Summary of the Invention
[0004] This application provides a resource control method, apparatus, and device. This method, by grouping tasks into different groups and dynamically adjusting the resource thresholds corresponding to each group, ensures resource allocation for important real-time tasks, avoiding lag and other issues, thus achieving dynamic resource management. This improves system stability, performance, and user experience.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] In a first aspect, this application provides a resource control method applied to an electronic device, the electronic device including a first task group and a second task group. The method includes: acquiring load information, the load information being used to characterize the resource usage corresponding to tasks in the first and second task groups; the first task group including real-time tasks corresponding to applications currently interacting with the user; a first resource threshold corresponding to the first task group being greater than a second resource threshold corresponding to the second task group; and the resource threshold being used to characterize the maximum resource usage corresponding to tasks in the task group. When the load information meets a first condition, the first resource threshold corresponding to the first task group is adjusted to a third resource threshold, and the second resource threshold corresponding to the second task group is adjusted to a fourth resource threshold.
[0007] Thus, on the one hand, in order to conform to the characteristic of prioritizing terminal interaction, this embodiment of the application can divide tasks into different groups and set a higher resource threshold for the task group including real-time tasks, so that system resources can be allocated and restricted more flexibly according to the characteristics of the group. When the second task group includes a large number of background tasks created by the application, this embodiment of the application can set a lower resource threshold for the second task group and a higher resource threshold for the first task group. On the basis of allocating resources more towards tasks that have a greater impact on user experience, it can avoid the situation where a large number of background tasks are allocated too many resources, and prevent resource abuse from affecting system stability.
[0008] On the other hand, embodiments of this application can dynamically adjust the resource thresholds corresponding to different groups based on the load information of those groups. That is, the electronic device can adjust the resource thresholds corresponding to the first task group and the second task group based on the system's operating status and when the load information meets a first condition. For example, if the number of real-time tasks in the first task group increases and the number of ordinary tasks in the second task group decreases, the resource threshold corresponding to the first task group can be increased. In this way, embodiments of this application can ensure resource allocation for important real-time tasks, avoiding lag and other issues, thus achieving dynamic resource management. This improves system stability, performance, and user experience.
[0009] In some possible implementations, when the load information meets the first condition, during the process of adjusting the first resource threshold to the third resource threshold and the second resource threshold to the fourth resource threshold, if the resource usage of the first task group in the load information is greater than the first resource threshold and the resource usage of the second task group is less than the second resource threshold within N consecutive preset periods, the first resource threshold can be increased by a first ratio to obtain the third resource threshold, and the second resource threshold can be decreased by a first ratio to obtain the fourth resource threshold.
[0010] Alternatively, if, within N consecutive preset periods, the resource usage of the first task group is less than the first resource threshold, and the resource usage of the second task group is greater than the second resource threshold, the first resource threshold can be reduced by a second ratio to obtain a third resource threshold, and the second resource threshold can be increased by a second ratio to obtain a fourth resource threshold; N is greater than 1.
[0011] Thus, this embodiment of the application can determine the load information over N consecutive preset periods. In scenarios where the resource usage of a task group exceeds a resource threshold, by dynamically adjusting the resource threshold of the task group, not only can resource allocation be more inclined towards tasks that have a greater impact on user experience, but it can also maximize the satisfaction of the mobile phone's foreground and background operation needs. This maximizes the satisfaction of the differences in system operating environments and ensures the operational requirements of the mobile phone system.
[0012] In some implementations, the method further includes: the electronic device determining a first ratio based on the difference between the resource usage of the second task group and a second resource threshold. The electronic device may also determine a second ratio based on the difference between the resource usage of the first task group and the first resource threshold.
[0013] Therefore, in the process of adjusting resource thresholds in this embodiment, when the resource usage of a task group does not exceed the resource threshold, not all unused resources are allocated to the task group that exceeds the resource threshold. Instead, an appropriate ratio is determined by the difference between the resource usage and the resource threshold to adjust the resource thresholds of the two task groups. This ensures a more balanced allocation of system resources while simultaneously meeting the operational needs of both task groups, thus improving system stability and performance.
[0014] In some possible implementations, the method further includes: the electronic device may, at preset intervals, suspend the execution of at least one unexecuted task in the first task group when the resource usage of the first task group in the load information exceeds a first resource threshold; and / or, suspend the execution of at least one unexecuted task in the second task group when the resource usage of the second task group exceeds a second resource threshold.
[0015] Thus, this embodiment of the application can control tasks within a task group based on their execution status within a preset period. Specifically, when the resource usage of a task in a task group exceeds a resource threshold, at least one unexecuted task in the task group will be paused to allow priority scheduling of tasks in other task groups. This avoids background applications creating a large number of background tasks that consume excessive resources, preventing resource abuse from affecting system stability and performance. Consequently, it improves the user experience.
[0016] In some possible implementations, when the load information meets the first condition, during the process of adjusting the first resource threshold to the third resource threshold and the second resource threshold to the fourth resource threshold, N preset periods can be accumulated within a preset time period. When the resource usage of the first task group in the load information is greater than the first resource threshold and the resource usage of the second task group is less than the second resource threshold, the first resource threshold is increased by a first ratio to obtain the third resource threshold, and the second resource threshold is decreased by a first ratio to obtain the fourth resource threshold.
[0017] Alternatively, if, within a preset time period, after accumulating N preset cycles, the resource usage of the first task group is less than the first resource threshold, and the resource usage of the second task group is greater than the second resource threshold, then the first resource threshold is reduced by a second ratio to obtain a third resource threshold, and the second resource threshold is increased by a second ratio to obtain a fourth resource threshold; N is greater than 1.
[0018] Thus, this embodiment of the application can also determine the load information accumulated over N preset periods within a preset time period. If, within N preset periods, one task group's resource usage exceeds a corresponding resource threshold, while the other task group's resource usage is less than its corresponding resource threshold, the resource threshold for the task group with resource usage exceeding the threshold is increased, and the resource threshold for the task group with resource usage less than the threshold is decreased. This not only ensures that resource allocation is more biased towards tasks that have a greater impact on user experience but also maximizes the satisfaction of the mobile phone's foreground and background operation needs. By maximizing the satisfaction of the operational needs of different task groups, the stability and performance of the system are improved.
[0019] In some implementation methods, the approach further includes: the electronic device can divide the application into a first task group and a second task group based on the task attributes of the corresponding task, whereby the task attributes characterize the latency requirements of the task. The electronic device can also obtain the running tasks corresponding to currently running applications and add them to the first and second task groups based on their corresponding task attributes.
[0020] Thus, this embodiment of the application can divide tasks into different groups based on task attributes and add the running tasks corresponding to currently launched applications to different groups, facilitating the association of a large number of running tasks. Simultaneously, it is more beneficial for electronic devices to prioritize interaction needs during subsequent resource allocation, thereby improving the user experience.
[0021] In some feasible implementations, the electronic device includes multiple second task groups. During the process of adjusting the first resource threshold corresponding to the first task group to the third resource threshold and adjusting the second resource threshold corresponding to the second task group to the fourth resource threshold, if, within N consecutive preset periods, the resource usage of the first target task group is greater than its corresponding resource threshold and the resource usage of the second target task group is less than its corresponding resource threshold, the resource threshold of the first target task group is increased by a third ratio, and the resource threshold of the second target task group is decreased by a third ratio.
[0022] Thus, in this embodiment of the application, when multiple task groups exist, load information within N consecutive preset periods can also be determined. This allows for dynamic adjustment of resource thresholds for multiple task groups, maximizing the satisfaction of the operational needs of different task groups, improving adjustment flexibility, and enhancing system stability and performance.
[0023] In some implementations, the first task group includes a first sub-task group and a second sub-task group, where the first sub-task group corresponds to a first sub-resource threshold, and the second sub-task group corresponds to a second sub-resource threshold. During the process of acquiring load information, the load information of both the first and second sub-task groups can be obtained.
[0024] The method further includes: when the load information of the first sub-task group and the load information of the second sub-task group meet the second condition, the electronic device can adjust the first sub-resource threshold corresponding to the first sub-task group to the third sub-resource threshold, and adjust the second sub-resource threshold corresponding to the second sub-task group to the fourth sub-resource threshold.
[0025] Thus, embodiments of this application can further group different task groups into subgroups. Grouping facilitates the management of a large number of tasks. It also allows for dynamic adjustment of sub-resource thresholds corresponding to different subgroups, thereby improving adjustment flexibility.
[0026] In some possible implementations, when the load information of the first sub-task group and the load information of the second sub-task group meet the second condition, during the process of adjusting the first sub-resource threshold corresponding to the first sub-task group to the third sub-resource threshold, and adjusting the second sub-resource threshold corresponding to the second sub-task group to the fourth sub-resource threshold, if within N consecutive preset periods, in the first sub-task group and the second sub-task group, the resource usage of the third target task group is greater than its corresponding resource threshold, and the resource usage of the fourth target task group is less than its corresponding resource threshold, then the resource threshold of the third target task group is increased according to a fourth ratio, and the resource threshold of the fourth target task group is decreased according to a fourth ratio.
[0027] Thus, in this embodiment of the application, if within N consecutive preset periods, one subtask group in the first subtask group and the second subtask group exceeds the upper limit while the other subtask group does not, the resource threshold for the subtask group exceeding the upper limit can be increased, and the resource threshold for the subtask group not exceeding the upper limit can be decreased. This allows resource allocation to be more inclined towards tasks that have a greater impact on user experience, maximizing the satisfaction of differences in system operating environments and ensuring the operational needs of the mobile phone system.
[0028] In some implementations, the resource threshold is the time slice threshold corresponding to the CPU core time slice of the central processing unit, the task is a process or thread, the first task group includes the real-time task corresponding to the application currently interacting with the user, one task group in the second task group includes the foreground task running in the foreground of the electronic device, and one task group in the second task group includes the background task running in the background of the electronic device.
[0029] In some implementations, the second resource threshold corresponding to the second task group including foreground tasks is greater than the second resource threshold corresponding to the second task group including background tasks.
[0030] Thus, by setting the second resource threshold for the second task group, which includes foreground tasks, to be greater than the second resource threshold for the second task group, which includes background tasks, resource allocation can be more biased towards tasks that have a greater impact on user experience. This also maximizes the satisfaction of both foreground and background operation needs, thereby improving the user experience.
[0031] In some implementation methods, during the process of adding running tasks to the first task group and the second task group, the running tasks can be sorted in ascending order according to their task identifiers and then added to the first task group and the second task group.
[0032] Thus, by utilizing the task identifiers of running tasks and arranging them in ascending order, the corresponding running tasks can be located more quickly. For example, a binary search algorithm can be used for retrieval, improving search efficiency. This also facilitates subsequent statistics on resource usage corresponding to running tasks in the first and second task groups, improving statistical efficiency.
[0033] Secondly, embodiments of this application also provide a resource control device, which includes a parameter configuration module, a statistics module, a strategy management module, and a dynamic adjustment module.
[0034] The parameter configuration module is configured to configure a first resource threshold corresponding to a first task group and a second resource threshold corresponding to a second task group; the first task group includes real-time tasks corresponding to the application currently interacting with the user, the first resource threshold corresponding to the first task group is greater than the second resource threshold corresponding to the second task group, and the resource threshold is used to characterize the maximum resource usage of the tasks in the task group.
[0035] The statistics module is configured to obtain load information, which is used to characterize the resource usage of tasks in the first and second task groups.
[0036] The policy control module is configured to determine whether the load information meets the first condition.
[0037] The dynamic adjustment module is configured to adjust the first resource threshold corresponding to the first task group to the third resource threshold and the second resource threshold corresponding to the second task group to the fourth resource threshold when the load information meets the first condition.
[0038] Thus, the resource control device provided in this application embodiment can set a lower resource threshold for the second task group and a higher resource threshold for the first task group. This ensures that resource allocation is more favorable to tasks that significantly impact user experience, while preventing excessive resource allocation to a large number of background tasks and avoiding resource abuse that could affect system stability. Simultaneously, by dynamically adjusting the resource thresholds, resource allocation for critical real-time tasks can be guaranteed, preventing lag and other issues, thereby achieving dynamic resource management.
[0039] Thirdly, embodiments of this application also provide an electronic device, which includes a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, which includes computer instructions, and when the computer instructions are executed by the processor, the electronic device performs the method described in the first aspect.
[0040] Fourthly, embodiments of this application also provide a computer-readable medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the method described in the first aspect.
[0041] Fifthly, embodiments of this application also provide a computer program product containing instructions that, when executed on a computer or processor, cause the computer or processor to perform the method described in the first aspect. Attached Figure Description
[0042] Figure 1 is a schematic diagram of the hardware structure of a mobile phone provided in an embodiment of this application;
[0043] Figure 2 is a schematic diagram of the software structure of a mobile phone provided in an embodiment of this application;
[0044] Figure 3 is a schematic diagram of a scenario with different task groups provided in an embodiment of this application;
[0045] Figure 4 is a schematic diagram of a process for implementing dynamic control according to an embodiment of this application;
[0046] Figure 5 is a flowchart illustrating a restricted task provided in an embodiment of this application;
[0047] Figure 6 is a schematic diagram of a process for adjusting resource thresholds provided in an embodiment of this application;
[0048] Figure 7 is a schematic flowchart of adjusting a first resource threshold and a second resource threshold according to an embodiment of this application;
[0049] Figure 8 is a schematic diagram of a subtask group provided in an embodiment of this application;
[0050] Figure 9 is a schematic diagram of a resource control device provided in an embodiment of this application;
[0051] Figure 10 is a schematic diagram of the structure of a mobile phone provided in an embodiment of this application. Detailed Implementation
[0052] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. In the description of this application, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can represent A or B. "And / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone, where A and B can be singular or plural. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple. In addition, in order to clearly describe the technical solutions of the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish the same or similar items with basically the same function and effect.
[0053] Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or order of execution, and that "first," "second," etc., are not necessarily different. Furthermore, in some embodiments of this application, words such as "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner for ease of understanding.
[0054] Furthermore, the device architecture and business scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of device architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0055] Time slice: The runtime allocated by the central processing unit (CPU) of an electronic device to various tasks. In essence, the CPU's runtime is divided into many time segments, and each task is allocated one of these time segments, called its time slice, which is the allowed runtime for that task.
[0056] A task is a series of device instructions that achieve a specific goal. A task can be either a process or a thread. Typically, a task corresponds to a series of device operations, such as input operations, download operations, encoding / decoding operations, etc. A process or thread completes a task by executing the device operations within it.
[0057] A process is a running activity of a program on a specific set of data within a device. It is the basic unit for system resource allocation and the foundation of the operating system structure. A process is a memory area containing certain resources. The operating system uses processes to divide its work into functional units. One or more execution units contained within a process are called threads. A process also has a private virtual address space, which can only be accessed by its contained threads. A thread can only belong to one process and can only access the resources owned by that process. When the operating system creates a process, that process automatically requests a thread named the main thread or primary thread.
[0058] Application: Also known as an application, an application consists of one or more processes that work together.
[0059] With the continuous development of electronic devices, various types of tasks run within them. Device systems allocate system resources, including CPU resources, network resources, and memory resources, to these tasks. Typically, resource allocation strategies can schedule different types of tasks based on the order in which they are acquired or their priority. For example, more resources might be allocated to busy tasks, while fewer resources might be allocated to idle tasks.
[0060] In this scenario, if a background application creates a large number of background tasks while a foreground application creates fewer foreground tasks, more resources will be allocated to the background tasks, while the foreground tasks, receiving fewer resources, will experience lag and other issues. This approach leads to resource abuse, impacting system stability, performance, and the user experience.
[0061] To address the aforementioned technical problems, embodiments of this application provide a resource control method, apparatus, and device. The resource control method can be applied to an electronic device, which includes a first task group and a second task group. The method includes: the electronic device acquiring load information, which characterizes the resource usage of tasks in the first and second task groups; the first task group includes real-time tasks corresponding to applications currently interacting with the user; a first resource threshold corresponding to the first task group is greater than a second resource threshold corresponding to the second task group; and the resource threshold characterizes the maximum resource usage of tasks in the task group. The electronic device can also adjust the first resource threshold corresponding to the first task group to a third resource threshold and adjust the second resource threshold corresponding to the second task group to a fourth resource threshold when the load information meets a first condition.
[0062] Thus, the electronic device provided in this application embodiment includes a first task group and a second task group. The first task group includes real-time tasks, and the maximum resource usage of the first task group is greater than the maximum resource usage of the second task group. When the load information meets a first condition, the electronic device can adjust the first resource threshold of the first task group to a third resource threshold, and the second resource threshold of the second task group to a fourth resource threshold. In other words, the electronic device can configure higher resource usage for real-time tasks, and when the resource usage of the first and second task groups meets the first condition, it can also dynamically adjust their corresponding resource thresholds.
[0063] The first task group contains real-time tasks, which can include tasks corresponding to the user's current interaction, i.e., tasks with time constraints. The second task group contains ordinary tasks (non-real-time tasks), which can include tasks without time constraints, such as background tasks and tasks that are always running in the foreground but do not interact with the user.
[0064] On the one hand, in order to conform to the characteristic of prioritizing terminal interaction, this embodiment of the application can divide tasks into different groups and set a higher resource threshold for task groups including real-time tasks, so that system resources can be allocated and restricted more flexibly according to the characteristics of the groups. When the second task group includes a large number of background tasks created by the application, this embodiment of the application can set a lower resource threshold for the second task group and a higher resource threshold for the first task group. On the basis of allocating resources more towards tasks that have a greater impact on user experience, it can avoid the situation where a large number of background tasks are allocated too many resources, and prevent resource abuse from affecting system stability.
[0065] On the other hand, embodiments of this application can dynamically adjust the resource thresholds corresponding to different groups based on the load information of those groups. That is, the electronic device can adjust the resource thresholds corresponding to the first task group and the second task group based on the system's operating status and when the load information meets a first condition. For example, if the number of real-time tasks in the first task group increases and the number of ordinary tasks in the second task group decreases, the resource threshold corresponding to the first task group can be increased. In this way, embodiments of this application can ensure resource allocation for important real-time tasks, avoiding lag and other issues, thus achieving dynamic resource management. This improves system stability, performance, and user experience.
[0066] The electronic devices provided in this application embodiment include terminals, servers, and other devices. Terminals may include mobile phones, smartwatches, tablets, foldable electronic devices, desktop computers, laptops, handheld computers, laptops, Ultra-Mobile Personal Computers (UMPCs), netbooks, cellular phones, Personal Digital Assistants (PDAs), Augmented Reality (AR) devices, Virtual Reality (VR) devices, Artificial Intelligence (AI) devices, wearable devices, and in-vehicle devices. Servers may be a single server or a server cluster composed of multiple servers.
[0067] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal and server can be connected directly or indirectly via wired or wireless communication, which is not limited herein. The embodiments of this application do not impose special limitations on the specific type of electronic device.
[0068] Furthermore, the operating system installed on electronic devices includes, but is not limited to, Or other operating systems. This application does not limit the specific type of electronic device or the type of operating system installed on it.
[0069] The following will use a mobile phone, an electronic device, as an example to illustrate the application of resource control methods. Figure 1 shows a schematic diagram of the hardware structure of a mobile phone provided in an embodiment of this application.
[0070] As shown in Figure 1, the mobile phone 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0071] The aforementioned sensor module 180 may include sensors such as a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, and a bone conduction sensor 180M.
[0072] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the mobile phone 100. In other embodiments of this application, the mobile phone 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0073] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0074] The controller can serve as the central nervous system and command center of the mobile phone 100. Based on the instruction operation code and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.
[0075] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0076] In some embodiments, the processor 110 may include one or more interfaces. 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, etc.
[0077] The wireless communication function of mobile phone 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0078] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in mobile phone 100 can be used to cover one or more 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 some other embodiments, the antennas can be used in conjunction with a tuning switch.
[0079] The mobile phone 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0080] The display screen 194 is used to display a target interface, 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 (AMOLED), a flexible light-emitting diode (FLED), a Miniled LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0081] The mobile phone 100 can achieve shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0082] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, 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, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0083] The mobile phone 100 can achieve audio functions such as music playback and recording through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0084] In some embodiments, the processor 110 may configure a first task group and a second task group, and configure corresponding resource thresholds. The processor 110 may also obtain load information of the first task group and the second task group, and adjust the resource thresholds corresponding to the first task group and the second task group when the load information meets a first condition.
[0085] The software system of mobile phone 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment takes the layered architecture Android system as an example to illustrate the software structure of mobile phone 100.
[0086] Figure 2 is a schematic diagram of the software structure of a mobile phone according to an embodiment of this application.
[0087] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0088] The application layer can include a series of application packages.
[0089] As shown in Figure 2, the application package may include applications such as the first application, the second application, and the third application.
[0090] In some embodiments of this application, the first application and the second application are both foreground applications, and the third application can be a background application. The first application is the application corresponding to the operation currently being performed by the user, and it is visible to the user on the mobile phone side. It is understood that a visible application refers to an application that the user can see on the mobile phone's display screen. The second application is the application currently running in the foreground of the mobile phone, excluding the first application, and the background application is the application running in the background of the mobile phone. It should be noted that the first application, the second application, and the third application can be of the same type, and this application embodiment does not specifically limit the application type or number of applications corresponding to the first application, the second application, and the third application.
[0091] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0092] As shown in Figure 2, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and parameter configuration module, etc.
[0093] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0094] Content providers store and retrieve data, making that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, and more.
[0095] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0096] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).
[0097] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0098] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0099] The Android Runtime consists of core libraries and a virtual machine. The Android Runtime is responsible for the scheduling and management of the Android system.
[0100] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0101] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application 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.
[0102] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.
[0103] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0104] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0105] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0106] A 2D graphics engine is a graphics engine for 2D drawing.
[0107] The kernel layer is the layer between hardware and software. The kernel layer includes at least a first task group, a second task group, a statistics module, a policy control module, and a dynamic adjustment module.
[0108] In some embodiments of this application, there are parameter configuration modules, statistics modules, policy control modules, and dynamic adjustment modules. The parameter configuration module configures grouping parameters corresponding to the first and second task groups, which may include resource threshold parameters and task quantity parameters, etc. The statistics module calculates the resource usage of the first and second task groups within a specified period, where resource usage may include, for example, CPU execution time. The resource usage is used to subsequently determine whether the resource threshold corresponding to the group has been reached, and also serves as input to the dynamic adjustment module. The policy control module determines whether the resource usage of the first and second task groups meets a first condition. The dynamic adjustment module adjusts the resource threshold corresponding to each group when it is determined that the resource usage of the first and second task groups meets the first condition.
[0109] The resource control method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings. In the following embodiments, a first device (e.g., a mobile phone) will continue to be used as an example for illustration. The method may include:
[0110] In some embodiments of this application, to facilitate resource control, multiple task groups may be pre-acquired. These task groups can be process groups or thread groups. For ease of description, process groups will be used as an example below.
[0111] For example, a mobile phone can group all processes into process groups, and then perform resource control, such as time slice allocation, on different groups as a whole. Within a process group, a task is a process of the system. Each process group may include one or more processes, or it may contain no processes.
[0112] In some embodiments of this application, when a mobile phone acquires multiple task groups, it can pre-divide the task groups according to the task attributes corresponding to the tasks.
[0113] Specifically, the mobile phone can divide tasks into a first task group and a second task group based on the task attributes of the corresponding tasks of the applications. The task attributes characterize the latency requirements of the tasks. For example, tasks in the first task group are classified as real-time tasks, including frame-drawing tasks in the user's currently used application and tasks related to frame-drawing tasks. Examples include the RenderService main thread, the ArkUI application main thread, and the RSHardward thread. Tasks in the second task group are classified as ordinary tasks (non-real-time tasks), such as download tasks for browser applications running in the background or download tasks for email applications running in the background. In other words, the first task group can include real-time processes of currently running applications, while the second task group can include ordinary processes of currently running applications.
[0114] In some other embodiments of this application, referring to Figure 3(A), the mobile phone can pre-divide different task groups according to the running attributes of the application (also known as a task or process) during the process of acquiring multiple task groups.
[0115] The running attributes of an application refer to whether it runs in the foreground or background, and whether the corresponding process runs within the operating system kernel or interacts with the user. Similarly, the running attributes of one or more processes associated with an application also indicate whether they are foreground or background processes. For example, the tasks in the first task group have foreground running attributes, while the tasks in the second task group have background running attributes.
[0116] It should be noted that the task attributes and running status of the above tasks can be obtained through the corresponding task description information. For example, the process control block of a process may include process description information, which may include the process's unique identifier, functional information, task attributes, running attributes, and other descriptive information.
[0117] In some other embodiments of this application, referring to Figure 3(B), the mobile phone can also divide different task groups according to the task attributes and running attributes corresponding to the task during the process of acquiring multiple task groups.
[0118] Specifically, the mobile phone can divide the application into a first task group and multiple second task groups based on the task attributes and running attributes of the corresponding task.
[0119] For example, a mobile phone can divide a task into a first task group and multiple second task groups based on the task attributes of the corresponding tasks of an application. The first task group includes real-time tasks, and the second task group includes regular tasks. The mobile phone can also divide the second task group according to the running attributes of the application, resulting in multiple second task groups. For example, one second task group includes regular tasks running in the foreground, and another second task group includes regular tasks running in the background.
[0120] In some embodiments of this application, the resource threshold can be the time slice threshold corresponding to the CPU core time slice of the central processing unit, the task is a process or thread, the first task group includes the real-time task corresponding to the application currently interacting with the user, one task group in the second task group includes the foreground task running in the foreground of the electronic device, and one task group in the second task group includes the background task running in the background of the electronic device.
[0121] For example, the first task group can be a header process group, and the second task group can include a foreground process group and a background process group. The header process group can include processes currently related to user interaction. For example, if the user is currently using a video application and a social application, the header process group can include the frame-drawing process corresponding to the video application, the frame-drawing process corresponding to the social application, etc. The foreground process group can include processes running in the foreground. For example, the foreground process group can include the launcher process corresponding to the desktop application. The background process group can include processes running in the background that do not require user interaction.
[0122] It should be noted that the mobile phone can also pre-set other task groups besides the first and second task groups mentioned above. The number and names of the task groups shown in this application are merely illustrative examples, and this application does not impose any specific limitations on them. Similarly, the above grouping is also only an illustrative example, and this application does not impose any specific limitations on it. It is understood that in the embodiments of this application, a task group includes a certain application, that is, the group includes the process corresponding to that application. For example, the header process group includes one or more processes corresponding to the browser application.
[0123] Thus, embodiments of this application can divide tasks into different groups based on task attributes, or based on both task attributes and runtime attributes, and add the running tasks corresponding to currently launched applications to different groups, facilitating the association of a large number of running tasks. Simultaneously, it is more beneficial for electronic devices to prioritize interaction needs during subsequent resource allocation, thereby improving the user experience.
[0124] In some embodiments of this application, the mobile phone may also pre-set resource thresholds corresponding to the first task group and the second task group.
[0125] Specifically, the mobile phone can set a first resource threshold for the first task group and a second resource threshold for the second task group based on user usage information within a preset time period. The user usage information can include the cumulative usage time of the applications used on the phone and download information such as the number of downloads and installations for those applications.
[0126] For example, the mobile phone can set resource thresholds for the first task group and the second task group based on the cumulative usage time of the applications used within a preset period. For instance, the mobile phone can determine the applications whose daily cumulative usage time is greater than the time threshold as the first application, and the applications whose daily cumulative usage time is less than or equal to the time threshold as the second or third application, based on the daily cumulative usage time of the applications used within one month.
[0127] As another example, the mobile phone can also set resource thresholds for the first and second task groups based on the download information of the applications used within a preset time period. For instance, the mobile phone can determine that applications with more download and installation counts than a threshold are the first applications, and applications with fewer download and installation counts than or equal to the threshold are the second or third applications. It should be noted that the user usage information within the aforementioned preset time period can be obtained by the mobile phone through application data corresponding to the applications in the application market. This application embodiment does not specifically limit the method of obtaining such information.
[0128] In some embodiments of this application, the preset resource threshold may refer to a pre-set amount of resources. Specifically, in a scenario where the resource is CPU resources, the resource threshold may represent the maximum execution time corresponding to a task in a task group. For example, the first resource threshold may be the maximum time slice corresponding to a task in a first task group. The second resource threshold may be the maximum time slice corresponding to a task in a second task group.
[0129] As another example, a resource threshold can also represent the maximum proportion of the execution time of a task within a task group relative to the total CPU time slice. For instance, a first resource threshold could be the maximum proportion of the time slice of the first task group relative to the total CPU time slice. A second resource threshold could be the maximum proportion of the time slice of the second task group relative to the total CPU time slice.
[0130] To prioritize tasks that have a greater impact on user experience during resource control, the resource threshold setting strategy proposed in this application can set a higher resource threshold for the first task group, which includes the task the user is currently interacting with. Similarly, to prevent numerous background tasks from competing for resources, a lower resource threshold can be set for the second task group, which includes the background tasks.
[0131] In some embodiments of this application, the first resource threshold corresponding to the first task group is greater than the second resource threshold corresponding to the second task group, and the second resource threshold corresponding to the second task group including foreground tasks is greater than the second resource threshold corresponding to the second task group including background tasks.
[0132] For ease of description, the resource thresholds are illustrated below using proportions. The first resource threshold is 80%, the second resource threshold corresponding to the second task group including foreground tasks is 50%, and the second resource threshold corresponding to the second task group including background tasks is 10%. As another example, the first resource threshold is 70%, the second resource threshold corresponding to the second task group including foreground tasks is 55%, and the second resource threshold corresponding to the second task group including background tasks is 15%. As yet another example, the first resource threshold is 85%, the second resource threshold corresponding to the second task group including foreground tasks is 45%, and the second resource threshold corresponding to the second task group including background tasks is 5%. It should be noted that this application embodiment does not specifically limit the values corresponding to the first and second resource thresholds.
[0133] In some embodiments of this application, referring to Figure 4, the mobile phone can read the grouping configuration during system initialization, such as the grouping including a first task group and two second task groups, as well as the resource threshold corresponding to each task group. The mobile phone can also initialize a tree-shaped grouping structure based on the above-mentioned different grouping configuration strategies, utilizing a tree-shaped grouping management data structure. Here, the tree-shaped grouping structure refers to processing data in a tree-like grouping manner, which can clearly represent the hierarchical relationship between data. Tree-shaped grouping structures are typically used to process data with parent-child relationships or hierarchical structures, such as grouping a large number of execution tasks into different task groups, with each task group having different sub-task groups at the next level.
[0134] The mobile phone can collect load information and add data to a tree-like grouping structure, such as adding corresponding tasks to corresponding task groups. The mobile phone can also dynamically manage and adjust the tasks in the tree-like grouping structure. When the resource usage of a task reaches a resource threshold, the mobile phone can perform management and / or adjust the resource threshold for the task.
[0135] In some feasible implementations, during the process of adding data to the tree-like grouping structure, the phone can obtain the running tasks corresponding to the currently launched applications and add the running tasks to the first task group and the second task group according to the task attributes corresponding to the running tasks.
[0136] For example, a mobile phone can obtain all processes corresponding to currently running applications, and add real-time processes to the first task group and ordinary processes to the second task group according to the task attributes of the processes.
[0137] In other possible implementations, the mobile phone can also obtain the running tasks corresponding to currently launched applications, and add the running tasks to the first task group and the second task group according to the task attributes and running attributes corresponding to the running tasks.
[0138] For example, the phone can obtain all processes corresponding to currently running applications, add real-time processes to a first task group, and add ordinary processes to a second task group. Then, based on the running attributes of the ordinary processes, the phone can add foreground ordinary processes to one second task group and background ordinary processes to another second task group.
[0139] It should be noted that the embodiments of this application do not specifically limit the process of adding running tasks to the corresponding task group.
[0140] Thus, this embodiment of the application can pre-divide different task groups and set different resource thresholds for different task groups. Specifically, the resource threshold for task groups corresponding to real-time tasks is relatively high. Furthermore, running tasks corresponding to launched applications can be added to different task groups based on their task attributes, facilitating subsequent resource control based on the running status of tasks within the group. It is evident that by setting different task groups, system resources can be controlled more flexibly based on the characteristics of each group. Simultaneously, real-time tasks can utilize more resources during execution, thus aligning with the interaction-first characteristics of mobile phones. This, in turn, enhances the user experience.
[0141] In some embodiments of this application, when a mobile phone adds running tasks to a first task group and a second task group, it can sort the running tasks in ascending order according to the task identifier of the running tasks and add them to the first task group and the second task group.
[0142] In other words, the phone can sort processes or threads in ascending order based on their identifiers, such as process ID or thread ID, and add them to the first task group and the second task group.
[0143] Thus, by utilizing the task identifiers of running tasks and arranging them in ascending order, the corresponding running tasks can be located more quickly. For example, a binary search algorithm can be used for retrieval, improving search efficiency. This also facilitates subsequent statistics on resource usage corresponding to running tasks in the first and second task groups, improving statistical efficiency.
[0144] In some embodiments of this application, the mobile phone can obtain the resource usage of different task groups within a preset period, and dynamically adjust the corresponding resource threshold and restrict the tasks in the task group according to the resource usage of different task groups.
[0145] In some embodiments, referring to Figure 5, the mobile phone can also obtain load information (step 501). The load information is used to characterize the resource usage corresponding to tasks in the first task group and the second task group. The mobile phone can also, at preset intervals, pause the execution of at least one unexecuted task in the first task group if the resource usage of the first task group in the load information exceeds a first resource threshold; and / or, pause the execution of at least one unexecuted task in the second task group when the resource usage of the second task group exceeds a second resource threshold (step 502).
[0146] For example, the first resource threshold is 80%, and the second resource threshold is 50%. The mobile phone can obtain the kernel time slice corresponding to the processes in the first task group and the second task group at preset intervals.
[0147] For example, the mobile phone acquires the kernel time slices corresponding to the processes in the first and second task groups every 5 seconds. If the ratio of the kernel time slices corresponding to the processes in the first task group to the total CPU time slices is less than 80%, and the ratio of the kernel time slices corresponding to the processes in the second task group to the total CPU time slices is greater than 50%, the mobile phone can restrict the processes in the second task group in the next preset cycle. That is, it can suspend the execution of at least one unexecuted process in the second task group and not allocate CPU resources to at least one unexecuted process in the second task group, thereby reducing the execution of tasks in that task group and making it easier to prioritize the scheduling of tasks in other task groups.
[0148] For example, the phone acquires the kernel time slices corresponding to processes in the first and second task groups every 10 seconds. If the ratio of the kernel time slices corresponding to processes in the first task group to the total CPU time slices is greater than 80%, and the ratio of the kernel time slices corresponding to processes in the second task group to the total CPU time slices is less than 50%, the phone can restrict the processes in the first task group in the next preset cycle. That is, it can suspend the execution of at least one unexecuted process in the first task group and not allocate CPU resources to at least one unexecuted process in the first task group, thereby reducing the execution of tasks in that task group and making it easier to prioritize the scheduling of tasks in other task groups.
[0149] It should be noted that this application does not limit the specific values corresponding to the preset period.
[0150] Thus, this embodiment of the application can control the execution of tasks in a task group within a preset period based on their running status. Specifically, when the resource usage of a task in the task group exceeds a resource threshold, the execution of at least one unexecuted task in the task group will be paused. This avoids background applications creating a large number of background tasks and consuming excessive resources, preventing resource abuse from affecting system stability and performance. Ultimately, this improves the user experience.
[0151] In some embodiments, referring to FIG6, the mobile phone can also obtain load information (step 601). When the load information meets the first condition, the mobile phone can also adjust the first resource threshold corresponding to the first task group to the third resource threshold, and adjust the second resource threshold corresponding to the second task group to the fourth resource threshold (step 602).
[0152] Specifically, referring to Figure 7(A), the mobile phone can, within N consecutive preset periods, increase the first resource threshold and decrease the second resource threshold when the resource usage of the first task group in the load information is greater than the first resource threshold and the resource usage of the second task group is less than the second resource threshold. Specifically, the first resource threshold is increased by a first ratio to obtain a third resource threshold, and the second resource threshold is decreased by a first ratio to obtain a fourth resource threshold, where N is greater than 1.
[0153] Alternatively, referring to Figure 7(B), if the resource usage of the first task group is less than the first resource threshold and the resource usage of the second task group is greater than the second resource threshold within N consecutive preset periods, the mobile phone can lower the first resource threshold and raise the second resource threshold in the next preset period. Specifically, the first resource threshold is lowered according to a second ratio to obtain a third resource threshold, and the second resource threshold is raised according to a second ratio to obtain a fourth resource threshold, where N is greater than 1.
[0154] For example, the first resource threshold is 80%, and the second resource threshold is 50%. The mobile phone can acquire kernel time slices corresponding to processes in the first and second task groups for N consecutive preset periods. For instance, if the mobile phone acquires kernel time slices corresponding to processes in the first and second task groups for three consecutive preset periods, such as 15 seconds, and if the proportion of kernel time slices corresponding to processes in the first task group to the total CPU time slices is greater than 80% for all three consecutive preset periods, and the proportion of kernel time slices corresponding to processes in the second task group to the total CPU time slices is less than 50%, the mobile phone can increase the first resource threshold to the third resource threshold, such as 90%, and decrease the second resource threshold to the fourth resource threshold, such as 40%, according to a second ratio in the next preset period.
[0155] For example, if a mobile phone obtains kernel time slices corresponding to processes in the first and second task groups for three consecutive preset periods, such as 15 seconds, and if the proportion of kernel time slices corresponding to processes in the first task group to the total CPU time slices is less than 80% in all three consecutive preset periods, and the proportion of kernel time slices corresponding to processes in the second task group to the total CPU time slices is greater than 50%, the mobile phone can reduce the first resource threshold to the third resource threshold, such as 70%, and increase the second resource threshold to the fourth resource threshold, such as 60%, according to the first proportion in the next preset period.
[0156] Thus, this embodiment of the application can also determine the load information within N consecutive preset periods. Within N consecutive preset periods, if one task group's resource usage exceeds the corresponding resource threshold, and the other task group's resource usage is less than the corresponding resource threshold, the resource threshold for the task group with resource usage exceeding the threshold is increased, and the resource threshold for the task group with resource usage less than the threshold is decreased. In scenarios where the resource usage of a task group exceeds the resource threshold, dynamically adjusting the resource threshold of the task group not only ensures that resource allocation is more inclined towards tasks that have a greater impact on user experience, but also maximizes the satisfaction of the mobile phone's foreground and background operation needs. This maximizes the satisfaction of the differences in system operating environments and ensures the operational needs of the mobile phone system.
[0157] In some embodiments of this application, the mobile phone can determine a first ratio based on the difference between the resource usage of the second task group and a second resource threshold. The mobile phone can also determine a second ratio based on the difference between the resource usage of the first task group and the first resource threshold.
[0158] In some possible implementations, the mobile phone can determine a first difference between the second resource threshold and the resource usage of the second task group within N consecutive preset periods, and assign a preset weight to the first difference to obtain a first ratio.
[0159] For example, the first resource threshold for the first task group is preset to 80%, and the second resource threshold for the second task group is preset to 50%.
[0160] For example, in the first preset period, the kernel time slices corresponding to processes in the first task group account for 90% of the total CPU time slices, while those in the second task group account for 10%. In the second preset period, the kernel time slices corresponding to processes in the first task group account for 90% of the total CPU time slices, while those in the second task group account for 20%. It is evident that in two consecutive preset periods, the proportion of kernel time slices corresponding to processes in the first task group is greater than 80% of the total CPU time slices, while the proportion of kernel time slices corresponding to processes in the second task group is less than 50%.
[0161] The mobile phone determines that the first difference between the second resource threshold and the resource usage of the second task group is 70% over two consecutive preset periods. Specifically, in the first preset period, the difference between the second resource threshold and the resource usage of the second task group is 40%. In the second preset period, the difference is 30%. Thus, the first difference is obtained by adding the corresponding differences in the two preset periods. The mobile phone can assign a preset weight, such as 0.1, to the first difference, resulting in a first proportion of 7%. Subsequently, the mobile phone can raise the first resource threshold to a third resource threshold of 87% and lower the second resource threshold to a fourth resource threshold of 43%.
[0162] In other possible implementations, the mobile phone can determine the average difference between the second resource threshold and the resource usage of the second task group over N preset periods, and assign a preset weight to the average difference to obtain a first ratio.
[0163] In some implementation methods, the mobile phone can determine a second difference between the first resource threshold and the resource usage of the first task group over N consecutive preset periods, and assign a preset weight to the second difference to obtain a second ratio. It should be noted that the process of obtaining the second ratio is similar to the process of obtaining the first ratio described above, and will not be repeated here.
[0164] In other possible implementations, the mobile phone can also determine the aforementioned first ratio based on the difference between the resource usage of the first task group and the first resource threshold. Similarly, the mobile phone can also determine the aforementioned second ratio based on the difference between the resource usage of the second task group and the second resource threshold.
[0165] It should be noted that the processes for obtaining the first and second ratios described above are merely illustrative and are not specifically limited in the embodiments of this application. Furthermore, the embodiments of this application do not limit the specific values corresponding to the first and second ratios.
[0166] Therefore, in adjusting resource thresholds, this embodiment can adjust them based on the difference between the resource usage of the task group exceeding the threshold and its resource threshold. That is, when the resource usage of a task group does not exceed the resource threshold, not all unused resources are allocated to the task group exceeding the threshold. Instead, a suitable ratio is determined by the difference between the resource usage and its resource threshold to adjust the resource thresholds of the two task groups. This ensures a more balanced allocation of system resources while simultaneously meeting the operational needs of both task groups, improving system stability and performance.
[0167] In some embodiments of this application, the mobile phone can also accumulate N preset cycles within a preset time period. When the resource usage of the first task group in the load information is greater than the first resource threshold and the resource usage of the second task group is less than the second resource threshold, the first resource threshold is increased by a first ratio to obtain a third resource threshold and the second resource threshold is decreased to obtain a fourth resource threshold.
[0168] Alternatively, if, within a preset time period, after accumulating N preset cycles, the resource usage of the first task group is less than the first resource threshold, and the resource usage of the second task group is greater than the second resource threshold, then the first resource threshold is reduced by a second ratio to obtain a third resource threshold, and the second resource threshold is increased to obtain a fourth resource threshold; N is greater than 1.
[0169] In other words, the phone can also be set to a preset duration, which is greater than N preset periods. In this way, the phone can accumulate multiple preset periods within a certain preset duration. When the resource usage of the first task group in the load information is greater than the first resource threshold, and the resource usage of the second task group is less than the second resource threshold, the first and second resource thresholds are adjusted.
[0170] Alternatively, the mobile phone can accumulate multiple preset cycles within a certain preset time period. When the resource usage of the first task group in the load information is less than the first resource threshold and the resource usage of the second task group is greater than the second resource threshold, the first resource threshold and the second resource threshold are adjusted.
[0171] Thus, this embodiment of the application can also determine the load information accumulated over N preset periods within a preset time period. If, within N preset periods, one task group's resource usage exceeds the corresponding resource threshold, and the other task group's resource usage is less than the corresponding resource threshold, the resource threshold for the task group with resource usage exceeding the threshold is increased, and the resource threshold for the task group with resource usage less than the threshold is decreased. In scenarios where the resource usage of a task group exceeds the resource threshold, the resource threshold for the task group can be dynamically adjusted more flexibly. This not only allows resource allocation to be more inclined towards tasks that have a greater impact on user experience but also maximizes the satisfaction of the mobile phone's foreground and background operation needs. By maximizing the satisfaction of the operational needs of different task groups, the stability and performance of the system are improved.
[0172] In some embodiments of this application, the electronic device may include multiple second task groups. Based on the above strategy, the mobile phone may, within N consecutive preset periods, when the resource usage of the first target task group is greater than its corresponding resource threshold and the resource usage of the second target task group is less than its corresponding resource threshold, increase the resource threshold of the first target task group and decrease the resource threshold of the second target task group according to a third ratio.
[0173] For example, within three consecutive preset cycles, the mobile phone can identify task groups with resource usage exceeding their corresponding resource thresholds as the first target task group and task groups with resource usage below their corresponding resource thresholds as the second target task groups, from among the first task group and multiple second task groups. Furthermore, it can increase the resource threshold of the first target task group and decrease the resource threshold of the second target task groups according to a third ratio.
[0174] In other words, in this application embodiment, if one task group in the first task group and multiple second task groups exceeds the upper limit while another task group does not exceed the upper limit within N consecutive preset periods, the resource threshold of the task group that exceeds the upper limit can be increased, and the resource threshold of the task group that does not exceed the upper limit can be decreased.
[0175] Within the first task group and multiple second task groups, there may be multiple task groups whose resource usage exceeds their corresponding resource thresholds, or multiple task groups whose resource usage is less than their corresponding resource thresholds. In other words, the first and second target task groups may not correspond to a single task group, but rather to multiple task groups.
[0176] In one feasible approach, if the resource usage of one of the first task groups and multiple second task groups exceeds its corresponding resource threshold, i.e., the first target task group includes a first task group and a second task group, the mobile phone can prioritize increasing the resource threshold corresponding to the first task group.
[0177] For example, continuing with the first task group as the header process group, and the second task group including the foreground process group and the background process group, the resource usage of the header process group and the foreground process group is greater than their corresponding resource thresholds, while the resource usage of the background process group is less than its corresponding resource threshold. That is, the first target task group consists of the header process group and the foreground process group, and the second target task group consists of the background process group. The mobile phone can increase the resource threshold corresponding to the header process group according to a third ratio, and decrease the resource threshold corresponding to the background process group according to the same third ratio.
[0178] In another possible implementation, if the resource usage of the first task group is less than its corresponding resource threshold, and the resource usage of one of the multiple second task groups is less than its corresponding resource threshold, that is, the second target task group includes the first task group and the second task group, the mobile phone can prioritize reducing the resource threshold corresponding to the second task group.
[0179] For example, the resource usage of the foreground process group is greater than its corresponding resource threshold, while the resource usage of the header process group and the background process group is less than their corresponding resource thresholds. That is, the first target task group is the foreground process group, and the second target task group consists of the header process group and the background process group. The mobile phone can increase the resource threshold corresponding to the foreground process group according to a third ratio, and decrease the resource threshold corresponding to the background process group according to the same third ratio.
[0180] Thus, in this embodiment of the application, when multiple task groups exist, load information within N consecutive preset periods can also be determined. This allows for dynamic adjustment of resource thresholds for multiple task groups, maximizing the satisfaction of the operational needs of different task groups, improving adjustment flexibility, and enhancing system stability and performance.
[0181] In some embodiments of this application, the mobile phone can also divide different groups into different subgroups according to preset rules, and set corresponding sub-resource thresholds for different subgroups.
[0182] In some implementations, the mobile phone can divide the tasks into a first task group based on the priority of the real-time tasks. Referring to Figure 8, for example, the first task group includes a first sub-task group and a second sub-task group, where the priority of the real-time tasks in the first sub-task group is higher than the priority of the real-time tasks in the second sub-task group.
[0183] The first sub-task group corresponds to a first sub-resource threshold, and the second sub-task group corresponds to a second sub-resource threshold. The first and second sub-resource thresholds can also be set according to the priority of the real-time tasks. For example, in real-time tasks, the download task has a lower priority than the drawing task. Therefore, the first sub-resource threshold corresponding to the first sub-task group including the drawing task is greater than the second sub-resource threshold corresponding to the second sub-task group including the download task.
[0184] In other possible implementations, the mobile phone can also divide the task into a first task group based on the number of real-time tasks. For example, this includes a first sub-task group and a second sub-task group, where the number of real-time tasks in the first sub-task group may be the same as or different from the number of real-time tasks in the second sub-task group.
[0185] Specifically, when the number of real-time tasks in the first sub-task group is the same as the number of real-time tasks in the second sub-task group, the first sub-resource threshold is equal to the second sub-resource threshold. When the number of real-time tasks in the first sub-task group is different from the number of real-time tasks in the second sub-task group, the sub-resource threshold of the task group with more tasks is greater than the sub-resource threshold of the task group with fewer tasks.
[0186] In some embodiments of this application, the mobile phone can also obtain load information of the first sub-task group and the second sub-task group. Furthermore, when the load information of the first sub-task group and the load information of the second sub-task group meet a second condition, the mobile phone can adjust the first sub-resource threshold corresponding to the first sub-task group to a third sub-resource threshold, and adjust the second sub-resource threshold corresponding to the second sub-task group to a fourth sub-resource threshold.
[0187] Specifically, within N consecutive preset periods, if in the first sub-task group and the second sub-task group, the resource usage of the third target task group is greater than its corresponding resource threshold, and the resource usage of the fourth target task group is less than its corresponding resource threshold, the mobile phone can increase the resource threshold of the third target task group according to the fourth ratio and decrease the resource threshold of the fourth target task group according to the fourth ratio.
[0188] In other words, in the embodiments of this application, if within N consecutive preset periods, one of the subtask groups in the first subtask group and the second subtask group exceeds the upper limit while the other subtask group does not exceed the upper limit, the resource threshold of the subtask group that exceeds the upper limit can be increased, and the resource threshold of the subtask group that does not exceed the upper limit can be decreased.
[0189] It should be noted that the process of adjusting the sub-resource threshold corresponding to the sub-task group is similar to the process of adjusting the resource threshold corresponding to the task group described above, and will not be repeated here. The first ratio, second ratio, third ratio, and fourth ratio described above can be the same or different. In the embodiments of this application, the process of determining the first ratio, second ratio, third ratio, and fourth ratio can be the same or different, and no specific limitation is made on the determination process corresponding to the first ratio, second ratio, third ratio, and fourth ratio.
[0190] Thus, embodiments of this application can further group different task groups into subgroups. Grouping facilitates the management of a large number of tasks. Specifically, tasks can be grouped according to their different priorities, which is more conducive to meeting the interaction-priority requirements of electronic devices.
[0191] Similarly, it allows for dynamic adjustment of sub-resource thresholds corresponding to different subgroups. Specifically, the sub-resource thresholds for each subgroup can be the same, reflecting the fairness of threshold setting. This improves the flexibility of adjustment.
[0192] In some embodiments of this application, during the operation of the mobile phone, the running attributes of tasks in different task groups may change over time. That is, the tasks in the first task group and the tasks in the second task group are not fixed. The mobile phone can dynamically adjust the tasks in the first and second task groups over time, such as dynamically adding processes to or deleting them from the task groups.
[0193] Specifically, the phone can also monitor various running tasks, such as listening for changes in the state of running processes. When a process changes from foreground to background, the phone can determine whether the process is running in the foreground or background after the change.
[0194] For example, every 5 seconds, a list of all running processes is retrieved, and the status of each running process in the list is determined as either foreground or background running. The current running status of a process can be compared with its previous running status. If the previous running status of a process is different from its current running status, it can be determined that the process has changed its foreground / background status. The phone can then determine the current running status of the process and add it to the corresponding task group.
[0195] For example, for a newly added interactive process, if the phone determines that the interactive process is running in the foreground and the corresponding task attribute is a real-time task, then the interactive process is added to the first task group. For a download process, if the phone determines that the download process is running in the background, then the background process is added to the second task group.
[0196] Thus, this embodiment of the application can also dynamically adjust the tasks in the task group when the running status of a task changes, so as to set the tasks in the appropriate task group. In this way, when the load information corresponding to the task group is obtained and the resource threshold is adjusted, it can be ensured that each task can be supplied in a timely manner, realizing the flexibility and dynamism of resource control.
[0197] This application also provides a resource control device, which can be applied in electronic devices or set up independently. Referring to Figure 9, the resource control device includes a parameter configuration module 901, a statistics module 902, a strategy management module 903, and a dynamic adjustment module 904.
[0198] The parameter configuration module 901 is configured to configure a first resource threshold corresponding to a first task group and a second resource threshold corresponding to a second task group; the first task group includes real-time tasks corresponding to the application currently interacting with the user, the first resource threshold corresponding to the first task group is greater than the second resource threshold corresponding to the second task group, and the resource threshold is used to characterize the maximum resource usage of the tasks in the task group.
[0199] The statistics module 902 is configured to obtain load information, which is used to characterize the resource usage of tasks in the first task group and the second task group.
[0200] The policy control module 903 is configured to determine whether the load information meets the first condition.
[0201] The dynamic adjustment module 904 is configured to adjust the first resource threshold corresponding to the first task group to the third resource threshold and the second resource threshold corresponding to the second task group to the fourth resource threshold when the load information meets the first condition.
[0202] In some solutions, multiple embodiments of this application can be combined, and the combined solution can be implemented. Optionally, some operations in the process of each method embodiment may be combined, and / or the order of some operations may be changed. Furthermore, the execution order between the steps of each process is merely exemplary and does not constitute a limitation on the execution order between steps; other execution orders are also possible. It is not intended to indicate that the execution order is the only possible order in which these operations can be performed.
[0203] Those skilled in the art will conceive of various ways to reorder the operations described in the embodiments of this application. Furthermore, it should be noted that process details involved in one embodiment of this application are similarly applicable to other embodiments, or different embodiments can be combined.
[0204] Furthermore, some steps in the method embodiments can be equivalently replaced with other possible steps. Alternatively, some steps in the method embodiments may be optional and can be deleted in certain use cases. Or, other possible steps may be added to the method embodiments.
[0205] Furthermore, the various method embodiments can be implemented individually or in combination.
[0206] This application also provides an electronic device, such as the mobile phone described above, as shown in FIG10. The mobile phone may include one or more processors 1010, memory 1020 and communication interface 1030.
[0207] The memory 1020, communication interface 1030, and processor 1010 are coupled together. For example, the memory 1020, communication interface 1030, and processor 1010 can be coupled together via bus 1040.
[0208] The communication interface 1030 is used for data transmission with other devices. The memory 1020 stores computer program code. The computer program code includes computer instructions, which, when executed by the processor 1010, cause the electronic device to perform the relevant method steps in the embodiments of this application.
[0209] The processor 1010 may be a processor or controller, such as a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with this disclosure. The processor may also be a combination that implements computational functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0210] Bus 1040 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The aforementioned bus 1040 can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used in Figure 10, but this does not indicate that there is only one bus or one type of bus.
[0211] This application also provides an electronic device, which includes a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, which includes computer instructions, and when the computer instructions are executed by the processor, the electronic device performs the relevant method steps in the above method embodiments.
[0212] This application also provides a communication device, which includes a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, which includes computer instructions, and when the computer instructions are executed by the processor, the communication device performs the relevant method steps in the above method embodiments.
[0213] This application also provides a computer-readable storage medium storing computer program code. When the processor executes the computer program code, the electronic device executes the relevant method steps in the above method embodiments.
[0214] This application also provides a computer program product containing instructions that, when executed on a computer or processor, cause the computer or processor to perform the relevant method steps as described in the above method embodiments.
[0215] This application also provides a chip system, including: a processor coupled to a memory, the memory being used to store programs or instructions, and when the program or instructions are executed by the processor, the chip system enables the methods in any of the above method embodiments.
[0216] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.
[0217] Optionally, the chip system may contain one or more memories. The memory may be integrated with the processor or disposed separately from it; this application embodiment does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed separately on different chips. This application embodiment does not specifically limit the type of memory or the arrangement of the memory and processor.
[0218] For example, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0219] The electronic devices, computer storage media, or computer program products provided in this application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0220] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above 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.
[0221] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0222] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units, located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0223] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0224] If the integrated unit is implemented as 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 solutions of the embodiments of this application, or the contributing parts, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0225] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A resource control method, characterized in that, Applied to an electronic device, the electronic device comprising a first task group and a second task group, the method includes: Obtain load information, which is used to characterize the resource usage of tasks in the first task group and the second task group. The first task group includes real-time tasks corresponding to applications currently interacting with the user. The first resource threshold corresponding to the first task group is greater than the second resource threshold corresponding to the second task group. The resource threshold is used to characterize the maximum resource usage of tasks in the task group. When the load information meets the first condition, the first resource threshold corresponding to the first task group is adjusted to the third resource threshold, and the second resource threshold corresponding to the second task group is adjusted to the fourth resource threshold.
2. The method according to claim 1, characterized in that, The step of adjusting the first resource threshold to a third resource threshold and the second resource threshold to a fourth resource threshold when the load information meets the first condition includes: If, within N consecutive preset periods, the resource usage of the first task group in the load information is greater than the first resource threshold, and the resource usage of the second task group is less than the second resource threshold, the first resource threshold is increased by a first ratio to obtain the third resource threshold, and the second resource threshold is decreased by a first ratio to obtain the fourth resource threshold. Alternatively, if, within N consecutive preset periods, the resource usage of the first task group is less than the first resource threshold, and the resource usage of the second task group is greater than the second resource threshold, the first resource threshold is reduced by a second ratio to obtain the third resource threshold, and the second resource threshold is increased by a second ratio to obtain the fourth resource threshold; N is greater than 1.
3. The method according to claim 2, characterized in that, The method further includes: The first ratio is determined based on the difference between the resource usage of the second task group and the second resource threshold; The second ratio is determined based on the difference between the resource usage of the first task group and the first resource threshold.
4. The method according to any one of claims 1-3, characterized in that, The method further includes: At preset intervals, if the resource usage of the first task group in the load information exceeds the first resource threshold, the execution of at least one unexecuted task in the first task group is suspended; and / or, if the resource usage of the second task group exceeds the second resource threshold, the execution of at least one unexecuted task in the second task group is suspended.
5. The method according to claim 1, characterized in that, The step of adjusting the first resource threshold to a third resource threshold and the second resource threshold to a fourth resource threshold when the load information meets the first condition includes: If, within a preset time period, there are N preset cycles, and the resource usage of the first task group in the load information is greater than the first resource threshold, and the resource usage of the second task group is less than the second resource threshold, then the first resource threshold is increased by a first ratio to obtain the third resource threshold, and the second resource threshold is decreased by a first ratio to obtain the fourth resource threshold. Alternatively, if, within a preset time period, after accumulating N preset cycles, the resource usage of the first task group is less than the first resource threshold, and the resource usage of the second task group is greater than the second resource threshold, then the first resource threshold is reduced by a second ratio to obtain the third resource threshold, and the second resource threshold is increased by a second ratio to obtain the fourth resource threshold; where N is greater than 1.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: Based on the task attributes of the corresponding task of the application, the first task group and the second task group are divided, and the task attributes are used to characterize the latency requirements of the corresponding task. Get the running tasks corresponding to currently running applications; Based on the task attributes corresponding to the running task, the running task is added to the first task group and the second task group.
7. The method according to any one of claims 1-6, characterized in that, The electronic device includes multiple second task groups, and adjusting the first resource threshold corresponding to the first task group to a third resource threshold, and adjusting the second resource threshold corresponding to the second task group to a fourth resource threshold, includes: Within N consecutive preset periods, if in the first task group and multiple second task groups, there exists a first target task group whose resource usage exceeds its corresponding resource threshold, and a second target task group whose resource usage is less than its corresponding resource threshold, then the resource threshold of the first target task group is increased according to a third ratio, and the resource threshold of the second target task group is decreased according to the third ratio.
8. The method according to any one of claims 1-7, characterized in that, The first task group includes a first sub-task group and a second sub-task group, the first sub-task group corresponds to a first sub-resource threshold, and the second sub-task group corresponds to a second sub-resource threshold; The acquisition of load information includes: Obtain the load information of the first subtask group and the load information of the second subtask group; The method further includes: When the load information of the first sub-task group and the load information of the second sub-task group meet the second condition, the first sub-resource threshold corresponding to the first sub-task group is adjusted to the third sub-resource threshold, and the second sub-resource threshold corresponding to the second sub-task group is adjusted to the fourth sub-resource threshold.
9. The method according to claim 8, characterized in that, The step of adjusting the first sub-resource threshold corresponding to the first sub-task group to the third sub-resource threshold and adjusting the second sub-resource threshold corresponding to the second sub-task group to the fourth sub-resource threshold when the load information of the first sub-task group and the load information of the second sub-task group meet the second condition includes: Within N consecutive preset periods, if in the first subtask group and the second subtask group, the resource usage of the third target task group is greater than its corresponding resource threshold, and the resource usage of the fourth target task group is less than its corresponding resource threshold, then the resource threshold of the third target task group is increased according to the fourth ratio, and the resource threshold of the fourth target task group is decreased according to the fourth ratio.
10. The method according to claim 7, characterized in that, The resource threshold is the time slice threshold corresponding to the CPU core time slice of the central processing unit. The task is a process or thread. The first task group includes real-time tasks corresponding to the application currently interacting with the user. One task group in the second task group includes foreground tasks running in the foreground of the electronic device. Another task group in the second task group includes background tasks running in the background of the electronic device.
11. The method according to claim 10, characterized in that, The second resource threshold corresponding to the second task group including the foreground task is greater than the second resource threshold corresponding to the second task group including the background task.
12. The method according to claim 6, characterized in that, Adding the running task to the first task group and the second task group includes: Based on the task identifier of the running task, the running tasks are sorted in ascending order and added to the first task group and the second task group.
13. A resource control device, characterized in that, The resource control device includes a parameter configuration module, a statistics module, a strategy management module, and a dynamic adjustment module. The parameter configuration module is configured to configure a first resource threshold corresponding to a first task group and a second resource threshold corresponding to a second task group; the first task group includes real-time tasks corresponding to the application currently interacting with the user, the first resource threshold corresponding to the first task group is greater than the second resource threshold corresponding to the second task group, and the resource threshold is used to characterize the maximum resource usage of the tasks in the task group. The statistics module is configured to acquire load information, which is used to characterize the resource usage of tasks in the first task group and the second task group. The policy control module is configured to determine whether the load information meets a first condition; The dynamic adjustment module is configured to adjust the first resource threshold corresponding to the first task group to the third resource threshold and the second resource threshold corresponding to the second task group to the fourth resource threshold when the load information meets the first condition.
14. An electronic device, characterized in that, The electronic device includes a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform the method as described in any one of claims 1-12.
15. A computer-readable medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-12.
16. A computer program product, characterized in that, The computer program product includes instructions that, when executed on a computer or processor, cause the computer or processor to perform the method as described in any one of claims 1-12.
Citation Information
Patent Citations
Resource control method, device and equipment
CN121050876A
Resource regulation method based on container, device and medium
CN108415772A
Service resource control method and device, equipment and storage medium
CN110196767A
Resource allocation method, storage medium, processor and system
CN114371929A
Task grouping method and apparatus, electronic device, and computer storage medium
US20180247265A1
Cited By
Heterogeneous computing power system computing power resource scheduling method and system based on intelligent prediction
CN121722529A