Resource management method, device and medium
By dynamically adjusting the core resources of the process group in the multi-core processor environment, the problem of insufficient flexibility in the fixed CPUset configuration is solved, the user experience and resource utilization efficiency is improved, and the needs of diversified interactive operation scenarios are adapted.
Patent Information
- Application Number
- CN202411069921.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-13
AI Technical Summary
In a multi-core processor environment, the fixed configuration of CPUset lacks flexibility and cannot meet the user experience needs of diversified interactive operations, resulting in unbalanced resource utilization and affecting user experience.
By determining the current interactive operation scenario, the processes in the running state are divided into the first process group and the second process group, the number of core resources of the second process group is dynamically adjusted, and some resources are released to the first process group to adapt to different operation scenarios resource requirements.
It effectively improves the user's experience of using electronic devices, dynamically adjusts the CPU core resources, ensures that processes related to the operation scenarios obtain more resources, and improves system performance and resource utilization efficiency.
Smart Images

Figure CN119127463A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of processor resource management technology. More specifically, the present disclosure relates to a resource management method, device and medium. Background Art
[0002] Smart terminal devices have become an indispensable part of people's lives. As the core component of smart terminals, the performance of multi-core processors directly affects the user experience.
[0003] Multi-core processors improve processing power by integrating multiple processing cores into one chip. For the management and allocation of core resources, control groups (Cgroups) and CPUsets can be used to solve this problem.
[0004] Among them, Cgroup is a function of the Linux kernel, which is used to limit, record and isolate the resource usage of process groups, including CPU, memory, disk I / O, etc. In a multi-core processor environment, Cgroup can provide system administrators with powerful resource management tools through its subsystems (such as cpu, cpuacct, cpuset, etc.). CPUset is a subsystem of Cgroup, which is specifically responsible for setting the CPU affinity of the process, that is, it can specify which CPU cores a process or process group runs on. In many cases, the configuration of CPUset is fixed, which can improve the performance and resource isolation of the device. However, this fixed configuration is not flexible. With the diversification of interactive operations, the fixed configuration of CPUset cannot meet the user's experience needs.
[0005] In view of this, there is an urgent need to provide a resource management solution to solve the above problems. Summary of the invention
[0006] In order to at least solve one or more of the technical problems mentioned above, the present disclosure proposes a resource management solution in multiple aspects.
[0007] In a first aspect, the present disclosure provides a resource management method, which is applied to an electronic device including a multi-core processor, the electronic device including multiple process groups, each process group being configured to use a fixed number of core resources of the multi-core processor, the method comprising: determining a current interactive operation scenario of the electronic device; dividing the running processes into a first process group and at least one second process group according to the process type, wherein the first process group includes at least a first process related to the current interactive operation scenario, and the second process group includes at least a second process unrelated to the first process; dynamically modifying the number of core resources corresponding to each second process group according to the current interactive operation scenario to release part of the core resources corresponding to the second process group to the first process.
[0008] In some embodiments, the running processes are divided into a first process group and at least one second process group according to the process type, including: when the second process and the first process are of the same type of process, the second process group is determined according to the process type; or, when the second process and the first process are of different types of processes, other process groups including the second process are used as the second process group.
[0009] In some embodiments, the number of core resources corresponding to each second process group is dynamically modified according to the current interactive operation scenario, including: when it is determined that the electronic device enters the current interactive operation scenario, the first core resource corresponding to the second process group is modified to a new core resource, the first core resource is a fixed number of core resources of the second process group configured to use a multi-core processor, and the number of cores of the multi-core processor configured to use the new core resource is less than the number of cores of the multi-core processor configured to use the first core resource; after being modified to the new core resource and before the current interactive operation scenario meets the trigger condition, the second process group is run using the new core resource; when it is determined that the current interactive operation scenario meets the trigger condition, the new core resource is modified to the first core resource.
[0010] In some embodiments, when the second process and the first process are foreground processes, the second process group is determined according to the process type, including: the first process group and other process groups with the same priority as the first process group are used as the second process group; before modifying the first core resource corresponding to the second process group to a new core resource, the method includes: writing the first process to a pre-built isolation process group, the isolation process group is configured to use the second core resource, the second core resource is configured to use a multi-core processor with a core number greater than or equal to the number of cores of the multi-core processor configured to use the first core resource.
[0011] In some embodiments, when the second process and the first process are background resident processes, the second process group is determined according to the process type, including: taking other process groups including the second process as the second process group; before modifying the first core resource corresponding to the second process group to a new core resource, the method also includes: writing the first process into the second process group.
[0012] In some embodiments, when the second process is a background process and the first process is a foreground process, other process groups including the second process are used as the second process group.
[0013] In some embodiments, when it is determined that the current interactive operation scenario meets the trigger condition, the new core resource configuration is modified to the first core resource, including: receiving a second operation input to the electronic device in the current interactive operation scenario, the second operation is used to end the current interactive operation scenario; in response to the second operation, the new core resource is modified to the first core resource; or, when it is determined in the current interactive operation scenario that the cumulative time length reaches a preset time threshold, the new core resource is modified to the first core resource.
[0014] In some embodiments, determining a current interactive operation scenario of an electronic device includes: determining the current interactive operation scenario of the electronic device in response to a first operation input to the electronic device, the first operation being an operation for triggering an interface switch, or a shortcut operation for accessing a system, or an operation for triggering image processing; or an operation for exiting an application.
[0015] In a second aspect, the present disclosure provides an electronic device, comprising: a processor; and a memory storing computer instructions for executing a resource management method, wherein when the computer instructions are executed by the processor, the electronic device executes the method described in the first aspect.
[0016] In a third aspect, the present disclosure provides a computer-readable storage medium comprising program instructions for performing resource management operations, and when the program instructions are executed by a processor, the method described in the first aspect is implemented.
[0017] Through the resource management method, device and medium provided above, the method is applied to an electronic device including a multi-core processor, the electronic device includes multiple process groups, each process group is configured to use a fixed number of core resources of the multi-core processor, the method includes: determining the current interactive operation scenario of the electronic device; dividing the processes in the running state into a first process group and at least one second process group according to the process type, wherein the first process group includes at least a first process related to the current interactive operation scenario, and the second process group includes at least a second process unrelated to the first process; dynamically modifying the number of core resources corresponding to each second process group according to the current interactive operation scenario to release part of the core resources corresponding to the second process group to the first process. The technical solution provided by the disclosed embodiment dynamically modifies the core resources of the second process group, so that the process used to implement the operation scenario obtains more opportunities to use the CPU core resources, effectively improving the user experience of using the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0019] Figure 1 An exemplary illustration of the CPUset configuration of the related art of the disclosed embodiment is shown;
[0020] Figure 2 An exemplary flow chart of a resource management method 200 according to some embodiments of the present disclosure is shown;
[0021] Figure 3 An exemplary flow chart of a resource management method 300 according to some embodiments of the present disclosure is shown;
[0022] Figure 4 An exemplary flow chart of a resource management method 400 according to some embodiments of the present disclosure is shown;
[0023] Figure 5 An exemplary flow chart of a resource management method 500 according to some embodiments of the present disclosure is shown;
[0024] Figure 6 An exemplary flow chart of a resource management method 600 according to some embodiments of the present disclosure is shown;
[0025] Figure 7 An exemplary structural block diagram of an electronic device 700 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0027] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present disclosure indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0028] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.
[0029] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0030] The specific implementation of the present disclosure is described in detail below with reference to the accompanying drawings.
[0031] like Figure 1 As shown, the control group Cgroup uses the Cgroup file system to limit, isolate and count the physical resources (such as CPU, memory, device IO, etc.) of the process or process group.
[0032] If the kernel supports the CPUset subsystem, multiple CPUset subsystems are pre-built, each CPUset subsystem is mounted to the / dev / cpuset directory, and then the process is added to the corresponding CPUset subsystem. For example, add the process ID [pid] to the corresponding CPUset subsystem to add the process to the corresponding CPUset subsystem, or CPUset group.
[0033] Finally, set the CPU affinity of the CPUset subsystem to restrict system-background, foreground, top-app, background, and foreground / boost processes to run within a specific CPU range.
[0034] For example, setting the CPU affinity of the system-background group to cores 0 to 3 means that processes belonging to the system background group are restricted to run on these cores. Setting the CPU affinity of the foreground group to cores 0 to 7 allows foreground processes to use these cores. Setting the CPU affinity of the top-app group to cores 0 to 7 means that the top-level application currently interacting with the user can run on these cores. Setting the CPU affinity of the background group to cores 0 to 7 is used for background processes. Setting the CPU affinity of the restricted group to cores 0 to 7. This is typically used for foreground processes that need an extra performance boost.
[0035] By setting the CPU core affinity for different process groups, system resources can be managed and optimized. This can improve system performance, reduce resource competition, and ensure that key tasks and services have sufficient computing resources.
[0036] However, the fixed CPU core configuration cannot be flexibly adjusted according to the specific operating scenario, especially in a dynamically changing operating system. The fixed nature of this configuration cannot fully utilize the advantages of CPUset. For example, some CPU cores may be too busy while other cores are idle, resulting in limited overall system performance and unbalanced resource utilization, which in turn leads to an unstable user experience.
[0037] In view of this, the presently disclosed embodiment provides a resource management solution, which dynamically modifies the default core resource configuration of at least one target process group according to the operation scenario, so that the processes related to the operation scenario obtain more CPU core resources, effectively solving the problem of unstable user experience caused by uneven resource utilization.
[0038] Figure 2 An exemplary flow chart of a resource management method 200 according to some embodiments of the present disclosure is shown. The method is applied to an electronic device including a multi-core processor, the electronic device including a plurality of process groups, each process group being configured to use a fixed number of core resources of the multi-core processor.
[0039] like Figure 2 As shown, in step S201, the current interactive operation scenario of the electronic device is determined.
[0040] In some embodiments, the current interactive operation scene of the electronic device can be determined by detecting the interactive operation of the current interactive operation scene. The interactive operation can be a corresponding interactive operation input by the user, for example, the user starts an application on the mobile phone desktop, or the user touches to execute the pull-down notification bar, or the user enters the fingerprint in the fingerprint prompt area to unlock the operation. The current interactive operation scene of the electronic device can also be determined by detecting the state change of the electronic device. For example, a change in the interactive operation scene controlled by the artificial intelligence application is detected. Assume that when the user is in motion, the artificial intelligence application controls the start of the music-related application of the electronic device based on the user's motion data.
[0041] Determining a current interactive operation scenario of the electronic device includes: determining the current interactive operation scenario of the electronic device in response to a first operation input to the electronic device. The first operation is an operation for triggering interface switching, or a shortcut operation for accessing the system, or an operation for triggering image processing; or an operation for exiting an application.
[0042] The first operation detected is an operation input to the electronic device for triggering an operation scenario. For example, the first operation includes a gesture operation input to the main interface of the electronic device, or an operation input to a biometric feature recognition and collection device in a locked screen state, or information input to the lock screen interface for unlocking, such as numbers, biometrics, and pattern gestures.
[0043] According to the functions of gesture operations, they can be roughly divided into operations for triggering interface switching, or for accessing system shortcut operations, or for triggering image processing operations; or for exiting an application.
[0044] Among them, the operation for triggering interface switching refers to the operation for switching the current interface to a new interface. For example, in the operating system of some electronic devices, according to the operating method of the navigation bar, the touch operation input by the user for the navigation bar is received. When the navigation key is displayed on the screen, the user can implement the interface switching by inputting the selection operation for the navigation key. In gesture navigation, the gesture input according to the gesture requirements of gesture navigation, for example, the operation of swiping up from the bottom edge of the touch screen and pausing to enter the multitasking interface, implements the operation of switching the current interface to the multitasking interface; or swiping from the left edge of the touch screen to return to the previous level, implements the switching of the current interface back to the previous level interface. For another example, in the operating system of some electronic devices, the split-screen operation is implemented by swiping down with three fingers, and the split-screen operation is also classified as an interface switching operation here.
[0045] Among them, the quick operation for accessing the system refers to the operation that can quickly access the notification message of the system, or conveniently access the operation of the electronic device. For example, quickly access the notification bar interface for displaying notification messages through a pull-down gesture. For another example, when on the lock screen interface, unlock the lock screen interface by entering a password, or entering a gesture, or through biometric recognition. Unlocking by biometric recognition, for example, can be a biometric collection operation input by a biometric collector of an electronic device. The biometric can be the user's fingerprint information, face information, pupil information, voiceprint information, etc.
[0046] The operation used to trigger image processing refers to the operation of starting the image processing algorithm in the image-related application. For example, starting the camera to take pictures in a certain mode, and the operation input to the picture editing application to start image acquisition or editing. Assume that after the user starts the camera, the user selects a certain shooting mode, that is, specifies a certain image processing algorithm. When the user presses the shooting button, the image processing algorithm process is triggered to start working.
[0047] Among them, the operation of exiting the application refers to the operation of the user exiting from the application currently in use. When the user input to exit the application is detected, the processor also detects that after exiting the application, there is still a background resident process in the process management system for continuously managing the application-related process. For example, after taking a photo with the camera, the control for clicking to exit the photo-taking interface, there is also a process in the system for continuously managing and monitoring the camera module, such as the Camara HAL process. The Camara HAL process is a hardware abstraction layer (HAL) process based on the HIDL interface, which is used to manage and control related operations of the camera module in the Android operating system. A background resident process refers to an application or service process that remains active in the background through certain mechanisms when the user no longer directly uses the application. Background resident behavior can provide continuous services to users.
[0048] In response to detecting a first operation input to the electronic device, the current interactive operation scene of the electronic device is determined. The operation scene can be determined based on the position information where the first operation is detected, or various gestures can be recognized by monitoring action events. When a finger touches the touch screen, an action event is usually triggered, and the action event at least includes image coordinate attributes for recording the coordinates of the horizontal axis and the vertical axis. Therefore, based on the monitored action events, the interactive operation scene between the user and the electronic device can be determined.
[0049] Interaction scenarios refer to the interaction between users and electronic devices. For example, a user clicks on an application icon displayed on the desktop of an electronic device to open the application, which can be called an interface switching scenario. For another example, when a user unlocks an electronic device through face recognition on the lock screen interface to quickly access the electronic device, this can be called an unlocking scenario.
[0050] In response to detecting a first operation input to the electronic device, determining the current interactive operation scenario of the electronic device includes: when it is detected that the first operation is an operation for triggering an interface switch, determining that the current interactive operation scenario is an interface switching scenario, and the operation for triggering the interface switch is a gesture operation determined according to the system navigation mode of the electronic device. Alternatively, when it is detected that the first operation is a quick operation for accessing the system, determining that the current interactive operation scenario is a quick operation scenario for accessing the system, wherein the quick operation for accessing the system is a gesture operation input to the system notification bar, or an operation input to the lock screen interface. Alternatively, when it is detected that the first operation is an operation for triggering image processing, determining that the current interactive operation scenario is an image processing scenario. Alternatively, when it is detected that the first operation is an operation for exiting an application, and there is a background resident process associated with the application, determining that the current interactive operation scenario is a background resident process scenario.
[0051] Next, in step S202, the running processes are divided into a first process group and at least one second process group according to the process type.
[0052] In the above steps, the first process group includes a first process related to the current interactive operation scenario, and the second process group includes a second process in a running state that is not related to the first process.
[0053] The second process group may be a process group including a second process that competes with the first process for core resources. The second process group may be a process group with the same priority as the first process group. For example, when the first process is a foreground process, the second process group may be the first process group, or the first process group and a process group with the same priority as the first process group. For another example, when the first process is a background process, the second process group may be a process group with the same priority as the first process group.
[0054] In step S203, the number of core resources corresponding to each second process group is dynamically modified according to the current interactive operation scenario to release part of the core resources corresponding to the second process group to the first process.
[0055] In the above steps, according to the resource occupancy of the current interactive operation scenario, the first process group and at least one second process group are determined, including: when the second process and the first process belong to the same first process group, the first process group is used as the second process group; or, when the second process and the first process belong to different process groups, other process groups containing the second process are used as the second process group. Among them, the first process group and the second process group may be the same process group or different process groups. The first process group and the second process group both belong to a plurality of process groups pre-set according to the operating system of the electronic device. For example, the first process group is a foreground process group, and the second process group is a background process group. Or the first process group and the second process group are both foreground process groups, or the first process group and the second process group are both background process groups.
[0056] For example, when the interactive operation scenario is an interface switching scenario, it is assumed that the first process used to implement the interface switching scenario should be assigned to the first process group, and the first process group is, for example, a foreground process group. In the interface switching scenario, the second process running synchronously with the first process belongs to the background service process group. For example, if the priority of the background service process group is lower than the priority of the foreground process group used to implement the interface switching scenario, the background service process group is determined to be the second process group.
[0057] For another example, in the interactive operation scenario of pulling down the notification bar, it is assumed that the first process used to implement the pull-down notification bar should belong to the first process group, and the first process group is, for example, the foreground process group, and there is also a second process in the foreground process group that competes with the first process for core resources. Since the first process used to implement the pull-down notification bar and the second process that competes for core resources both belong to the first process group, the first process group and the process group with the same priority as the first process group are regarded as the second process group.
[0058] For another example, when the user exits the application, the background resident process related to the application will continue to work, that is, the background resident process scenario. Assume that the process group where the background resident process related to the application is located is the first process group, and the system pre-configures the background service process group for the application. The first process group and the background service process group are different. Both process groups will occupy a part of the core resources, and the background service process group is the second process group.
[0059] The second process group includes a second process that is unrelated to the first process. When the first process and the second process are run synchronously, the user's intuitive experience will be affected, such as vision, hearing or response time.
[0060] Core resources are a fixed number of cores pre-configured for each process group using a multi-core processor. The number of cores refers to the numerical range of the virtual number of the CPU core. For example, multiple process groups pre-configured according to the CPU architecture, such as the system-background process group, some low-priority tasks will be assigned to this group; foreground process group; top-app process group, background process group. These process groups are called CPUset groups, and the configuration of the CPUset group corresponding to each CPU architecture is different. For example, the top-app process group is configured to use the virtual number of CPU cores 0-7, the foreground process group is configured to use the virtual number of CPU cores 0-7, and the system-background process group is configured to use the virtual number of CPU cores 0-3.
[0061] When a first operation input to the electronic device is detected, the current interactive operation scene can be determined according to the position coordinates where the first operation occurs. Then, a first process group and at least one second process group are determined according to the resource occupation of the current interactive operation scene, and the number of core resources corresponding to each second process group is dynamically modified according to the current interactive operation scene to release the core resources corresponding to the second process group to the first process.
[0062] In some embodiments, the number of cores modified for the default core resources of the second process group can be written by calling a pre-built core resource configuration function, where the modification includes but is not limited to adjusting the process group to which the process belongs, or adjusting the number of CPU cores of the process group.
[0063] In some embodiments, assuming that the current interactive operation scenario is an interface switching scenario, the running background process group, or the idle process group or the system_ui process group, etc., belong to a low-priority process group. The first process related to the interface switching scenario belongs to the foreground process group, and its priority is higher than the background process group. The synchronous operation of the background process group and the foreground process group will affect the effect of the first process presentation. The number of CPU cores of the background process group can be dynamically modified to release some cores of the background process group to increase the running speed of the first process, thereby improving the user experience. For example, the number of CPU cores of the background process group is changed from the original configuration of 0 to 7 to 0 to 2. Although the first process still runs according to the core resources pre-configured by the first process group, since the objects competing for resources are restricted, the first process can get more opportunities to use CPU core resources, and the time for the CPU core resources to respond to user operations will be shortened, which effectively improves the user experience in the interactive operation scenario, and the user can perceive the change in the fluency of the operation.
[0064] In some other examples, assuming that the first operation input by the user is a pull-down operation for displaying a notification bar, the first process for implementing the pull-down notification bar should belong to the foreground process group, and there are other second processes in the foreground process group that compete with the first process for CPU core resources in the same group. In this case, the foreground process group is regarded as the second process group.
[0065] If the number of CPU cores of the foreground process group is limited, the use of CPU core resources by the first process used to implement the pull-down notification bar will also be limited. Therefore, the first process is written to a pre-built isolation process group, and the affinity of the isolation process group is set to at least maintain the same core resources as the foreground process group. The core resources of the isolation process group can be higher than the core resources of the foreground process group, while reducing the core resources of the foreground process group. By isolating the process group to ensure the CPU core resources used to run the first process and reducing the core resources of the foreground process group at the same time, it is possible to avoid the first process competing with other processes in the foreground process group for the same core resources, resulting in response delays, making the user's operation feel smoother and improving the user experience of using electronic devices.
[0066] The embodiments provided by the present disclosure determine the current interactive operation scenario of an electronic device, determine the first process group and the second process group according to the current interactive operation scenario, and dynamically modify the core resources of the second process group according to the current interactive operation scenario. This can enable the first process related to the current interactive operation scenario to obtain more CPU core resources, quickly respond to user operations, and effectively improve the user experience of using the electronic device.
[0067] Figure 3 An exemplary flow chart of a resource management method 300 of some embodiments of the present disclosure is shown. The method is applied to an electronic device including a multi-core processor, the electronic device including a plurality of process groups, each process group being configured to use a fixed number of core resources of the multi-core processor.
[0068] like Figure 3 As shown, in step S301, the current interactive operation scenario of the electronic device is determined.
[0069] In step S302, the running processes are divided into a first process group and at least one second process group according to the process type.
[0070] The first process group includes at least a first process related to the current interactive operation scenario, and the second process group includes at least a second process unrelated to the first process.
[0071] In step S303, when it is determined that the electronic device enters the current interactive operation scenario, the first core resource corresponding to the second process group is modified to a new core resource, the first core resource is a fixed number of core resources of the second process group configured to use a multi-core processor, and the number of cores of the multi-core processor configured to use the new core resource is less than the number of cores of the multi-core processor configured to use the first core resource.
[0072] In step S304, after the core resources are modified to be new and before the current interactive operation scenario satisfies the triggering condition, the second process group is run using the new core resources.
[0073] In the above steps, within the time range after obtaining the new core resource configuration and before the operation scenario meets the trigger condition, the processor processes the processes related to the operation scenario according to the new core resource configuration. The adjusted new core resource configuration enjoys the CPU core resources with a higher priority within the time range of the user using the operation scenario, which can improve the user experience.
[0074] In step S305, when it is determined that the current interactive operation scenario meets the triggering condition, the new core resource is modified to the first core resource.
[0075] The above step S301 is the same as step S201 of method 200. For related description, please refer to the above description of step S201.
[0076] In the above steps, the trigger condition is a condition for ending the operation scenario.
[0077] In some embodiments, the trigger condition is a second operation input by the user in the current interactive operation scene for ending the operation scene, and in response to the second operation, the new core resource is modified to the first core resource. The second operation for ending the current interactive operation scene, for example, the processor detects that a pull-down operation input by the user is received on the main interface of the electronic device, and the pull-down operation is an operation for opening the notification bar interface. On the notification bar interface, the user inputs a pull-up operation for closing the notification bar interface. The pull-up operation is the second operation for ending the current interactive operation scene.
[0078] In some embodiments, the trigger condition is to trigger the end of the current interactive operation scenario by monitoring the accumulated time value after modifying the first core resource. For example, in an interface switching scenario, when a user inputs a first operation to the multi-task display button of the navigation bar, in response to the first operation, the current interface is switched to the multi-task display interface, and after modifying the first core resource of the second process group according to the current interactive operation scenario, within a preset time range, the processor processes the process related to the current interactive operation scenario according to the new core resource, and when the preset time range threshold is reached, the calling program is used to modify the new core resource to the first core resource. That is, in the current interactive operation scenario, taking the acquisition of the new core resource as the time starting point, when it is determined that the accumulated time reaches the preset time range threshold, the new core resource of the second process group is modified to the first core resource of the second process group. The preset time range threshold is, for example, 100ms.
[0079] The embodiment provided by the present disclosure determines the current interactive operation scenario of the electronic device, and then limits the second process group to use lower core resources within a certain time range according to the current operation scenario, so as to ensure that the first process related to the current interactive operation scenario obtains more CPU core resources. After the current interactive operation scenario ends, the new core resource configuration is modified to the first core resource. By dynamically limiting the core resources of the second process group, the user experience of using the electronic device can be effectively improved.
[0080] Figure 4 An exemplary flow chart of a resource management method 400 of an embodiment of the present disclosure is shown. The method is applied to an electronic device including a multi-core processor, the electronic device including a plurality of process groups, each process group being configured to use a fixed number of core resources of the multi-core processor. Figure 4 The resource management method provided by the disclosed embodiment is further described.
[0081] like Figure 4 As shown, in step S401, in response to a first operation input to the electronic device, a current interactive operation scenario of the electronic device is determined.
[0082] In the above steps, the current interactive operation scenario is an interface switching scenario, or it can be an image processing scenario, and the processing flows of the two are similar.
[0083] Next, in step S402, when the second process is a background process and the first process is a foreground process, other process groups including the second process are taken as second process groups.
[0084] Among them, the first process group includes a first process related to the current interactive operation scenario, and the second process group includes a second process that is in a running state and is not related to the first process. The first process is a process used to implement an interface switching scenario, and the first process belongs to a foreground process. It is assumed that the first process belongs to the foreground process group. Different electronic devices have different names for pre-set process groups, and the inclusion relationship between process groups and processes may also be different, which can be specifically determined according to the operating system of the electronic device. In the interface switching scenario, there may be other second processes, which are not related to the first process but are in a running state, and the second processes are background processes.
[0085] Then, in step S403, when it is determined that the electronic device enters the current interactive operation scenario, the first core resource corresponding to the second process group is modified to a new core resource, the first core resource is a fixed number of core resources of the multi-core processor configured to be used by the second process group, and the new core resource is restricted to use a multi-core processor with a smaller number of cores than the first core resource is configured to use.
[0086] In step S404, after the core resources are modified to be new and before the current interactive operation scenario satisfies the triggering condition, the second process group is run using the new core resources.
[0087] In step S405, when it is determined that the current interactive operation scenario meets the triggering condition, the new core resource is modified to the first core resource.
[0088] In the above steps, it is assumed that the current operation scene is determined to be an interface switching scene or an image processing scene. When the current interactive operation scene is determined to be an interface switching scene, the first process used to implement the interface switching scene is the foreground process, and the second process in the running state is the background process, then the process group including the second process is taken as the second process group.
[0089] Alternatively, the first process used to implement the image processing scenario is a foreground process, and the second process in the running state is a background process, then the process group including the second process is taken as the second process group.
[0090] In some embodiments, assuming that the current interactive operation scenario is an interface switching scenario, the second process group may be one or more low-priority process groups that are in operation. For example, the second process group may be one or more of a background process group, an idle process group, and a system_ui process group. By limiting the number of CPU cores of the low-priority process group, the first process related to the interface switching scenario can obtain the opportunity to use more CPU cores, thereby improving the user experience.
[0091] In other embodiments, assuming that the current interactive operation scenario is an image processing scenario, the image processing scenario may be, for example, a process in which a user uses a camera to take a photo. When the user clicks on the camera and the camera is in a waiting state for shooting, and then receives a first operation of the user inputting a shutter, the processor calls an algorithm processing process related to taking a photo to complete the imaging process. After detecting the first operation, in response to the first operation, when it is determined that the current operation scenario is an image processing scenario, there may be multiple process groups in operation in the operating system of the electronic device. These process groups are not related to the image algorithm processing process. In order to increase the speed of image processing, the first core resources of other process groups that are not related to processes related to the image processing scenario may be temporarily reduced. When the photo taking ends and reaches a preset time threshold, the core resources of other process groups may be modified to the first core resources, thereby greatly improving the user experience of the user during the photo taking process.
[0092] In the above steps, it is determined that the cumulative time length reaches the preset time threshold, and the new core resource can be determined as the time starting point, and the cumulative time length reaches the preset time threshold, and the preset time threshold can be 100ms. It is also possible to use the time point when the first operation input to the electronic device is detected as the time starting point, and determine that the cumulative time length reaches the preset time threshold, where the preset time threshold can be 120ms.
[0093] The embodiment provided by the present disclosure determines the current interactive operation scenario of the electronic device according to the first operation input to the electronic device, and then reduces the first core resource of the second process group according to the current interactive operation scenario, so that the first process can obtain more CPU core resources within a certain time range. When the current interactive operation scenario ends, the new core resource is modified to the first core resource. By dynamically releasing the core resources of the second process group, the first process can obtain more opportunities to use the core resources, which effectively improves the user experience of using the electronic device.
[0094] Figure 5 An exemplary flow chart of a resource management method 500 of an embodiment of the present disclosure is shown. The method is applied to an electronic device including a multi-core processor, the electronic device including multiple process groups, each process group being configured to use a fixed number of core resources of the multi-core processor. Figure 5 The resource management method provided by the disclosed embodiment is further described.
[0095] like Figure 5 As shown, in step S501, in response to a first operation input to the electronic device, a current interactive operation scenario of the electronic device is determined.
[0096] In the above steps, the current interactive operation scenario is the pull-down notification bar scenario. The fingerprint unlocking scenario has a similar processing flow to the pull-down notification bar scenario.
[0097] In step S502, when the second process and the first process are foreground processes, the first process group and other process groups with the same priority as the first process group are used as the second process group.
[0098] In step S503, when it is determined that the electronic device enters the current interactive operation scenario, the first process is written into a pre-built isolation process group, and the isolation process group is configured to use the second core resource. The second core resource is configured to use a multi-core processor with a core number greater than or equal to the first core resource.
[0099] In step S504, the first core resource corresponding to the second process group is modified to a new core resource, where the first core resource is a fixed number of core resources of the second process group configured to use a multi-core processor, and the number of cores of the multi-core processor configured to use the new core resource is less than the number of cores of the multi-core processor configured to use the first core resource.
[0100] In step S505, after the core resources are modified to be new and before the current interactive operation scenario satisfies the triggering condition, the second process group is run using the new core resources.
[0101] In step S506, when it is determined that the current interactive operation scenario meets the trigger condition, the new core resource is modified to the first core resource.
[0102] In the above steps, it is assumed that the operation scenario is a quick operation scenario for accessing the system, and the quick operation scenario includes but is not limited to the operation scenario of pulling down the notification bar and the operation scenario of unlocking using a password or biometric recognition.
[0103] In some embodiments, it is assumed that the operation scenario is that the user inputs a first operation on the main interface of the electronic device, that is, slides downward from the top to trigger the notification bar display interface.
[0104] The process related to the notification bar may be assigned to the pre-built foreground process group. Other processes in the same running state may also belong to the foreground process group. At this time, if the first process and the second process have the same priority, the foreground process group will be used as the second process group.
[0105] In order to better execute the operation of pulling down the notification bar, the process corresponding to the pull-down notification bar scenario (i.e., the first process) can be written into a pre-built isolation process group, which is pre-configured to use the second core resources of the multi-core processor, and the second core resources are configured to use a number of cores of the multi-core processor that is greater than or equal to the number of cores of the multi-core processor that the first core resources are configured to use.
[0106] Then, the first core resources corresponding to each second process group are restricted to new core resources, wherein the number of cores of the multi-core processor configured to use the new core resources is smaller than the number of cores of the multi-core processor configured to use the first core resources.
[0107] For example, in the operation scenario of the pull-down notification bar, the second process that competes with the process corresponding to the operation scenario of the pull-down notification bar may be included in the foreground process group, or the system-foreground process group, etc., which can be achieved by limiting the first core resources of the foreground process group and the system-foreground process group, such as reducing the virtual number 0-7 of the CPU core of the foreground process group to 0-2.
[0108] In the above steps, the process corresponding to the operation scenario of the pull-down notification bar is written into the isolated process group. The name of the isolated process group can be determined by the user, or it can be a redundant process group pre-built according to the operating system of the electronic device as the isolated process group, or it can be one of the multiple process groups pre-created by the specified electronic device. The isolated process group can be pre-configured to use the virtual number of the CPU core as 0-7.
[0109] In the interactive operation scenario of pulling down the notification bar, the user can trigger the closing of the notification bar interface by sliding up the notification bar interface. When closing the notification bar interface, the CPUset configuration of the foreground process group and the system-foreground process group is modified to the first core resource, such as changing the virtual number 0-2 of the CPU core of the foreground process group to 0-7.
[0110] It should be noted here that in a specific interactive operation scenario, the electronic device pre-builds multiple CPUset process groups, and the name of each process group is identified differently in different operating systems, which is not listed in this disclosure.
[0111] In some other embodiments, assuming that the operation scenario is the first operation input by the user into the fingerprint sensor of the electronic device, the first operation may be an operation in which the user presses the target finger on the fingerprint collection device, for example, it may be a fingerprint collection device mounted at the rear of the electronic device, or it may be a fingerprint collection device arranged below the touch screen.
[0112] When a first operation input by a user is detected, in response to the first operation, it is determined that the current operation scenario is a fingerprint unlocking scenario. For example, a process used to implement the fingerprint unlocking scenario belongs to a foreground process group. When the process used to implement the fingerprint unlocking scenario is running, there are other second processes in the foreground process group that are in running state, and the foreground process group is determined to be the second process group.
[0113] In order to prevent the process or process group used to implement the fingerprint unlocking scenario from being affected by resources of the same level, the process used to implement the fingerprint unlocking scenario is written into a pre-built isolated process group, wherein the isolated process group is pre-configured to use the second core resource of the multi-core processor, and the second core resource is configured to use a multi-core processor with a core number greater than or equal to the core number of the multi-core processor configured to use the first core resource.
[0114] Then, the first core resources corresponding to each second process group are restricted to new core resources, and the number of cores of the multi-core processor configured to use the new core resources is smaller than the number of cores of the multi-core processor configured to use the first core resources.
[0115] Finally, after the new core resource configuration is determined and before the operation scenario meets the trigger conditions, the processes related to the operation scenario are handled by the new core resources; when it is determined that the current interactive operation scenario meets the trigger conditions, the new core resources are modified to the first core resources, that is, the new core resources are used in the current interactive operation scenario, and after the current interactive operation scenario ends, they are still modified to the first core resources.
[0116] The embodiment provided by the present disclosure determines the current interactive operation scenario of the electronic device based on the first operation input to the electronic device, writes the first process related to the current interactive operation scenario into the isolated process group, and simultaneously limits the resources of the process group that competes with the first process for core resources, so that the first process can obtain more CPU core resources during operation, and releases the modified resources at the end of the operation, thereby improving the user experience of using the electronic device.
[0117] Figure 6 An exemplary flow chart of a resource management method 600 of an embodiment of the present disclosure is shown. The method is applied to an electronic device including a multi-core processor, the electronic device including a plurality of process groups, each process group being configured to use a fixed number of core resources of the multi-core processor. Figure 6 The resource management method provided by the disclosed embodiment is further described.
[0118] like Figure 6As shown, in step S601, in response to a first operation input to the electronic device, a current interactive operation scenario of the electronic device is determined.
[0119] In the above steps, the current interactive operation scenario is an operation scenario in which the user operates to exit the camera function.
[0120] In step S602, when the second process and the first process are background resident processes, another process group including the second process is used as a second process group.
[0121] The first process group includes a first process related to the current interactive operation scenario, and the second process group includes a second process in a running state that is not related to the first process.
[0122] In step S603, when it is determined that the electronic device enters the current interactive operation scene, the first process is written into the second process group.
[0123] In step S604, the first core resource corresponding to the second process group is modified to a new core resource, where the first core resource is a fixed number of core resources of the multi-core processor that the second process group is configured to use, and the number of cores of the multi-core processor that the new core resource is configured to use is less than the number of cores of the multi-core processor that the first core resource is configured to use.
[0124] In step S605, after the core resources are modified to be new and before the current interactive operation scenario satisfies the triggering condition, the second process group is run using the new core resources.
[0125] In step S606, when it is determined that the current interactive operation scenario meets the triggering condition, the new core resource is modified to the first core resource.
[0126] In the above steps, after receiving the first operation input to the electronic device, in response to the first operation, the processor detects the presence of a background resident process related to the application, and determines that the operation scenario is a background resident process scenario. The first operation is an operation of exiting the application.
[0127] Assuming that the application is a camera function, when the user inputs an operation to exit the camera function, in response to the exit operation input by the user, the processor detects that there is a background resident process related to the camera function.
[0128] Assume that in the Android operating system, the background resident process is the camara HAL process, and the process group to which the background resident process belongs has the same process priority as the background service process group, and there is no competition with the foreground process at this time. For the user experience, the user's perception of the background process is low. Therefore, the camara HAL process can be written into the background service process group for managing and controlling the camera module. Among them, the default core resource configuration of the background service process group is set to the virtual number of the CPU core 0-7. After the camara HAL process is written into the background service process group, the default core resource configuration is reduced to a new core resource configuration, and the new core resource configuration is set to the virtual number of the CPU core 0-1. The background service process group, for example, can be a camera-daemon process group, or a process group with other names, or a background service process group for managing and controlling the camera module, or a waiting process group.
[0129] Through the above operations, the core resources of the background service process group are limited. In this operation scenario, when the user performs other operations, the process or process group used to implement other operations can obtain more CPU core resources and respond to user operations more quickly, thereby effectively improving the user experience.
[0130] After obtaining the new core resource and before the operation scenario meets the trigger condition, the process related to the operation scenario is handled by the new core resource, and when it is determined in the operation scenario that the cumulative time length reaches the preset time threshold, the new core resource is modified back to the first core resource. The preset time threshold can be, for example, 100ms.
[0131] The embodiment provided by the present disclosure determines the current operation scenario of the electronic device according to the first operation input to the electronic device, then writes the process related to the operation scenario into the background service process group, determines the background service process group as the second process group, and then reduces the first core resource of the second process group. By reducing the CPU core resources of the background service process group within the usage time range of the operation scenario, after the operation scenario is ended, the reduced core resources are modified back to the first core resources. This dynamic adjustment of core resources can ensure that in most cases, the system can run in the optimal state and provide a continuous high-performance experience to meet the response requirements of the application, and effectively improve the user experience of the human-computer interaction operation scenario.
[0132] Figure 7 FIG. 7 is a schematic block diagram of an electronic device 700 according to an embodiment of the present disclosure. Figure 7As shown, the electronic device 700 may include a processor 701 and a memory 702. The memory 702 stores computer instructions of a resource management method implemented by a computer. When the computer instructions are executed by the processor 701, the electronic device 700 executes the resource management method according to the above description. Figure 2 to Figure 6 For example, in some embodiments, the electronic device 700 can determine the current operation scenario in response to a first operation input to the electronic device; dynamically modify the default core resource configuration of at least one target process group according to the operation scenario, etc. Based on this, the electronic device 700 can effectively improve the user experience of the human-computer interaction operation scenario by dynamically adjusting the default core resource configuration.
[0133] The disclosed embodiment also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the resource management method in the above-mentioned embodiment.
[0134] The disclosed embodiment also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the resource management method in the above-mentioned embodiment.
[0135] In addition, the disclosed embodiments also provide a device, which may specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor may execute the computer-executable instructions stored in the memory so that the chip executes the resource management method in the above-mentioned method embodiments.
[0136] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0137] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0138] In the several embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0139] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0140] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0141] Any content of each embodiment of the present disclosure, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present disclosure.
[0142] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0143] The embodiments of the present disclosure are described above in conjunction with the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present disclosure, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present disclosure and the claims, all of which are within the protection of the present disclosure.
[0144] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present disclosure can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disk (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0145] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present disclosure can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer-readable storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0146] Although multiple embodiments of the present disclosure have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art may think of many changes, modifications, and alternatives without departing from the thought and spirit of the present disclosure. It should be understood that in the process of practicing the present disclosure, various alternatives to the embodiments of the present disclosure described herein may be adopted. The attached claims are intended to define the scope of protection of the present disclosure, and therefore cover equivalents or alternatives within the scope of these claims.
Claims
1. A resource management method, characterized in that: The method is applied to an electronic device including a multi-core processor, the electronic device including a plurality of process groups, each of the process groups being configured to use a fixed number of core resources of the multi-core processor, the method comprising: Determining a current interactive operation scenario of the electronic device; Dividing the running processes into a first process group and at least one second process group according to the process type, wherein the first process group includes at least a first process related to the current interactive operation scenario, and the second process group includes at least a second process unrelated to the first process; The number of core resources corresponding to each second process group is dynamically modified according to the current interactive operation scenario to release part of the core resources corresponding to the second process group to the first process.
2. The method according to claim 1, characterized in that Dividing the running processes into a first process group and at least one second process group according to the process type, including: When the second process and the first process are of the same type, determining the second process group according to the process type; or, When the second process and the first process are processes of different types, another process group including the second process is used as a second process group.
3. The method according to claim 1, characterized in that: Dynamically modifying the number of core resources corresponding to each of the second process groups according to the current interactive operation scenario includes: When determining that the electronic device enters the current interactive operation scenario, modifying the first core resource corresponding to the second process group to a new core resource, the first core resource being a fixed number of core resources of the multi-core processor that the second process group is configured to use, and the number of cores of the multi-core processor that the new core resource is configured to use is less than the number of cores of the multi-core processor that the first core resource is configured to use; After the modification to the new core resource and before the current interactive operation scenario satisfies the trigger condition, running the second process group using the new core resource; When it is determined that the current interactive operation scenario meets the trigger condition, the new core resource is modified to the first core resource.
4. The method according to claim 3, characterized in that When the second process and the first process are foreground processes, determining the second process group according to the process type includes: The first process group and other process groups with the same priority as the first process group are used as the second process group; Before modifying the first core resource corresponding to the second process group to a new core resource, the method includes: The first process is written into a pre-built isolation process group, the isolation process group is configured to use a second core resource, the second core resource is configured to use a number of cores of the multi-core processor that is greater than or equal to the number of cores of the multi-core processor that the first core resource is configured to use.
5. The method according to claim 3, characterized in that: When the second process and the first process are background resident processes, determining the second process group according to the process type includes: Using another process group including the second process as the second process group; Before modifying the first core resource corresponding to the second process group to a new core resource, the method further includes: Write the first process to the second process group.
6. The method according to claim 3, characterized in that: When the second process is a background process and the first process is a foreground process, another process group including the second process is used as a second process group.
7. The method according to claim 2, characterized in that When it is determined that the current interactive operation scenario satisfies the trigger condition, modifying the new core resource configuration to the first core resource includes: Receiving a second operation input to the electronic device in the current interactive operation scene, the second operation being used to end the current interactive operation scene; In response to the second operation, modifying the new core resource to the first core resource; Alternatively, when it is determined that the accumulated time length reaches a preset time threshold in the current interactive operation scenario, the new core resource is modified to the first core resource.
8. The method according to claim 1, characterized in that: Determining a current interactive operation scenario of the electronic device includes: In response to a first operation input to the electronic device, a current interactive operation scenario of the electronic device is determined, wherein the first operation is an operation for triggering interface switching, or a shortcut operation for accessing a system, or an operation for triggering image processing; or an operation for exiting an application.
9. An electronic device, characterized in that: include: processor; as well as A memory storing computer instructions for executing a resource management method, wherein when the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The program comprises program instructions for executing resource management operations, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
