Resource management method and device, electronic equipment and storage medium
By integrating a performance optimization main program with proxy processes in multi-user systems, resource management is centralized, addressing inefficiencies and lag issues, thereby enhancing system performance and user experience.
Patent Information
- Application Number
- CN202510394627.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-15
AI Technical Summary
In multi-user scenarios, the redundant process of independent user space in the vehicle system causes redundancy of resource occupation, affecting system performance and storage space utilization efficiency, especially when the background process of inactive users continues to run, resulting in system stuttering.
By installing the main program for performance optimization in the main user space and installing the corresponding performance optimization agent process in the sub-user space, we can monitor and manage resource usage data in each user space in real time, dynamically adjust resource allocation, and optimize system resource utilization.
One-stop management of multi-user system resources is realized, system response speed and efficiency are improved, resource consumption is reduced, system lag is avoided, and storage space utilization is improved.
Smart Images

Figure CN120315875A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminals, and in particular, to a resource management method, apparatus, electronic device, and storage medium. Background Art
[0002] Currently, in a multi-user scenario (such as family member independent accounts, guest mode, application cloning, etc.), the current in-vehicle system adopts the independent user space design of the Android system. Although this design can effectively ensure user data isolation and security, it brings some challenges in resource management. Multiple basic service processes (such as navigation, voice assistant) are started in the independent space of each user, resulting in redundant occupation of resources (such as memory and CPU), low storage space utilization efficiency, and continuous operation of background processes of inactive users, consuming system resources and affecting the usage experience of foreground users. These problems are particularly prominent in a multi-user environment, restricting the overall performance and resource optimization of the in-vehicle system. Summary of the Invention
[0003] This application provides a resource management method, apparatus, electronic device, and storage medium, aiming to optimize the system resources in a multi-user space scenario and solve the system lag problem in a multi-user scenario. The technical solutions are as follows:
[0004] In a first aspect, a resource management method is provided, and the method includes:
[0005] In a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in a primary user space, determining first resource usage data of the primary user space based on the performance optimization main program;
[0006] Invoking a performance optimization proxy process based on the performance optimization main program to determine second resource usage data of a secondary user space; the performance optimization proxy process is a proxy process of the performance optimization main program in the secondary user space;
[0007] Optimizing the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data.
[0008] In the above technical solution, a method for resource management is proposed, which is applied to a multi-user operating system. The core of the multi-user operating system lies in allowing multiple users to access the same computer resources simultaneously. The multi-user operating system may include a main user and several sub-users. The main user is usually an administrator, and the sub-users are usually visitors. By installing a performance optimization main program in the main user space and a corresponding performance optimization proxy process in the sub-user space, when a resource management instruction is received in the main user space, based on the confirmation of the first resource usage data of the main user space by the performance optimization main program, and at the same time, the performance optimization proxy process is called by the performance optimization main program to confirm the second resource usage data of the sub-user space, so as to achieve optimized management. In this way, not only can the management of the main user space be realized through the performance optimization main program in the main user space, but also the performance optimization proxy processes in each sub-user space can be called respectively through the performance optimization main program to realize the resource management of all sub-user spaces. Users do not need to switch to each user space to perform resource management separately, which improves the resource management efficiency and solves the problem of system lag caused by the disordered use of system resources in the multi-user scenario.
[0009] In combination with the first aspect, in some possible implementation manners, in the multi-user operating system, before determining the first resource usage data of the main user space based on the performance optimization main program in response to the system resource management instruction received by the performance optimization main program in the main user space, it further includes: when detecting that the main user space in the multi-user operating system is turned on, detecting the currently running sub-user spaces; binding the performance optimization main program in the main user space with the performance optimization proxy processes in each sub-user space.
[0010] In the above technical solution, a specific solution for binding the performance optimization main program and the performance optimization proxy process is proposed. After the performance optimization main program is started, it actively binds the performance optimization proxy processes in the currently running sub-user spaces to realize the control of the performance optimization proxy processes through the performance optimization main program, so as to be able to manage all the existing sub-user spaces in the main user space.
[0011] In combination with the first aspect, in some possible implementation manners, the method further includes: in response to a creation instruction for a sub-user space, installing a performance optimization proxy process in the sub-user space.
[0012] In the above technical solution, a specific creation scheme for the performance optimization proxy process is proposed. By synchronously installing the performance optimization proxy process when creating the sub-user space, it is ensured that each sub-user space can be managed.
[0013] In combination with the first aspect, in some possible implementation manners, the system for optimizing system resources of a multi-user operating system based on first resource usage data and second resource usage data includes: displaying the first resource usage data and the second resource usage data in a performance optimization main program in a primary user space; in response to an optimization space selection operation for the performance optimization main program, determining a target user space corresponding to the optimization space operation; the target user space includes the primary user space and / or a sub-user space; invoking a target performance optimization program in the target user space to optimize system resources of the multi-user operating system occupied by the target user space; the target performance optimization program includes a performance optimization main program in the primary user space and a performance optimization proxy process in the sub-user space.
[0014] In the above technical solution, a solution for optimizing system resources according to first resource usage data and second resource usage data is specifically proposed. The user selects a target user space to be optimized according to the displayed resource usage data. The target user space can be the primary user space or the sub-user space or both. Resource optimization is performed according to the performance optimization program installed in the target user space, so as to realize flexible management of the user space according to user requirements.
[0015] In combination with the first aspect, in some possible implementation manners, the system for optimizing system resources of a multi-user operating system based on first resource usage data and second resource usage data includes: determining the user activity of each user corresponding to the primary user space and the sub-user space; determining a resource management strategy based on the user activity, the first resource usage data, and the second resource usage data, and using the resource management strategy to optimize system resources of the multi-user operating system.
[0016] In the above technical solution, another implementation solution for optimizing system resources according to first resource usage data and second resource usage data is specifically proposed. By determining the activity of the user corresponding to the primary user space and the activity of the user corresponding to the sub-user space, the user activity of all users is obtained. Furthermore, a resource management strategy is determined according to the user activity and the resource usage data of each user space, and the system resources of the multi-user operating system are optimized according to the resource management strategy. By intelligently adjusting resource allocation according to the user activity, not only can the front-end user experience be improved, but also the overall efficiency of the system can be enhanced.
[0017] In combination with the first aspect, in some possible implementation manners, the system for optimizing system resources of a multi-user operating system based on first resource usage data and second resource usage data includes: if it is determined based on the first resource usage data and the second resource usage data that there is an abnormal user process, then performing abnormal control on the abnormal user process based on a performance optimization proxy process or a performance optimization main program in the user space where the abnormal user process is located.
[0018] In the above technical solution, a solution for controlling abnormal user processes is provided. Based on the resource usage data of each user space, it is possible to detect whether there are abnormal user processes in the main user space and the sub-user space. If there are abnormal user processes, the system resources can be optimized by controlling the abnormal user processes, effectively avoiding the continuous occupation of system resources by abnormal user processes and reducing resource waste.
[0019] In combination with the first aspect, in some possible implementation manners, the method further includes: loading high-frequency applications in the multi-user operating system into the main user space; when there is a need to use high-frequency applications in the sub-user space, calling the high-frequency applications in the main user space based on the inter-process communication between the sub-user space and the main user space.
[0020] In the above technical solution, a resource reuse solution for a multi-user scenario is provided. The high-frequency applications required in the system are only installed in the main user space, and the sub-users only load differentiated applications. Moreover, the sub-user space can call the high-frequency applications in the main user space through inter-process communication, avoiding the repeated installation of high-frequency applications in each sub-user space and occupying memory.
[0021] In a second aspect, an embodiment of this specification provides a resource management device, including:
[0022] A first calling unit, configured to, in a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the main user space, determine first resource usage data of the main user space based on the performance optimization main program;
[0023] A second calling unit, configured to call a performance optimization proxy process based on the performance optimization main program to determine second resource usage data of the sub-user space; the performance optimization proxy process is a proxy process of the performance optimization main program in the sub-user space;
[0024] An optimization unit, configured to optimize the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data.
[0025] In a third aspect, an embodiment of this specification provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the computer program is executed by the processor, the steps of the above method are implemented.
[0026] In a fourth aspect, an embodiment of this specification provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above method are implemented. Description of the Drawings
[0027] Figure 1It is a schematic diagram of the scenario of a resource management method provided by an embodiment of this specification;
[0028] Figure 2 It is an illustrative schematic diagram of a resource management method provided by an embodiment of this specification;
[0029] Figure 3 It is a flowchart of a resource management method provided by an embodiment of this specification;
[0030] Figure 4 It is a flowchart of a resource management method provided by an embodiment of this specification;
[0031] Figure 5 It is an interface schematic diagram of a resource management method provided by an embodiment of this specification;
[0032] Figure 6 It is a flowchart of a resource management method provided by an embodiment of this specification;
[0033] Figure 7 It is a flowchart of a resource management method provided by an embodiment of this specification;
[0034] Figure 8 It is a structural schematic diagram of a resource management device provided by an embodiment of this specification;
[0035] Figure 9 It is a structural schematic diagram of an electronic device provided by an embodiment of this specification. Detailed implementation manners
[0036] Next, the technical solutions in the present application will be clearly and elaborately described in conjunction with the accompanying drawings. Among them, in the description of the embodiments of this specification, unless otherwise specified, " / " means "or". For example, A / B can represent A or B: The "and / or" in the text is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this specification, "multiple" means two or more than two.
[0037] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features.
[0038] Figure 1 It is a schematic diagram of the scenario of a resource management method provided by an embodiment of this specification.
[0039] Exemplarily, the resource management method can be applied to a vehicle infotainment system. For example Figure 1 as shown in the figure, vehicle 1 includes multiple touchscreens. In the embodiments of this specification, there are touchscreens 1-4. Among them, touchscreen 1 is the touchscreen for the driver's seat, touchscreen 2 is the touchscreen for the co-driver's seat, and touchscreens 3 and 4 are the touchscreens for the rear seats. By controlling different screens respectively, it is ensured that different users have their own corresponding operation interfaces. Of course, the number and type of touchscreens are not limited to this embodiment. Optionally, a single screen can also be split, so that different users can have their own screen area to meet the usage needs of multiple users. It can be understood that although multiple touchscreens are installed in the vehicle, the same vehicle infotainment system is used. The vehicle infotainment system creates independent virtual environments for each user (or each user's applications and data), so that the operations and data of different users are isolated from each other and do not directly affect each other. Each user space has its own files, settings, applications, etc., and the operating system manages these spaces to ensure isolation and security between different users. However, in this case, a large number of redundant application processes are running in different user spaces, and storage fragmentation is likely to occur, which easily leads to insufficient system resources and causes lag problems. In addition, the above-mentioned lag problems caused by multi-user scenarios may also exist in other electronic devices such as computers and mobile phones, which will not be elaborated here.
[0040] Based on the above situation, the embodiments of this specification propose a resource management method. Please refer to Figure 2 which is an example schematic diagram of a resource management method provided by the embodiments of this specification. By installing a performance optimization main program in the main user space of the cockpit vehicle infotainment system (multi-user operating system), and installing corresponding performance optimization proxy processes in the sub-user spaces (sub-users 1, 2, and 3), when a resource management instruction is received in the main user space, based on the confirmation of the first resource usage data of the main user space by the performance optimization main program, and at the same time, the performance optimization proxy processes in the sub-user spaces are called by the performance optimization main program to confirm the second resource usage data of the sub-user spaces, so as to achieve optimized management. Through this method, it is possible to manage the resources of all user spaces in the main user space, and solve the problem of system lag caused by the disordered use of system resources in multi-user scenarios.
[0041] The resource management method provided by this specification will be described in detail below in combination with specific embodiments.
[0042] Figure 3 is a schematic flowchart of a resource management method provided by the embodiments of this specification. It should be understood that this method can be applied to a vehicle, specifically to an Electronic Control Unit (ECU) in the vehicle.
[0043] For example Figure 3As shown, the method of the embodiments of this specification may include the following steps S101 - step S103.
[0044] S101. In a multi - user operating system, in response to a system resource management instruction received by a performance optimization main program in the primary user space, determine first resource usage data of the primary user space based on the performance optimization main program.
[0045] In one embodiment, a multi - user operating system may include multiple user spaces. Different user spaces correspond to different users. Generally, the user spaces can be divided into a primary user space and a secondary user space. The primary user space is the space used by the primary user. For example, the primary user can be "administrator". The secondary user space is the space used by secondary users. For example, secondary users can be "visitors", "other family members", etc. Taking the vehicle scenario as an example, the system can automatically identify the user currently using the screen and intelligently adjust the content displayed on the interface. For example, through technologies such as facial recognition, voice recognition, or fingerprint recognition, automatically identify the user sitting in the front row or the back row and switch to the corresponding user interface and account settings.
[0046] The performance optimization main program (APP), as the only entry point for consumers, uniformly provides consumers with scanning, monitoring, and performance optimization capabilities. Specifically, it can collect and track various resource consumption situations during program execution in real - time, identify bottlenecks in resource usage, and optimize the performance of the program. Generally, the primary user has higher permissions and a higher priority for system resource usage. Therefore, the performance optimization main program is installed in the primary user space to facilitate the primary user's system resource management.
[0047] When the performance optimization main program receives a system resource management instruction, use the performance optimization main program to obtain the resource usage situation of the primary user space. Resource usage data refers to various system resources consumed by a program during operation, such as CPU time, memory usage, disk I / O, network bandwidth, etc. Exemplarily, the system resource management instruction can be a pre - set instruction initiated regularly. For example, generate a system management instruction every hour to check and optimize the system; the system resource management instruction can also be initiated by the user actively. For example, open the "Performance Optimization" APP and click the "One - Key Optimization" function.
[0048] S102. Based on the performance optimization main program, call a performance optimization proxy process to determine second resource usage data of the secondary user space.
[0049] In one embodiment, the performance optimization agent process is an agent process of the performance optimization main program in the sub-user space. It is started and run by the main program to perform resource management operations on the sub-user space on behalf of the main program. A performance optimization agent process is installed in each sub-user space. The performance optimization agent process can be called by the performance optimization main program, and then the second resource usage data is obtained through the performance optimization agent process in its own sub-user space, and then the second resource usage data is returned to the performance optimization main program. Exemplarily, different communication methods can be selected between the performance optimization agent process and the performance optimization main program according to the system architecture and requirements, such as the inter-process communication mechanism (IPC), network-based HTTP API, message queue, etc.
[0050] S103. Optimize the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data.
[0051] In one embodiment, after obtaining the first resource usage data and the second resource usage data, the performance optimization main program can determine how to optimize the system resources of the multi-user operating system according to the first resource usage data and the second resource usage data. Exemplarily, when resources are scarce, the system can preferentially allocate resources to critical tasks or high-priority users, while restricting the resource occupancy of low-priority tasks. For example, if the current CPU usage exceeds the CPU amount allocated to the sub-user space, then the process with a large CPU occupancy is determined according to the second resource usage data of the sub-user space and is closed, so as to save unnecessary resource occupancy and avoid system lag. Another example is that if the memory occupancy in a user space exceeds the set maximum memory usage, the cached data therein is deleted. In addition, the real-time resource usage data can also help the operating system dynamically detect and resolve resource conflicts or bottlenecks to ensure the efficient operation and responsiveness of the system.
[0052] It can be understood that the performance optimization main program can also perform regular cleaning work in the background. By regularly obtaining the first resource usage data and the second resource usage data, redundant cached files and outdated data are screened out and removed to improve the utilization rate of the storage space and avoid serious fragmentation.
[0053] Optionally, when performing system resource scheduling, the resources allocated to users can also be dynamically adjusted according to changes in user demand. For example, when a user starts a resource-intensive application and there are idle resources, the system can temporarily allocate more resources to the user.
[0054] Optionally, after obtaining the resource usage data for a period of time, the resource scheduling policy can also be adaptively optimized based on machine learning or prediction models, predicting the resource requirements according to the user's historical behavior, and adjusting the resource allocation in advance, which can effectively manage the resource usage in the user space, improve the system performance and fairness, and meet the needs of different users at the same time.
[0055] In the embodiments of the present specification, in a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the main user space, based on the performance optimization main program, the first resource usage data of the main user space is determined, the performance optimization proxy process is called based on the performance optimization main program to determine the second resource usage data of the sub-user space, and the system resources of the multi-user operating system are optimized based on the first resource usage data and the second resource usage data. By real-time monitoring the first resource usage data of the main space and the second resource usage data of the sub-space, the system can dynamically optimize the resource allocation of the multi-user operating system, thereby realizing the one-stop management of the multi-user system resources, and further improving the response speed, efficiency of the entire system and reducing resource consumption.
[0056] Please refer to Figure 4 , which is a schematic flowchart of a resource management method provided by the embodiments of the present specification. As Figure 4 shown, the method of the embodiments of the present specification may include the following steps S201-S207.
[0057] S201, when it is detected that the main user space in the multi-user operating system is started, detect the currently running sub-user space;
[0058] In one embodiment, the status of the main user space is checked through a system monitoring tool or a process management tool (such as ps, top, etc.). When the main user space is started, the process ID or related information of the currently running sub-user space can be obtained by using system calls or kernel modules. It can be understood that the main user space usually starts corresponding to each system startup, but the sub-user space will be started according to the actual situation. For example, if there is a passenger in the co-pilot today, the co-pilot passenger account may be logged in and the corresponding sub-user space may be started. After each main user space is started, the currently running sub-user space is detected to determine the sub-user space that needs to be managed.
[0059] S202, bind the performance optimization main program in the main user space to the performance optimization proxy processes under each sub-user space;
[0060] In one embodiment, after determining the running sub-user space, it is bound to the performance optimization proxy process. Taking the multi-user operating system Android as an example, the binding between the performance optimization main program and the performance optimization proxy process can be implemented based on the AIDL (Android Interface Definition Language) mechanism. Among them, AIDL is a mechanism provided by Android for inter-process communication (IPC). AIDL allows communication between different applications and between different components within an application. When the package name and class name of the performance optimization proxy process are known, Intent can be used to specify the package name and class name of the performance optimization proxy process to be bound, and the bindService method can be called to bind.
[0061] The performance optimization main program is used to manage and schedule the resources of the common space and the main user space. The performance optimization proxy process under each sub-user space is used to manage the resource usage under its own user space. After the performance optimization proxy process is successfully bound to the performance optimization main program, the performance optimization main program can call the resource management function of the performance optimization proxy process to achieve management under the sub-user space.
[0062] Optionally, in one embodiment, the method further includes:
[0063] S2021, in response to a creation instruction for a sub-user space, install a performance optimization proxy process in the sub-user space.
[0064] Specifically, when receiving a creation instruction to create a sub-user space, create the sub-user space and synchronously install a performance optimization proxy process in the sub-user space.
[0065] S203, in a multi-user operating system, in response to a system resource management instruction received by the performance optimization main program in the main user space, determine first resource usage data of the main user space based on the performance optimization main program;
[0066] S204, based on the performance optimization main program, call the performance optimization proxy process to determine second resource usage data of the sub-user space;
[0067] In one embodiment, after the performance optimization main program and the performance optimization proxy process are associated, if the performance optimization main program receives a system resource management instruction, it obtains first resource usage data for the main user space, and at the same time calls the performance optimization proxy process to enable each performance optimization proxy process to obtain second resource usage data for its sub-user space.
[0068] S205, display the first resource usage data and the second resource usage data in the performance optimization main program of the main user space;
[0069] In one embodiment, after obtaining the first resource usage data and the second resource usage data, the first resource usage data and the second resource usage data can be displayed in the performance optimization main program of the main user space for the user to view the current system resource usage.
[0070] S206, in response to an optimization space selection operation for the performance optimization main program, determine the target user space corresponding to the optimization space operation;
[0071] In one embodiment, the user can select the target user space to be optimized according to requirements. The target user space can be the main user space, one or more sub - user spaces, or the main user space and sub - user spaces. Optionally, the user can also select overall optimization, and the performance optimization main program automatically optimizes all user spaces, so that the system resources can be better utilized and the problem of freezing can be avoided.
[0072] S207, call the target performance optimization program in the target user space to optimize the system resources of the multi - user operating system occupied by the target user space.
[0073] In one embodiment, according to the selected target user space, the target user space is optimized according to the target performance optimization program installed in the target user space. The target performance optimization program includes the performance optimization main program of the main user space and the performance optimization proxy process of the sub - user space. For example, if the target user space is the main user space, the target performance optimization program is the performance optimization main program; if the target user space is the sub - user space, the target performance optimization program is the performance optimization proxy process.
[0074] Please refer to Figure 5 , Figure 5 which is an interface schematic diagram of a resource management method provided by an embodiment of this specification. Exemplarily, the resource usage data can be displayed on the central control screen of the main user. The resource usage of different user spaces in the system is displayed in each circle, including the overall resource occupancy situation statistically obtained based on the first resource usage data and the second resource usage data, and the respective resource occupancy situations of each user. The user can click "Optimize" in any circle to achieve the optimization of the overall system resources or the resources of a specific user space.
[0075] In the embodiments of this specification, when it is detected that the main user space in the multi-user operating system is enabled, the currently running sub-user spaces are detected, and the performance optimization main program in the main user space is bound to the performance optimization proxy processes under each sub-user space, so as to realize the control of the performance optimization proxy processes by the performance optimization main program. After that, in the multi-user operating system, in response to the system resource management instruction received by the performance optimization main program in the main user space, the first resource usage data of the main user space is determined based on the performance optimization main program, the performance optimization proxy processes are called based on the performance optimization main program to determine the second resource usage data of the sub-user spaces, the first resource usage data and the second resource usage data are displayed in the performance optimization main program in the main user space, and in response to the optimization space selection operation for the performance optimization main program, the target user space corresponding to the optimization space operation is determined. The target user space includes the main user space and / or sub-user spaces, and the target performance optimization program in the target user space is called to optimize the system resources of the multi-user operating system occupied by the target user space, so as to realize the flexible management of the user space according to user needs.
[0076] Please refer to Figure 6 , which is a schematic flowchart of a resource management method provided by the embodiments of this specification. As Figure 6 shown, the method of the embodiments of this specification may include the following steps S301 - S303.
[0077] S301. Determine the user activity levels of the users corresponding to the main user space and the sub-user spaces;
[0078] In one embodiment, the user activity level of the user in the current main user space and the user activity level of the user in the sub-user space are obtained to obtain the user activity levels of all currently enabled user spaces.
[0079] Specifically, the user activity level can be judged according to the login duration and frequency, interactive activities, the frequency of system calls and requests, I / O activities, etc. Exemplarily, the user activity level is judged by monitoring the number of application programs opened and closed by the user and the usage duration of these application programs. Another exemplarily, the user activity level is judged by obtaining the usage duration of the user for different screens.
[0080] S302. Determine a resource management policy based on the user activity levels, the first resource usage data, and the second resource usage data, and use the resource management policy to optimize the system resources of the multi-user operating system;
[0081] In one embodiment, when generating a resource management policy, the resource usage of different user spaces and user activity levels can be referred to. For example, the resource management policy can be to dynamically allocate more resources (such as CPU, memory, bandwidth) to active users to ensure smooth operation. For inactive users, resource allocation is reduced to free up more system resources for other active users. In addition, memory page compression (ZRAM technology) can be performed on the processes of inactive users and decompressed on demand when the user switches. If a user has been inactive for a long time, the system can consider reducing the resources occupied by the user and releasing them to other active users in need of resources.
[0082] S303, if it is determined that there is an abnormal user process based on the first resource usage data and the second resource usage data, then abnormal control of the abnormal user process is performed based on the performance optimization agent process or the performance optimization main program in the user space where the abnormal user process is located.
[0083] In one embodiment, if it is determined that there is an abnormal user process according to the first resource usage data and the second resource usage data, then abnormal control of the abnormal user process is performed based on the performance optimization program (which may be the performance optimization main program or the performance optimization agent process) installed in the user space where the abnormal user process is located. For example, the abnormal control can be to enforce downgrading or freezing of the abnormal process. By analyzing the resource usage of each user process in the resource usage data, it can be determined that user processes with excessive CPU usage, excessive memory usage, and excessive network bandwidth are abnormal user processes. Exemplarily, a baseline model of the resource usage of each process is established through statistical analysis of normal usage conditions. For example, the average value and standard deviation over a past period of time are taken to establish the range of normal behavior. If the resource usage of a user process does not meet the baseline model, it is determined as an abnormal user process.
[0084] Optionally, when monitoring processes based on the performance optimization main program / performance optimization agent process, priorities can be set for each process, so that when resource usage reaches saturation, the processes are controlled according to the priorities. Among them, processes related to ensuring driving safety (such as ADAS) always hold the highest resource priority.
[0085] In the embodiments of this specification, two implementation manners for optimizing the system resources of a multi-user operating system based on first resource usage data and second resource usage data are provided. After obtaining the first resource usage data and the second resource usage data, the user activity levels of each user corresponding to the primary user space and the secondary user spaces can be determined. Based on the user activity levels, the first resource usage data, and the second resource usage data, a resource management policy is determined, and the resource management policy is used to optimize the system resources of the multi-user operating system. By intelligently adjusting resource allocation according to the user activity levels, not only can the front-end user experience be improved, but also the overall efficiency of the system can be enhanced. Based on the resource usage data of each user space, it can be detected whether there are abnormal user processes in the primary user space and the secondary user spaces. If there are abnormal user processes, the system resources can be optimized by controlling the abnormal user processes. By promptly discovering and terminating abnormal processes, it is possible to effectively prevent these processes from continuously occupying system resources (such as CPU, memory, storage, etc.), reducing resource waste.
[0086] Please refer to Figure 7 , which is a schematic flowchart of a resource management method provided by the embodiments of this specification. As Figure 7 shown, the method of the embodiments of this specification may include the following steps S401 - S402.
[0087] S401, loading the high-frequency applications in the multi-user operating system into the primary user space;
[0088] In one embodiment, since high-frequency applications may be used by different users, therefore, the high-frequency applications are loaded into the primary user space, and there is no need to load them when creating each secondary user space. This can save system resources and avoid repeated installations. Taking the vehicle scenario as an example, the high-frequency applications may be vehicle basic services such as navigation and vehicle control. The secondary user space only needs to load the custom application data corresponding to the secondary user (such as personalized settings, third-party APPs).
[0089] S402, when there is a need to use high-frequency applications in the secondary user space, calling the high-frequency applications in the primary user space based on the inter-process communication between the secondary user space and the primary user space.
[0090] In one embodiment, when there is a need to use high-frequency applications in the secondary user space, the high-frequency applications installed in the primary user space can be called according to the inter-process communication between the secondary user space and the primary user space to achieve the reuse of high-frequency applications. The inter-process communication is, for example, Binder communication. Of course, other methods can also be used to implement it, and specific details are not limited.
[0091] Optionally, on the premise of ensuring privacy and data security, data sharing is carried out, a public space is established to allow multiple users to share some common read-only data in the public space (such as navigation data, entertainment content library, etc.), without the need for repeated downloads or occupying local storage, and multiple users share through symbolic links. The private data generated under different user spaces is stored in the corresponding user spaces.
[0092] In the embodiments of this specification, by loading the high-frequency applications in the multi-user operating system into the main user space, when there is a need to use high-frequency applications in the sub-user space, the high-frequency applications in the main user space are called based on the inter-process communication between the sub-user space and the main user space. In this way, the storage methods of the main user space and the sub-user space are improved, thereby avoiding excessive redundant data caused by user data isolation and improving the utilization rate of the storage space.
[0093] The following will be combined with the attached Figure 8 , and a detailed introduction will be given to the resource management device provided in the embodiments of this specification. It should be noted that the resource management device in the attached Figure 8 is used to execute the method of the embodiments shown in this specification Figures 2 - 7 . For the sake of convenience of description, only the parts related to the embodiments of this specification are shown. For the specific technical details not disclosed, please refer to the embodiments shown in this specification Figures 2 - 7 .
[0094] Please refer to Figure 8 , which shows the structural schematic diagram of the resource management device provided by an exemplary embodiment of this specification. This resource management device can be implemented as all or part of the device through software, hardware, or a combination of both. The device 1 includes:
[0095] A first calling unit 11, configured to, in a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the main user space, determine first resource usage data of the main user space based on the performance optimization main program;
[0096] A second calling unit 12, configured to call a performance optimization proxy process based on the performance optimization main program to determine second resource usage data of the sub-user space; the performance optimization proxy process is a proxy process of the performance optimization main program in the sub-user space;
[0097] An optimization unit 13, configured to optimize the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data.
[0098] Optionally, the first calling unit 11 is further configured to: when it is detected that the main user space in the multi-user operating system is enabled, detect the currently running sub-user spaces; bind the performance optimization main program in the main user space to the performance optimization proxy processes under each of the sub-user spaces.
[0099] Optionally, the operation response unit 11 is further configured to: in response to a creation instruction for a sub-user space, install a performance optimization proxy process in the sub-user space.
[0100] Optionally, the optimization unit 13 is specifically configured to: display the first resource usage data and the second resource usage data in the performance optimization main program in the main user space; in response to an optimization space selection operation for the performance optimization main program, determine the target user space corresponding to the optimization space operation; the target user space includes the main user space and / or a sub-user space; call the target performance optimization program in the target user space to optimize the system resources of the multi-user operating system occupied by the target user space; the target performance optimization program includes the performance optimization main program in the main user space and the performance optimization proxy process in the sub-user space.
[0101] Optionally, the optimization unit 13 is specifically configured to: determine the user activity levels of the users corresponding to the main user space and the sub-user spaces;
[0102] Determine a resource management policy based on the user activity levels, the first resource usage data, and the second resource usage data, and use the resource management policy to optimize the system resources of the multi-user operating system.
[0103] Optionally, the optimization unit 13 is specifically configured to: if it is determined based on the first resource usage data and the second resource usage data that there is an abnormal user process, perform abnormal control of the abnormal user process based on the performance optimization proxy process or the performance optimization main program in the user space where the abnormal user process is located.
[0104] Optionally, the first calling unit is specifically configured to: load the high-frequency applications in the multi-user operating system into the main user space; when there is a high-frequency application usage requirement in the sub-user space, call the high-frequency applications in the main user space based on the inter-process communication between the sub-user space and the main user space.
[0105] It should be noted that when the resource management device provided in the above embodiments executes the resource management method, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the resource management device provided in the above embodiments and the resource management method embodiments belong to the same concept. The implementation process is shown in detail in the method embodiments and will not be repeated here.
[0106] The serial numbers of the embodiments in this specification are only for description and do not represent the superiority or inferiority of the embodiments. In some cases, the actions or steps recorded in the claims can be executed in a different order from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0107] This specification embodiment also provides a computer storage medium. A computer program is stored on the computer storage medium. When the computer program is executed by a processor, it implements the resource management method as shown in the above Figures 2 - 7 embodiment. The specific execution process can refer to Figures 2 - 7 the specific description of the shown embodiment and will not be elaborated here.
[0108] Please refer to Figure 9 , which shows a schematic structural diagram of an electronic device provided by an exemplary embodiment of this specification. The electronic device in this specification may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected through the bus 150.
[0109] The processor 110 may include one or more processing cores. The processor 110 connects various parts within the entire electronic device through various interfaces and circuits. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and by invoking data stored in the memory 120, it performs various functions of the terminal 100 and processes data. Optionally, the processor 110 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 110 may integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interfaces, and application programs, etc.; the GPU is responsible for rendering and drawing the display content; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110 and may be implemented separately through a communication chip.
[0110] The memory 120 may include random access memory (RAM), and may also include read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable medium. The memory 120 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be the Android system, including a system developed based on the Android system in depth, the IOS system developed by Apple Inc., including a system developed based on the IOS system in depth, or other systems.
[0111] The memory 120 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local resource loading scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and third-party applications are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.
[0112] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0113] The input device 130 is used to receive input commands or data, and includes but is not limited to a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used to output commands or data, and includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are touch screen displays.
[0114] The touch display screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of this specification.
[0115] In addition, those skilled in the art can understand that the structure of the electronic device shown in the above drawings does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a WiFi module, a power supply, and a Bluetooth module, which will not be described in detail here.
[0116] exist Figure 9 In the electronic device shown, the processor 110 may be used to call a computer application stored in the memory 120 and specifically perform the following operations:
[0117] In a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the primary user space, first resource usage data of the primary user space is determined based on the performance optimization main program;
[0118] Based on the performance optimization main program, a performance optimization agent process is called to determine second resource usage data of the secondary user space; the performance optimization agent process is an agent process of the performance optimization main program in the secondary user space;
[0119] The system resources of the multi-user operating system are optimized based on the first resource usage data and the second resource usage data.
[0120] In one embodiment, before the processor 110 executes, in a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the primary user space, and determining the first resource usage data of the primary user space based on the performance optimization main program, the following operations are further performed:
[0121] When it is detected that the primary user space in the multi-user operating system is turned on, the currently running secondary user space is detected;
[0122] The performance optimization main program in the primary user space is bound to the performance optimization agent processes under each secondary user space.
[0123] In one embodiment, the processor 110 may further perform the following operations:
[0124] In response to a creation instruction for a secondary user space, a performance optimization agent process is installed in the secondary user space.
[0125] In one embodiment, when the processor 110 executes optimizing the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data, the following operations may specifically be performed:
[0126] The first resource usage data and the second resource usage data are displayed in the performance optimization main program in the primary user space;
[0127] In response to an optimization space selection operation for the performance optimization main program, a target user space corresponding to the optimization space operation is determined; the target user space includes the primary user space and / or a secondary user space;
[0128] The target performance optimization program in the target user space is called to optimize the system resources of the multi-user operating system occupied by the target user space; the target performance optimization program includes the performance optimization main program in the primary user space and the performance optimization agent process in the secondary user space.
[0129] In one embodiment, when the processor 110 optimizes the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data, the following operations are specifically performed:
[0130] Determine the user activity of each user corresponding to the main user space and the sub-user space;
[0131] Determine a resource management policy based on the user activity, the first resource usage data, and the second resource usage data, and use the resource management policy to optimize the system resources of the multi-user operating system.
[0132] In one embodiment, when the processor 110 optimizes the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data, the following operations are specifically performed:
[0133] If it is determined based on the first resource usage data and the second resource usage data that there is an abnormal user process, perform abnormal control of the abnormal user process based on the performance optimization agent process or the performance optimization main program in the user space where the abnormal user process is located.
[0134] In one embodiment, the processor 110 may further perform the following operations:
[0135] Load the high-frequency applications in the multi-user operating system into the main user space;
[0136] When there is a high-frequency application usage requirement in the sub-user space, call the high-frequency applications in the main user space based on the inter-process communication between the sub-user space and the main user space.
[0137] In the embodiments of this specification, in the multi-user operating system, in response to a system resource management instruction received by the performance optimization main program in the main user space, determine the first resource usage data of the main user space based on the performance optimization main program, call the performance optimization agent process based on the performance optimization main program to determine the second resource usage data of the sub-user space, and optimize the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data, thereby realizing one-stop management of the multi-user system resources, and further improving the response speed, efficiency, and reducing resource consumption of the entire system.
[0138] Further, when it is detected that the main user space in the multi-user operating system is enabled, the currently running sub-user spaces are detected, and the performance optimization main program in the main user space is bound to the performance optimization proxy processes under each sub-user space, so as to realize the control of the performance optimization proxy processes by the performance optimization main program. After that, in the multi-user operating system, in response to the system resource management instruction received by the performance optimization main program in the main user space, the first resource usage data of the main user space is determined based on the performance optimization main program, and the performance optimization proxy processes are called based on the performance optimization main program to determine the second resource usage data of the sub-user spaces. The first resource usage data and the second resource usage data are displayed in the performance optimization main program in the main user space. In response to the optimization space selection operation for the performance optimization main program, the target user space corresponding to the optimization space operation is determined. The target user space includes the main user space and / or the sub-user spaces, and the target performance optimization program in the target user space is called to optimize the system resources of the multi-user operating system occupied by the target user space, so as to realize the flexible management of the user spaces according to user needs.
[0139] Further, two implementation manners for optimizing the system resources of the multi-user operating system based on the first resource usage data and the second resource usage data are provided. After obtaining the first resource usage data and the second resource usage data, the user activity levels of the users corresponding to the main user space and the sub-user spaces can be determined, and a resource management policy is determined based on the user activity levels, the first resource usage data, and the second resource usage data. The resource management policy is used to optimize the system resources of the multi-user operating system. By intelligently adjusting the resource allocation according to the user activity levels, not only can the foreground user experience be improved, but also the overall efficiency of the system can be enhanced. Based on the resource usage data of each user space, it can be detected whether there are abnormal user processes in the main user space and the sub-user spaces. If there are abnormal user processes, the system resources are optimized by controlling the abnormal user processes. By timely discovering and terminating the abnormal processes, it can effectively prevent these processes from continuously occupying system resources (such as CPU, memory, storage, etc.) and reduce resource waste.
[0140] Further, by loading the high-frequency applications in the multi-user operating system into the main user space, when there is a high-frequency application usage requirement in the sub-user space, the high-frequency applications in the main user space are called based on the inter-process communication between the sub-user space and the main user space. By this means, the storage manners of the main user space and the sub-user spaces are improved, thereby avoiding excessive redundant data caused by user data isolation and increasing the storage space utilization rate.
[0141] In addition, an embodiment of this specification provides a computer program product. The computer program product includes a computer program. When the computer program is executed by a processor of a vehicle, the processor can at least implement as described above Figures 2 to 7The resource management method provided in the illustrated embodiment.
[0142] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above-described embodiments can be completed by instructing relevant hardware through a computer program. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above various methods. Among them, the foregoing storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0143] The foregoing disclosure is only for the better embodiments of this specification. Of course, it cannot be used to limit the scope of rights of this specification. Therefore, equivalent changes made according to the claims of this specification still fall within the scope covered by this specification.
Claims
1. A resource management method, characterized in that, The method includes: In a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the primary user space, determining first resource usage data of the primary user space based on the performance optimization main program; Invoking a performance optimization agent process based on the performance optimization main program to determine second resource usage data of a secondary user space; the performance optimization agent process is an agent process of the performance optimization main program in the secondary user space; Optimizing system resources of the multi-user operating system based on the first resource usage data and the second resource usage data.
2. The method according to claim 1, characterized in that, Before the step of, in a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the primary user space, determining first resource usage data of the primary user space based on the performance optimization main program, the method further includes: When detecting that the primary user space in the multi-user operating system is enabled, detecting the currently running secondary user spaces; Binding the performance optimization main program in the primary user space to the performance optimization agent processes under each of the secondary user spaces.
3. The method according to claim 2, wherein The method further includes: In response to a creation instruction for a secondary user space, installing a performance optimization agent process in the secondary user space.
4. The method according to claim 1, wherein The step of optimizing system resources of the multi-user operating system based on the first resource usage data and the second resource usage data includes: Displaying the first resource usage data and the second resource usage data in the performance optimization main program in the primary user space; In response to an optimization space selection operation for the performance optimization main program, determining a target user space corresponding to the optimization space operation; the target user space includes the primary user space and / or a secondary user space; Invoking a target performance optimization program in the target user space to optimize system resources of the multi-user operating system occupied by the target user space; the target performance optimization program includes the performance optimization main program in the primary user space and the performance optimization agent process in the secondary user space.
5. The method according to claim 1, wherein The step of optimizing system resources of the multi-user operating system based on the first resource usage data and the second resource usage data includes: Determining the user activity levels of the users corresponding to the primary user space and the secondary user spaces; Determining a resource management policy based on the user activity levels, the first resource usage data, and the second resource usage data, and using the resource management policy to optimize system resources of the multi-user operating system.
6. The method according to claim 1, wherein The step of optimizing system resources of the multi-user operating system based on the first resource usage data and the second resource usage data includes: If it is determined based on the first resource usage data and the second resource usage data that there is an abnormal user process, performing abnormal control of the abnormal user process based on the performance optimization agent process or the performance optimization main program in the user space where the abnormal user process is located.
7. The method according to claim 1, characterized in that The method further includes; Loading high-frequency applications in the multi-user operating system into the primary user space; When there is a high-frequency application usage requirement in the sub-user space, the high-frequency application in the main user space is called based on the inter-process communication between the sub-user space and the main user space.
8. A resource management device, characterized in that, The device includes: A first calling unit, configured to, in a multi-user operating system, in response to a system resource management instruction received by a performance optimization main program in the main user space, determine first resource usage data of the main user space based on the performance optimization main program; A second calling unit, configured to call a performance optimization proxy process based on the performance optimization main program to determine second resource usage data of the sub-user space; the performance optimization proxy process is a proxy process of the performance optimization main program in the sub-user space; An optimization unit, configured to optimize system resources of the multi-user operating system based on the first resource usage data and the second resource usage data.
9. An electronic device, characterized in that, The electronic device includes: a processor and a memory; wherein the memory stores a computer program, and the computer program is adapted to be loaded and executed by the processor to perform the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Inactive user data management method and device, equipment and storage medium
CN122045147A
A non-active user data management method, device, equipment and storage medium
CN122045147B
