Resource management method and device, electronic equipment, storage medium and product
By dynamically allocating and managing resources in a multi-operating system environment, the problem of low resource utilization efficiency is solved, cross-operating system resource allocation is realized, critical processes are ensured to obtain resources in a timely manner, system performance and stability are improved, and user experience is enhanced.
Patent Information
- Application Number
- CN202510860078.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-24
AI Technical Summary
In a multi-operating system environment, existing technologies struggle to effectively manage and allocate resources, resulting in low resource utilization efficiency, slow system response speed, insufficient or wasted resources in critical processes, which in turn affects system stability and user experience.
By obtaining the resource requirements of the target process on the first operating system for the second operating system, and dynamically allocating available resources based on the requirements and process priorities, we ensure that critical processes get resources first, allocate background process resources reasonably, suspend low-priority processes to release resources, and use predictive models for resource reservation and dynamic adjustment.
It improves resource utilization efficiency and system response speed under multiple operating systems, ensures that critical processes obtain resources in a timely manner, enhances the overall performance and stability of the operating system, avoids resource waste and conflicts, and improves user experience.
Smart Images

Figure CN120832233A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, in particular to a resource management method and device, electronic equipment, storage medium and product. BACKGROUND
[0002] With the rapid development of information technology, in a complex computing environment, there are usually multiple operating systems coexisting, and therefore there is a resource management demand between multiple operating systems. SUMMARY
[0003] Therefore, the embodiments of the present application provide a resource management method and device, electronic equipment, storage medium and product.
[0004] In a first aspect, the embodiments of the present application provide a resource management method, which comprises: obtaining demand information of at least one target process on a first operating system, wherein the target process is a process requiring resources of a second operating system, and the demand information indicates resources of the second operating system required by the target process; and allocating allocable resources from the second operating system to the at least one target process according to the demand information of the at least one target process, wherein the allocable resources are resources that can be allocated to processes on the first operating system and come from the second operating system.
[0005] The resource management method provided by the embodiments of the present application obtains the demand information of the target process on the first operating system for the resources of the second operating system, and allocates the allocable resources from the second operating system to the target process according to the demand information, thereby realizing cross-operating system resource allocation, improving resource utilization efficiency and system response speed under multiple operating systems. Meanwhile, in the scenario of multiple operating systems coexisting, the allocable resources of the second operating system are allocated to the corresponding target process based on the demand of the target process running on the first operating system, so that the key process running on the first operating system can obtain the required resources in time, and the stable operation of the processes in each operating system is ensured.
[0006] In combination with the first aspect, in an implementation mode, allocating the allocable resources from the second operating system to the at least one target process according to the demand information of the at least one target process comprises: determining the allocation of the allocable resources from the second operating system to the at least one target process according to the demand information of the at least one target process and the priority of the at least one target process.
[0007] The resource management method provided by the embodiments of the present application determines the allocation of the allocable resources according to the demand of the target process for the resources and the priority of the target process, thereby realizing the on-demand reasonable allocation of resources, ensuring that the key or urgent process can obtain the required resources in priority, and further improving the overall performance and response speed of the operating system.
[0008] In combination with the first aspect, in an implementation, the method further includes determining the priority of the process on the first operating system according to the use of the process on the first operating system and whether the process is in the foreground.
[0009] The resource management method provided in this embodiment determines the priority of the process according to the use of the process and whether the process is in the foreground, thereby giving a higher priority to the process running in the foreground, especially the process frequently interacting with the user or performing a critical task, to ensure that the process can run smoothly and will not be stuck or crashed due to insufficient resources. The resources are reasonably allocated to the process running in the background according to the actual demand and importance of the process, to avoid waste and conflict of resources, thereby ensuring that the resources can be more efficiently utilized, and the user experience is improved.
[0010] In combination with the first aspect, in an implementation, determining the allocable resources of the second operating system to be allocated to the at least one target process according to the demand information of the at least one target process and the priority of the at least one target process includes: determining the allocable resources of the second operating system to be allocated to the at least one target process according to the demand information of the at least one target process, the priority of the at least one target process, and the load of the second operating system.
[0011] The resource management method provided in this embodiment determines the allocation of resources according to the demand information and priority of the target process and the current load of the second operating system, thereby not only ensuring that the critical or urgent process can obtain the required resources, but also ensuring the overall running state of the operating system, avoiding the situation that other processes are affected due to excessive allocation of resources to a process, and effectively balancing the resource demand between processes, thereby further improving the stability and performance of the operating system.
[0012] In combination with the first aspect, in an implementation, the method further includes: when the load of the second operating system is less than a load threshold, suspending execution of a low-priority process on the second operating system with a priority less than a priority threshold; and determining the resources of the second operating system allocated to the low-priority process as the allocable resources.
[0013] The resource management method provided in this embodiment suspends the execution of the low-priority process when it is detected that the load of the second operating system is light, and redefines the resources originally allocated to the low-priority process as allocable resources, thereby further improving the utilization and flexibility of resources. Meanwhile, under the condition of low load, by suspending the running of the low-priority process, unnecessary resource occupation is reduced, and more resource space is reserved for possible subsequent high-priority or urgent tasks, thereby ensuring that the operating system can quickly respond to various task demands, and further enhancing the adaptability and stability of the operating system.
[0014] In combination with the first aspect, in an implementation, determining the allocable resource of the second operating system comprises: when the load of the second operating system is less than the load threshold, determining a part of the resource of the second operating system allocated to the low-priority process as the allocable resource.
[0015] The resource management method provided by the embodiment reserves a certain running capability for the low-priority process while ensuring the resource requirement of the critical task, and avoids possible service interruption or data loss caused by complete stop.
[0016] In the second aspect, the embodiment of the present application provides a resource management apparatus, comprising: an information obtaining module, configured to obtain demand information of at least one target process on a first operating system, wherein the target process is a process requiring resources of a second operating system, and the demand information indicates resources of the second operating system required by the target process; and a resource management module, configured to allocate allocable resources to the at least one target process according to the demand information of the at least one target process, wherein the allocable resources are resources that can be allocated to processes on the first operating system and come from the second operating system.
[0017] In the third aspect, the embodiment of the present application provides an electronic device, comprising: a memory and a processor, which are in communication connection with each other, and the memory stores computer instructions; the processor executes the computer instructions, thereby executing the resource management method of the first aspect or any of the corresponding implementation manners thereof.
[0018] In the fourth aspect, the embodiment of the present application provides a computer readable storage medium, which stores computer instructions, and the computer instructions are used to make a computer execute the resource management method of the first aspect or any of the corresponding implementation manners thereof.
[0019] In the fifth aspect, the embodiment of the present application provides a computer program product, which comprises computer instructions, and the computer instructions are used to make a computer execute the resource management method of the first aspect or any of the corresponding implementation manners thereof. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0021] Figure 1is a flowchart of a resource management method according to some embodiments of the present application;
[0022] Figure 2 is a flowchart of another resource management method according to some embodiments of the present application;
[0023] Figure 3 is a structural block diagram of a resource management apparatus according to an embodiment of the present application;
[0024] Figure 4 is a hardware structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0026] According to an embodiment of the present application, a resource management method embodiment is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0027] In the present embodiment, a resource management method is provided, which can be executed by a target electronic device, and the target electronic device can be any electronic device to which the resource management method provided by the embodiments of the present application can be applied, Figure 1 is a flowchart of a resource management method according to an embodiment of the present application, as shown in Figure 1 the flowchart includes the following steps:
[0028] In step S101, demand information of at least one target process on a first operating system is acquired.
[0029] The target process is a process that needs resources of a second operating system, and the demand information indicates resources of the second operating system needed by the target process, i.e., resources of the second operating system needed to ensure the running of the target process in addition to the resources allocated by the first operating system. The first operating system and the second operating system can be different types of operating systems. For example, the first operating system can be an Android system, and the second operating system can be a QNX system or a linux system.
[0030] In the embodiment, when the first operating system and the second operating system co-run the target electronic device, some processes on the first operating system can need to call resources on the second operating system to complete a specific task or keep the task from being interrupted, and therefore, the demand information of one or more target processes on the first operating system needs to be collected first. The demand information can include, but is not limited to, the resource type (such as CPU computing power, memory space, storage bandwidth, network connection, etc.) required by the target process, the resource demand amount (such as the number of CPU cores, the type of CPU core, the capacity of memory, the I / O throughput, etc.), the resource use time length (such as short-term borrowing, long-term occupation, time slice length, time slice proportion, etc.), and the resource use scenario (such as real-time calculation, batch processing, graphics rendering, etc.). These information can be obtained through an inter-process communication mechanism or a corresponding resource management interface.
[0031] In a possible implementation, the processes that need the resources of the second operating system can be identified as target processes by monitoring the running states of the processes on the first operating system. Then, the specific demand information of the target processes for the resources of the second operating system is determined according to the requests or resource demand marks of the target processes, so as to accurately capture the resource demand of the target processes and provide a reliable basis for subsequent resource allocation.
[0032] In a possible implementation, the first operating system can actively send the demand information of the target processes to the second operating system periodically or in real time, or the second operating system can actively query the demand information of the target processes on the first operating system, so as to ensure the timeliness and accuracy of information acquisition and provide a basis for effective allocation of resources.
[0033] For example, when the first operating system is an Android system and the second operating system is a QNX system, the Android system is used to run applications such as navigation, human-computer interaction interface, monitoring and display, multimedia entertainment, etc. When a user needs to obtain real-time traffic information and replan a route during navigation, the process has a high resource demand. At this time, the application process on the Android system is a target process, and the demand information of the target process can include the CPU computing power, memory space, and time slice required for performing the calculation task, which are provided by the QNX system. By obtaining the demand information, the QNX system can accurately allocate the corresponding resources to the target process, so as to ensure the smooth completion of the task.
[0034] In step S102, the allocable resources are allocated to the at least one target process according to the demand information of the at least one target process.
[0035] The allocable resources are resources that can be allocated to the processes on the first operating system and come from the second operating system.
[0036] In the embodiment, the current resource usage, resource reserve and resource allocation strategy of the second operating system can be used to ensure that the target process on the first operating system is allocated with resources reasonably without affecting the normal operation of the second operating system. Specifically, the most suitable resources can be selected and allocated to the target process according to the demand information of the target process, such as resource type, resource demand, resource usage duration, and the resource distribution of the second operating system. Meanwhile, in order to avoid over-allocation or under-allocation of resources, the load of the second operating system, resource usage trend and other factors can be used to adjust the allocation of resources dynamically to achieve the optimal allocation of resources.
[0037] In a possible implementation, when the allocable resources allocated by the second operating system to the first operating system are determined, the total allocable resources of the second operating system, including the idle resources and / or the selected allocable resources, can be determined first. The idle resources are the resources that are not used by any process on the second operating system, and the selected allocable resources are the resources that are used by the low-priority or non-critical processes on the second operating system, but can be reallocated or temporarily allocated to the target process on the first operating system.
[0038] In a possible implementation, when the allocable resources are allocated to the at least one target process according to the demand information of the at least one target process, if the resources of the second operating system are limited or multiple target processes request resources simultaneously, the priority of the target process, the urgency of resource demand, the predicted benefit of resource usage and other factors can be considered comprehensively, and the amount and type of resources allocated to each target process can be determined by weighted summation, sorting selection and other methods. In addition, in order to ensure the fairness and rationality of resource allocation, polling, time slice rotation, priority preemption and other scheduling algorithms can be used to adjust the allocation of resources dynamically, so as to avoid the over-concentration or idle waste of resources.
[0039] In a possible implementation, the resources of the second operating system can also be pre-allocated and reserved before the resources are allocated. For example, based on historical data or a prediction model, the types and amounts of resources that the target process on the first operating system can need can be estimated, and the corresponding resources can be reserved in the second operating system in advance. When the target process actually issues a resource request, the response can be quick and the resources can be allocated from the reserved resources, reducing the delay of resource allocation and improving the response speed of the system. The prediction model can be constructed based on a machine learning algorithm, by analyzing historical resource usage data, the type of the target process, the running law, and the load condition of the second operating system, and the like, to train a model that can predict future resource demand. The prediction model can be updated regularly to adapt to changes in the use scenario of the target electronic device and fluctuations in the resource demand of the target process. By using the prediction model for resource pre-allocation and reservation, the efficiency and accuracy of resource management can be further improved, to ensure that critical tasks can obtain the required resources in time, and to improve user experience and system performance.
[0040] In addition, a reasonable resource quota can be set for each target process according to the priority of each target process on the first operating system, historical resource usage, and the like, to ensure that the resources can be allocated fairly and effectively. Specifically, the resource quota can be dynamically adjusted according to the priority of the target process, historical resource usage, current system load, and future resource demand predicted by the prediction model, and the like. When the target process requests resources, whether to allocate resources is determined according to the quota, which can avoid some processes from excessively occupying resources and prevent other processes from obtaining necessary resources, thereby ensuring the overall performance and stability of the system.
[0041] In another possible implementation, historical resource usage data can also be analyzed and learned to predict the trend of future resource demand, and the resource allocation strategy can be dynamically adjusted according to the prediction result. For example, when it is predicted that a target process will soon need a large amount of resources, more resources can be allocated to the process in advance from the second operating system to ensure that the process can complete the task smoothly.
[0042] The resource management method provided in this embodiment achieves cross-operating system resource allocation by obtaining the demand information of the target process on the first operating system for the resources of the second operating system, and allocating the allocable resources from the second operating system to the target process according to the demand information, thereby improving the resource utilization efficiency and system response speed under multiple operating systems. At the same time, in the scenario where multiple operating systems coexist, the allocable resources of the second operating system are allocated to the corresponding target process based on the demand of the target process running on the first operating system, so that the critical process running on the first operating system can obtain the required resources in time, and the stable operation of the processes in each operating system is ensured.
[0043] A resource management method is provided in the embodiment, which can be executed by a target electronic device, and the resource management method provided by the embodiment of the present disclosure can be applied to any electronic device, Figure 2 is a flowchart of the resource management method according to the embodiment of the present disclosure, as shown in the figure, the flow includes the following steps: Figure 2
[0044] In step S201, requirement information of at least one target process on the first operating system is acquired. For details, please refer to step S101 of the embodiment shown in Figure 1 The embodiment is not described here again.
[0045] In step S202, the allocable resources are determined to be allocated to the at least one target process according to the requirement information of the at least one target process and the priority of the at least one target process.
[0046] In the present embodiment, when determining to allocate the allocable resources to the at least one target process according to the requirement information of the at least one target process and the priority of the at least one target process, the requirement information of each target process can be analyzed in detail first, and the target processes are sorted according to the priority. The target processes with higher priority will be allocated resources first to ensure that critical tasks can quickly obtain the required resources and be executed. At the same time, for the target processes with lower priority, appropriate resource allocation can also be made according to their requirement information and resource availability to maintain the overall balance and efficiency of the system.
[0047] As an example, it is assumed that there are three target processes on the first operating system, namely process A, process B and process C. Process A has the highest priority and is responsible for handling urgent data transmission tasks; process B has a medium priority and is responsible for daily monitoring of the system; process C has the lowest priority and is responsible for some non-critical background tasks. When allocating resources, the requirement information of process A will be analyzed first to ensure that process A can obtain sufficient resources to quickly complete the data transmission task. Subsequently, process B will be allocated appropriate resources according to its requirement to maintain the daily monitoring function of the system. Finally, for process C, appropriate resource allocation will be made according to the remaining resources and the requirement information of process C to ensure the overall balance and efficiency of the system, effectively improving the stability and task execution efficiency of the system.
[0048] The resource management method provided by the present embodiment determines the allocation of allocable resources according to the requirement of the target process for resources and the priority of the target process itself, realizes the reasonable allocation of resources on demand, and ensures that critical or urgent processes can obtain the required resources first, further improving the overall performance and response speed of the operating system.
[0049] In a possible implementation, the priority of the process on the first operating system can be determined according to the use of the process on the first operating system and whether the process is in the foreground.
[0050] Specifically, the priority of the process can be initially set according to the use of the process, such as whether the process is a system critical process, a user interaction process, or a background service process. System critical processes, such as operating system kernel processes, security processes, and the like, are usually assigned a high priority to ensure stable operation of the system. User interaction processes, such as running applications, games, and the like, are also assigned a high priority if they are in the foreground and need to respond to user operations in real time. Background service processes, such as data synchronization, cache cleaning, system updating, and the like, are usually assigned a low priority to avoid interfering with the running of foreground processes. At the same time, when the process is in the foreground, it is usually assigned a higher priority to ensure that the user can interact smoothly with the process. When the process is in the background, its priority may be reduced accordingly to reduce the occupation of system resources.
[0051] As an example, the priority of the process can be dynamically adjusted according to the real-time behavior of the process, such as CPU usage, memory occupation, I / O operation frequency, and the like. For example, when a background service process suddenly starts to occupy a large amount of system resources, affecting the normal operation of foreground processes, the priority of the background service process can be automatically reduced to ensure that foreground processes can obtain sufficient resources and maintain good response speed. Conversely, if a foreground process temporarily does not need a large amount of resources for some reason, its priority can be adjusted appropriately to allocate more resources to other processes that need them, to improve the overall efficiency and stability of the system.
[0052] The resource management method provided by the embodiment determines the priority of the process according to the use of the process and whether the process is in the foreground, so that for foreground running processes, especially those that frequently interact with users or perform critical tasks, a higher priority is given to ensure that they can run smoothly and will not be stuck or crashed due to insufficient resources. For background running processes, resources are allocated reasonably according to their actual needs and importance to avoid waste and conflict of resources, so that resources can be more efficiently utilized, and the user experience is also improved.
[0053] In a possible implementation, the allocation of the allocable resources to the at least one target process can also be determined according to the demand information of the at least one target process, the priority of the at least one target process, and the load of the second operating system.
[0054] Specifically, in the process of resource allocation, first, the demand information of the target process needs to be obtained, including the amount of resources required, resource usage mode, etc., as well as the priority of the process. The process with higher priority will obtain more resource allocation inclination to ensure its efficient operation. At the same time, the overall load of the second operating system is monitored, and the resource allocation strategy is dynamically adjusted according to the change of the load. For example, when the load is light, more fine control of resource allocation is needed to ensure the operation of critical processes is not affected. At this time, the allocation scheme of resources can be further evaluated and adjusted according to the priority, demand urgency and resource use efficiency of the process, etc. For example, for the process with high priority and urgent demand, even if the system load is heavy, it should be ensured that it obtains enough resources to ensure that it can complete the critical task on time. For those processes with low priority or low resource use efficiency, their resource allocation can be appropriately reduced to avoid waste and conflict of resources, and to ensure that resources can be efficiently and reasonably utilized under different load conditions, thereby improving the stability and performance of the entire system.
[0055] As an example, when it is detected that the resource use efficiency of a certain process is continuously low, and the process is not a critical task, the resource recycling mechanism can be automatically triggered to recycle the resources occupied by the process and allocate them to other processes that need resources more, which can effectively avoid long-term occupation and waste of resources, and ensure that resources are always in an efficient flow state. In addition, the resource usage of each process can be evaluated periodically, and for processes that occupy a large amount of resources for a long time but have low output efficiency, optimization suggestions or automatic adjustments can be given to further improve the efficiency of resource utilization, and to ensure efficient and reasonable allocation and utilization of resources, providing strong protection for stable operation and performance improvement of the system.
[0056] As another example, when the second operating system faces a resource shortage situation, such as insufficient memory or CPU overload, the resource recycling and reallocation mechanism can be triggered to analyze the resource usage and priority of all processes, identify processes with low resource use efficiency or low priority, and try to recycle part or all of the resources occupied by them. The recycled resources will be reallocated to processes with urgent resource needs and high priority to ensure that critical tasks can be completed smoothly, thereby helping to maximize the overall performance and stability of the system in the case of limited resources.
[0057] The resource management method provided by the embodiment determines the allocation of resources according to the demand information and priority of the target process and the current load condition of the second operating system, ensures that the key or urgent process can obtain the required resources, guarantees the overall running state of the operating system, avoids the situation that other processes are affected due to excessive allocation of resources to a process, and further improves the stability and performance of the operating system.
[0058] In a possible implementation, when the load of the second operating system is less than the load threshold, the low-priority processes with a priority less than the priority threshold on the second operating system can be suspended; and the resources allocated to the low-priority processes by the second operating system are determined as the allocable resources.
[0059] Specifically, when the load of the second operating system is at a low level, i.e., less than the preset load threshold, it is determined that the second operating system has more idle resources. At this time, in order to further optimize the resource allocation and improve the resource utilization efficiency, the low-priority processes with a priority less than the priority threshold on the second operating system can be suspended. These low-priority processes usually execute some non-critical or non-urgent tasks, and have relatively small influence on the overall performance of the system and the user experience. By suspending the execution of these processes, the resources occupied by the processes can be released as allocable resources for other processes in need.
[0060] When determining which low-priority processes need to be suspended, the preset priority threshold can be used for judgment. The priority threshold is a parameter set according to the actual situation and demand of the system, and is used to distinguish which processes have a low priority and can be suspended. When the priority of the low-priority process is less than the threshold, it is considered that the process can be suspended, and the resources occupied by the process can be regarded as allocable resources.
[0061] After the low-priority processes are suspended and the allocable resources are determined, the allocable resources can be allocated to the corresponding target processes according to the demand information and priority of the target processes on the first operating system. In this way, not only can the key or urgent process obtain the required resources, but also the overall utilization efficiency of the resources can be improved, and the waste and conflict of the resources can be avoided. At the same time, since the low-priority processes are suspended, the overall load of the second operating system is further reduced, and a better environment is provided for the running of other processes.
[0062] It should be noted that the suspended low-priority processes in this embodiment do not have a serious impact on the overall performance and user experience of the system. In addition, after the resource allocation is completed, when the load of the second operating system rises or the target processes on the first operating system no longer need these resources, the second operating system should promptly resume the execution of the suspended low-priority processes to ensure the normal operation of the system and the reasonable use of resources.
[0063] As an example, it is assumed that there are multiple processes running on the second operating system, including process D, process E, and process F. Process D is responsible for the timing task of the system and has a medium priority; process E is responsible for data backup and has a low priority; process F is an application that a user is using, but since the current user is not performing any operation, its priority is also considered to be low. When the load of the second operating system is lower than the load threshold, the execution of processes E and F can be suspended, and the resources occupied by them can be determined as allocatable resources. Subsequently, according to the demand information and priority of the target processes on the first operating system, these allocatable resources can be allocated to the corresponding target processes. For example, if process A on the first operating system requests more resources to speed up the data transmission task at this time, part or all of the resources released by processes E and F can be allocated to process A to ensure that it can complete the task smoothly. When the target processes on the first operating system no longer need these resources, or the load of the second operating system rises above the load threshold, the execution of processes E and F can be resumed to ensure the normal operation of the system and the normal use of the user, so as to ensure that critical or urgent processes obtain the required resources while also improving the overall utilization efficiency of resources as much as possible, avoiding waste and conflicts of resources, and providing strong protection for the stable operation and performance improvement of the system.
[0064] The resource management method provided in this embodiment further improves the utilization and flexibility of resources by suspending the execution of low-priority processes when it is detected that the load of the second operating system is light, and redefining the resources originally allocated to these low-priority processes as allocatable resources. At the same time, under the condition of low load, by suspending the running of low-priority processes, not only unnecessary resource occupation is reduced, but also more resource space is reserved for possible subsequent high-priority or urgent tasks, so as to ensure that the operating system can quickly respond to various task demands, and further enhance the adaptability and stability of the operating system.
[0065] In one possible implementation, a part of the resources allocated to low-priority processes of the second operating system can be determined as allocatable resources when the load of the second operating system is less than the load threshold.
[0066] Specifically, a resource allocation threshold can be set, and when the load of the second operating system is below the threshold, the priority of each process currently running is evaluated, and the resources occupied by those with lower priority are released as allocable resources. These allocable resources can then be reallocated to those with higher priority or emergency, or used to perform other important tasks. Through such a dynamic resource allocation mechanism, it can be ensured that in the case of light load, resources are more reasonably and efficiently utilized, and at the same time, more sufficient resource reserves are provided for the system to cope with possible high load or emergency tasks.
[0067] As an example, process G running on the second operating system is responsible for system logging, and has a lower priority. When it is detected that the load of the second operating system is below the load threshold, the execution of process G is not completely suspended, but only a part of the resources it occupies are released as allocable resources. In this way, process G can still continue to perform its logging task, but the system resources it occupies will be reduced. If at this time a high-priority process on the first operating system requests more resources, the allocable resources released by process G can be allocated to the high-priority process to meet its resource needs. When the target process on the first operating system no longer needs these resources, or the load of the second operating system rises above the load threshold, the resource allocation to process G can be gradually increased to ensure that it can normally complete the task. Through the way of partial resource release, the resource needs of critical or emergency processes are guaranteed, and the problem of system instability and user experience degradation caused by completely suspending low-priority processes is avoided, further improving the flexibility of resource management and the overall performance of the system.
[0068] As another example, in the process of resource allocation, the dependency relationship between each process running on the second operating system can also be considered. For example, some processes may depend on the services or data provided by other processes, and if the execution of these dependent processes is directly suspended, it may cause other processes to malfunction, or even cause system errors. Therefore, when determining which low-priority processes can be suspended, the dependency relationship between processes needs to be considered to ensure that the suspended processes do not negatively affect the overall operation of the system.
[0069] To avoid potential problems caused by directly suspending the processes, when it is detected that the load of the second operating system is lower than the load threshold, instead of directly suspending the execution of the low-priority processes, the running of the low-priority processes can be indirectly affected by reducing the priorities of the processes, limiting the resource usage of the processes, and the like. Meanwhile, the actual resource usage of the processes and the change of the overall load of the system are monitored, and dynamic adjustment is performed as needed. If a low-priority process starts to occupy too many resources and affects the running of other critical processes, the resource usage of the low-priority process can be further limited in a timely manner, or part of the resources occupied by the low-priority process can be redistributed to other processes in need, so that the required resources of the critical or urgent processes are ensured, and the impact on other processes is reduced as much as possible, and the overall stability and performance of the system are maintained.
[0070] The resource management method provided in this embodiment ensures the resource requirements of critical tasks, and reserves certain running capability for low-priority processes when the load is light, thereby avoiding possible service interruption or data loss problems caused by complete stopping.
[0071] In a possible implementation, the initial priority of the process on the first operating system can also be determined according to the use of the process on the first operating system and whether the process is in the foreground; and the current priority of the process on the first operating system is determined according to the initial priority of the process and the process operation information.
[0072] Specifically, different initial priorities can be assigned to processes according to whether the processes are critical task processes, system service processes, or processes with frequent user interactions, and the like. For example, critical task processes and system service processes can be assigned higher initial priorities, and background processes with lower user interaction frequency can be assigned lower initial priorities. Meanwhile, the process operation information is also an important basis for determining the current priority of the process. For example, when a process frequently performs a large amount of read-write operation, occupies a large amount of CPU resources or memory resources, the priority of the process can be dynamically adjusted to reduce the occupation of system resources by the process. In contrast, when a process is in an idle state or occupies fewer resources, the priority of the process can be increased to fully utilize system resources. Through such a priority adjustment mechanism, system resources can be more reasonably and efficiently utilized.
[0073] As an example, for some critical task processes, even if they are temporarily in an inactive state, the higher priorities of the processes can be maintained to ensure that the required system resources can be quickly obtained once the tasks are activated. For some non-critical but frequently user-interacted processes, although the initial priorities of the processes can be not high, the priorities of the processes can be temporarily increased when the user interacts with the processes, so as to improve the user experience and further improve the response speed and overall performance of the system.
[0074] In a possible implementation, when the load of the second operating system is less than the load threshold, the allocable resources of the process in the second operating system without the protection mark added can also be obtained in the allocable resource period; and the allocable resources are allocated to the at least one target process according to the demand information of the at least one target process.
[0075] Specifically, after obtaining the allocable resources of the process in the second operating system without the protection mark added, the demand information of the at least one target process on the first operating system is evaluated in detail, including the current resource usage, the historical resource usage trend, the expected resource demand, and the type and priority of the process, so as to accurately determine the actual resource demand of each target process. Next, the allocable resources are allocated to the at least one target process based on the priority of the process, the urgency of the resource request, and the overall resource status of the second operating system, so as to ensure the effective and fair allocation of resources and meet the running demand of different processes.
[0076] As an example, if there are multiple processes in the second operating system without the protection mark added, the allocation of resources can be adjusted according to the priority, resource occupation of these processes, and the demand of the target process on the first operating system. For those processes with less resource occupation and lower priority, the resource allocation thereof can be appropriately reduced, and the released resources are used as allocable resources for the target process on the first operating system. Meanwhile, for the processes with more resource occupation but not critical tasks, part of the resources thereof can also be designated as allocable resources without affecting the normal operation, so as to further improve the utilization efficiency of resources. Through such a dynamic resource allocation strategy, the resource demand of the target process on the first operating system can be maximized while ensuring the normal operation of each process, and the stability and performance of the entire system are improved.
[0077] In a possible implementation, the process identifier of the at least one target process can also be determined based on the demand information of the at least one target process on the first operating system; and the protection mark is added to the at least one target process according to the process identifier, so that the resources of the target process with the protection mark added are not preempted by other processes.
[0078] Specifically, when adding the protection mark to the target process, various ways can be adopted. For example, a specific flag bit can be set for the target process in the internal data structure of the resource management system, and the flag bit is used to indicate that the process is in a protected state. Once the flag bit is set, when other processes attempt to access or preempt the resources of the target process, the resource management system will detect the flag bit and reject the access request of other processes, so as to ensure that the resources of the target process are not preempted.
[0079] In addition, the protection mark can also be associated with the priority of the process and the urgency of the resource request. For target processes with high priority or urgent resource requests, a higher level of protection mark can be set to ensure that these processes have higher priority in resource allocation. Conversely, for processes with low priority or non-urgent resource requests, a lower level of protection mark can be set, or no protection mark can be set at all, so that when resources are scarce, the resources of these processes can be preempted by other more needed processes, effectively managing and controlling the use of resources, ensuring that critical processes can run stably, while improving the resource utilization efficiency and performance of the entire system.
[0080] As an example, assume that there are processes H and I running on the first operating system, where process H is a high-priority process that is performing a critical task, and process I is a low-priority process that is performing a non-critical task. To ensure that process H can complete its task smoothly, a protection mark can be added to it so that its resources are not preempted by other processes. When the load of the second operating system is below the load threshold and there are allocable resources, these resources can be allocated to process H first to meet its resource needs. Even if process I requests resources at this time, its resource request will be postponed or denied because of its low priority and lack of protection mark, ensuring that process H can obtain the required resources. Through such a resource protection strategy, critical task processes can have higher priority in resource allocation, improving the stability and performance of the entire system. At the same time, for low-priority processes without protection marks, their resource requests will be dynamically adjusted without affecting the overall performance of the system and the running of critical task processes, achieving reasonable and efficient use of resources.
[0081] As another example, process J running on the first operating system is responsible for real-time data processing, although its priority is not the highest, but due to its high real-time requirement, once the resources are insufficient, it may cause data processing delay, affecting the execution of subsequent tasks. Therefore, a temporary protection mark can be added to process J to ensure that it can get the necessary support in resource allocation. When the second operating system releases allocable resources, even if there are other processes with slightly higher priority requesting resources, process J's resource needs can be prioritized to ensure the smooth completion of its real-time data processing task. In this way, not only the resource needs of critical task processes are met, but also the real-time requirement of processes with high real-time requirement is ensured to be supported in time, further improving the overall performance and stability of the system.
[0082] A resource management apparatus is also provided in the embodiments, which is configured to implement the embodiments and preferred embodiments described above. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
[0083] The embodiments provide a resource management apparatus, as shown in Figure 3 comprises:
[0084] The information obtaining module 301 is configured to obtain demand information of at least one target process on the first operating system, wherein the target process is a process requiring resources of the second operating system, and the demand information indicates resources of the second operating system required by the target process.
[0085] The resource management module 302 is configured to allocate allocable resources to the at least one target process according to the demand information of the at least one target process, wherein the allocable resources are resources that can be allocated to processes on the first operating system and are from the second operating system.
[0086] In a possible implementation, the resource management module 302 is further configured to determine the allocable resources allocated to the at least one target process according to the demand information of the at least one target process and a priority of the at least one target process.
[0087] In a possible implementation, the resource management module 302 is further configured to determine the priority of the process on the first operating system according to a use of the process on the first operating system and whether the process is in the foreground.
[0088] In a possible implementation, the resource management module 302 is further configured to determine the allocable resources allocated to the at least one target process according to the demand information of the at least one target process, a priority of the at least one target process, and a load of the second operating system.
[0089] In a possible implementation, the resource management module 302 is further configured to, when the load of the second operating system is less than a load threshold, suspend execution of a low-priority process on the second operating system whose priority is less than a priority threshold, and determine resources of the second operating system allocated to the low-priority process as the allocable resources.
[0090] In a possible implementation, the resource management module 302 is further configured to, when the load of the second operating system is less than a load threshold, determine a part of resources of the second operating system allocated to a low-priority process as the allocable resources.
[0091] The resource management apparatus in the embodiment is presented in the form of functional units, where the units refer to ASIC circuits, processors and memories executing one or more software or fixed programs, and / or other devices that can provide the above functions.
[0092] Further function descriptions of the above modules and units are the same as the corresponding embodiments described above, and will not be repeated here.
[0093] The embodiment of the present application also provides an electronic device having the above Figure 4 resource management apparatus.
[0094] Please refer to Figure 4 , Figure 4 is a structural schematic diagram of an electronic device provided by an optional embodiment of the present application, which is installed on a vehicle. The electronic device includes one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other in communication by using different buses, and can be installed on a common mainboard or in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in the memory or on the memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memories as needed. Similarly, multiple electronic devices can be connected, each providing part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).
[0095] The processor 10 can be a central processor, a network processor, or a combination thereof. The processor 10 can further include a hardware chip. The hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device can be a complex programmable logic device, a field programmable logic gate array, a generic array logic, or any combination thereof.
[0096] The memory 20 stores instructions executable by the at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiments.
[0097] The memory 20 can include a program storage area and a data storage area. The program storage area can store an operating system and applications required for at least one function. The data storage area can store data created according to usage of the electronic device, etc. In addition, the memory 20 can include a volatile memory such as a random access memory, and can further include a non-volatile memory such as at least one of a magnetic disk storage device, a flash memory device, or other non-volatile solid state storage device. In some alternative embodiments, the memory 20 can optionally include a memory remotely located with respect to the processor 10, which can be connected to the electronic device through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0098] The memory 20 can include a volatile memory such as a random access memory, and can further include a non-volatile memory such as a flash memory, a hard disk, or a solid state disk. The memory 20 can also include a combination of the above-mentioned types of memory.
[0099] The electronic device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30, and the output device 40 can be connected through a bus or other means.
[0100] The input device 30 can receive input digital or character information, and generate key signal input with respect to user settings and function controls of the electronic device. Examples of the input device 30 include, but are not limited to, a touch screen, a keypad, a mouse, a trackpad, a touchpad, a jog wheel, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), a haptic feedback device (e.g., a vibration motor), etc. Examples of the display device include, but are not limited to, a liquid crystal display, a light emitting diode, a display, and a plasma display. In some alternative embodiments, the display device can be a touch screen.
[0101] The embodiments of the present application further provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or stored in a remote storage medium or a non-transitory machine readable storage medium and downloaded to a local storage medium through network, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid state disk, etc. Further, the storage medium can also include a combination of the above-mentioned memories. It can be understood that the computer, the processor, the microprocessor controller, or the programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.
[0102] Part of the embodiments of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, the method and / or technical solutions according to the present application can be called or provided. Those skilled in the art should understand that the form of computer program instructions in a computer readable medium includes but is not limited to source files, executable files, installation package files, etc. Correspondingly, the way of executing computer program instructions by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.
[0103] Although the embodiments of the present application are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.
Claims
1. A resource management method characterized by, The method comprises: obtaining demand information of at least one target process on a first operating system, wherein the target process is a process requiring resources of a second operating system, and the demand information indicates resources of the second operating system required by the target process; allocating allocatable resources to at least one target process according to demand information of the at least one target process, wherein the allocatable resources are resources that can be allocated to processes on the first operating system and come from the second operating system.
2. The method of claim 1, wherein, The allocating allocatable resources to at least one target process according to demand information of the at least one target process comprises: determining the allocatable resources to be allocated to at least one target process according to demand information of the at least one target process and priority of the at least one target process.
3. The method of claim 2, wherein, The method further comprises: determining priority of a process on the first operating system according to use of the process and whether the process is in the foreground.
4. The method of claim 2, wherein, The determining the allocatable resources to be allocated to at least one target process according to demand information of the at least one target process and priority of the at least one target process comprises: determining the allocatable resources to be allocated to at least one target process according to demand information of the at least one target process, priority of the at least one target process, and load of the second operating system.
5. The method of claim 4, wherein, The method further comprises: suspending execution of a low-priority process on the second operating system when load of the second operating system is less than a load threshold and priority of the low-priority process is less than a priority threshold; determining resources of the second operating system allocated to the low-priority process as the allocatable resources.
6. The method of claim 4, wherein, The determining the allocatable resources of the second operating system comprises: determining a part of resources of the second operating system allocated to a low-priority process as the allocatable resources when load of the second operating system is less than a load threshold.
7. A resource management apparatus characterized by comprising: The apparatus comprises: an information obtaining module configured to obtain demand information of at least one target process on a first operating system, wherein the target process is a process requiring resources of a second operating system, and the demand information indicates resources of the second operating system required by the target process; a resource management module configured to allocate allocatable resources to at least one target process according to demand information of the at least one target process, wherein the allocatable resources are resources that can be allocated to processes on the first operating system and come from the second operating system.
8. An electronic device, comprising: comprise: a memory and a processor in communication connection with each other, and the memory stores computer instructions, and the processor executes the computer instructions to perform the method in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing a computer to perform the method in any one of claims 1 to 6.
10. A computer program product, characterised in that, comprise computer instructions for causing a computer to perform the method in any one of claims 1 to 6.