A method, device, equipment and storage medium for dynamically configuring resources

By detecting the terminal access in the vehicle smart cockpit, monitoring and predicting load data, and dynamically configuring resources, the problem of insufficient resources or large remaining amount caused by static configuration strategies is solved, and resource utilization efficiency and user experience are improved.

CN114995946BActive Publication Date: 2025-03-18Z-ONE TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210369168.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-08
Publication Date
2025-03-18
Estimated Expiration
2042-04-08

AI Technical Summary

Technical Problem

When sharing resources of smart terminals such as mobile phones, existing vehicle-mounted smart cockpits adopt static configuration strategies, resulting in insufficient resources or large remaining amounts, affecting the user experience.

Method used

By detecting that the virtual machine is started when the terminal is accessed, the load data of the virtual machine is monitored, the load data of the next cycle is predicted, and the resources are dynamically configured based on the prediction results.

Benefits of technology

Improve resource utilization efficiency, avoid resource waste, and optimize the user experience of the car.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114995946B_ABST
    Figure CN114995946B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and storage medium for dynamically configuring resources, the method comprising: when detecting that a first terminal is connected to a second terminal, starting a virtual machine created for the second terminal in the first terminal; monitoring the first load data of the first operating system of the virtual machine; wherein the first load data includes the actual load data of the first operating system in at least two cycles; based on the first load data, predicting the first predicted load data of the first operating system in the next cycle; and allocating resources to the first operating system based on the first predicted load data. In this way, by predicting the load data of the first operating system based on the actual load data of multiple cycles by the first terminal, the accuracy of the prediction result can be improved, and by allocating resources based on the first predicted load data, dynamic resource configuration of the first operating system can be achieved, and the efficiency of resource use can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a method, device, equipment and storage medium for dynamically configuring resources. Background Art

[0002] With the development of intelligent automobile technology, cockpits have also made great progress towards intelligence. The existing intelligent cockpit integrates intelligent car machines, intelligent antennas, LCD digital instruments, car networking, Ethernet and other intelligent network terminals and ecosystems to provide car owners with a smarter and safer car life. When the existing in-vehicle intelligent cockpit is connected to terminals such as mobile phones, the virtual operating system of the car machine can share the memory resources, central processing unit (CPU) resources and network connection resources of the mobile phone with the operating system of terminals such as mobile phones. However, most of the current resource management solutions for smart terminals such as mobile phones adopt static configuration strategies. When the car machine shares the memory, CPU and other resources of terminals such as mobile phones, the terminal establishes a corresponding virtual machine for the car machine and allocates fixed memory or CPU resources to the operating system of the car machine virtual machine. It is easy to have insufficient resources or a large amount of remaining resources, which affects the user experience of the car machine. Summary of the invention

[0003] In order to solve the above technical problems, the embodiments of the present application hope to provide a method, apparatus, device and storage medium for dynamically configuring resources.

[0004] The technical solution of this application is implemented as follows:

[0005] In a first aspect, a method for dynamically configuring resources is provided, which is applied to a first terminal, and the method includes:

[0006] When detecting that the first terminal is connected to a second terminal, starting a virtual machine created for the second terminal in the first terminal;

[0007] Monitoring first load data of a first operating system of the virtual machine; wherein the first load data includes actual load data of the first operating system in at least two cycles, and the actual load data is used to characterize the amount of resources used by the first operating system;

[0008] Based on the first load data, predicting first predicted load data of the first operating system in a next cycle;

[0009] Based on the first predicted load data, resources are allocated to the first operating system.

[0010] In a second aspect, a device for dynamically configuring resources is provided, the device comprising:

[0011] a processing module, configured to start a virtual machine created in the first terminal for the second terminal when detecting that the first terminal is connected to the second terminal;

[0012] A monitoring module, configured to monitor first load data of a first operating system of the virtual machine; wherein the first load data includes actual load data of the first operating system in at least two cycles, and the actual load data is used to characterize the amount of resources used by the first operating system;

[0013] The processing module is further used to predict first predicted load data of the first operating system in a next cycle based on the first load data;

[0014] The processing module is further configured to allocate resources to the first operating system based on the first predicted load data.

[0015] According to a third aspect, an electronic device is provided, comprising: a processor and a memory configured to store a computer program that can be run on the processor, wherein the processor is configured to execute the steps of the aforementioned method when running the computer program.

[0016] In a fourth aspect, a computer storage medium is provided, on which a computer program is stored, wherein the computer program implements the steps of the aforementioned method when executed by a processor.

[0017] The present application discloses a method, apparatus, device and storage medium for dynamically configuring resources. When a second terminal uses resources of a first terminal, the first terminal can predict the load data of a first operating system based on actual load data of multiple cycles, thereby improving the accuracy of the prediction result. Resource allocation is performed based on the first predicted load data, thereby realizing dynamic configuration of resources of the first operating system and improving resource utilization efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A first flow chart of a method for dynamically configuring resources in an embodiment of the present application;

[0019] Figure 2 A second flow chart of the method for dynamically configuring resources in an embodiment of the present application;

[0020] Figure 3 A third flow chart of the method for dynamically configuring resources in an embodiment of the present application;

[0021] Figure 4 A schematic diagram of CPU usage in an embodiment of the present application;

[0022] Figure 5 A schematic diagram of the structure of a device for dynamically configuring resources in an embodiment of the present application;

[0023] Figure 6 It is a schematic diagram of the composition structure of the electronic device in the embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.

[0025] An embodiment of the present application provides a method for dynamically configuring resources, which is applied to a first terminal. Figure 1 FIG. 1 is a schematic diagram of a first process flow of a method for dynamically configuring resources in an embodiment of the present application. Figure 1 As shown, the method for dynamically configuring resources may specifically include:

[0026] Step 101: when detecting that a first terminal is connected to a second terminal, starting a virtual machine created for the second terminal in the first terminal;

[0027] Here, the first terminal and the second terminal may be smart terminals such as mobile phones, computers, and car computers. Here, when it is detected that the first terminal is connected to the second terminal, the virtual machine created for the second terminal in the first terminal is started, so that the second terminal can use the memory, CPU and other resources of the first terminal.

[0028] Step 102: monitoring first load data of the first operating system of the virtual machine; wherein the first load data includes actual load data of the first operating system in at least two cycles, and the actual load data is used to characterize the amount of resources used by the first operating system;

[0029] Here, the first operating system is a virtual operating system of a virtual machine. The first load data is actual load data in at least two cycles. Exemplarily, in practical applications, the first load data includes: actual load data in preset M cycles or preset time periods. Here, M is a positive integer greater than or equal to 2.

[0030] Here, the actual load data is used to characterize the amount of resources used by the first operating system, that is, resource usage. Exemplarily, the actual load data includes at least one of the following: memory data and CPU data.

[0031] Step 103: predicting first predicted load data of the first operating system in a next cycle based on the first load data;

[0032] Here, predicting the first predicted load data of the first operating system in the next cycle based on the first load data is to predict the first predicted load data of the first operating system in the next cycle based on the actual load data of at least two cycles. The actual load data of at least two cycles here can be the actual load data within a preset cycle closest to the current system time.

[0033] Exemplarily, in practical applications, the load data of the next cycle can be predicted according to the time series prediction method. Exemplarily, in some embodiments, predicting the first predicted load data of the first operating system in the next cycle based on the first load data includes: generating time series data corresponding to the first load data based on the actual load data of the at least two cycles; performing time series prediction on the time series data to obtain the first predicted load data of the first operating system in the next cycle.

[0034] Here, the time series prediction method can analyze the development trend of load data over time according to the time series corresponding to the actual load data of multiple periods, and predict the future value of the load data. Exemplarily, in practical applications, when performing time series prediction, a prediction model constructed by the exponential smoothing method can be used for prediction. By performing time series prediction based on the actual load data including multiple periods, the accuracy of the prediction results can be improved.

[0035] Exemplarily, in actual applications, predicting the first predicted load data of the first operating system in the next cycle based on the first load data includes: when detecting that a prediction condition is met, predicting the first predicted load data of the first operating system in the next cycle based on the first load data. Exemplarily, in actual applications, the prediction conditions include: the current time reaches the prediction time point, or the current remaining resource amount is less than a preset threshold.

[0036] Exemplarily, in some embodiments, the method further includes: determining the remaining resource amount of the first operating system based on the first load data; predicting the first predicted load data of the first operating system in the next cycle based on the first load data, including: if the remaining resource amount is less than a preset threshold, predicting the first predicted load data of the first operating system in the next cycle based on the first load data.

[0037] By making a prediction when the current remaining resource amount is less than the preset threshold, the timing of predicting load data is made more accurate, and the timing of resource adjustment based on the prediction results is made more accurate, thereby improving the effect of dynamic resource configuration. It is also beneficial to reduce the number of dynamic resource adjustments without affecting the current system operation status.

[0038] Step 104: Allocate resources to the first operating system based on the first predicted load data.

[0039] Here, the first predicted load data represents the predicted resource usage of the first operating system in the next cycle. Exemplarily, in practical applications, allocating resources to the first operating system includes: allocating memory resources or CPU resources to the first operating system.

[0040] Exemplarily, in some embodiments, resources are allocated to the first operating system based on the first predicted load data, including: determining the amount of resources required by the first operating system in the next cycle based on the first predicted load data; obtaining the amount of resources occupied by the first operating system; and allocating resources to the first operating system based on the occupied amount of resources and the required amount of resources.

[0041] Exemplarily, in actual applications, the amount of resources may be vCPU computing power, memory amount, etc., and resource allocation for the first operating system may be achieved by dividing memory blocks for the first operating system, or adjusting the vCPU computing power allocated to the first operating system, etc.

[0042] Exemplarily, in some embodiments, the resource allocation for the first operating system based on the occupied resource amount and the required resource amount includes: if the occupied resource amount is less than or equal to the required resource amount, increasing the occupied resource amount of the first operating system; if the occupied resource amount is greater than the required resource amount, reducing the occupied resource amount of the first operating system.

[0043] Exemplarily, in some embodiments, the method further includes: obtaining startup load data of at least one historical startup of the first operating system; determining the startup resource requirement of the first operating system based on the startup load data of at least one historical startup; and configuring resources for the first operating system based on the startup resource requirement when the virtual machine starts.

[0044] Here, the startup load data is the actual load data of the first operating system when the virtual machine is started multiple times before, which is used to characterize the amount of resources used by the first operating system when the virtual machine is started. In practical applications, it can be obtained by recording the actual load data of the first operating system each time the virtual machine is started.

[0045] The startup load data can reflect the amount of resources required during the startup of the first operating system. The initial amount of resources of the first operating system can be set to near this value when it is started next time, which is beneficial to reduce the number of times resources are dynamically adjusted later.

[0046] By allocating resources to the first operating system according to the predicted load data, resource utilization efficiency can be improved.

[0047] Exemplarily, in some embodiments, the method further includes: monitoring second load data of a second operating system of the first terminal; wherein the second load data includes actual load data of the second operating system in at least two cycles; based on the second load data, predicting second predicted load data of the second operating system in the next cycle; and allocating resources to the second operating system based on the second predicted load data.

[0048] Here, by dynamically allocating resources for the second operating system of the first terminal, dynamic adjustment of resources for the operating systems of the first terminal and the second terminal is achieved simultaneously.

[0049] Exemplarily, in some embodiments, the method further includes: obtaining priority levels of the first operating system and the second operating system; determining a priority operating system based on the priority levels; and giving priority to satisfying the resource demand of the priority operating system when the total amount of resource allocation of the first terminal does not satisfy the total amount of resource demand of the first operating system and the second operating system in the next cycle.

[0050] By setting the priority level, resources can be shared between the first terminal and the second terminal, and if the total amount of resources cannot simultaneously meet the total amount of resources required by the first operating system and the second operating system in the next cycle, the amount of resources required by the priority operating system will be met first to ensure the normal operation of the priority operating system.

[0051] Here, the execution subject of step 101 to step 104 may be a processor of a device for dynamically configuring resources.

[0052] According to the technical solution of the embodiment of the present application, when the second terminal uses the resources of the first terminal, the first terminal predicts the load data of the first operating system based on actual load data of multiple cycles, thereby improving the accuracy of the prediction result, and allocating resources based on the first predicted load data, thereby realizing dynamic configuration of resources of the first operating system and improving the efficiency of resource utilization.

[0053] In order to better reflect the purpose of this application, further examples are given based on the embodiments of this application. Figure 2 This is a second flow chart of the method for dynamically configuring resources in an embodiment of the present application.

[0054] like Figure 2 As shown, the method for dynamically configuring resources includes:

[0055] Step 201: when detecting that a first terminal is connected to a second terminal, starting a virtual machine created for the second terminal in the first terminal;

[0056] Here, the first terminal and the second terminal may be smart terminals such as mobile phones, computers, and car computers. Here, when it is detected that the first terminal is connected to the second terminal, the virtual machine created for the second terminal in the first terminal is started, so that the second terminal can use the memory, CPU and other resources of the first terminal.

[0057] Step 202: monitoring first load data of the first operating system of the virtual machine; wherein the first load data includes actual load data of the first operating system in at least two cycles, and the actual load data is used to characterize the amount of resources used by the first operating system;

[0058] Here, the actual load data is used to characterize the amount of resources used by the first operating system, that is, resource usage. Exemplarily, the actual load data includes at least one of the following: memory data and CPU data.

[0059] Step 203: predicting first predicted load data of the first operating system in the next cycle based on the first load data;

[0060] Exemplarily, in actual applications, predicting the first predicted load data of the first operating system in the next cycle based on the first load data includes: when detecting that a prediction condition is met, predicting the first predicted load data of the first operating system in the next cycle based on the first load data. Exemplarily, in actual applications, the prediction conditions include: the current time reaches the prediction time point, or the current remaining resource amount is less than a preset threshold.

[0061] Exemplarily, in some embodiments, the method further includes: determining the remaining resource amount of the first operating system based on the first load data; predicting the first predicted load data of the first operating system in the next cycle based on the first load data, including: if the remaining resource amount is less than a preset threshold, predicting the first predicted load data of the first operating system in the next cycle based on the first load data.

[0062] By making a prediction when the current remaining resource amount is less than the preset threshold, the timing of predicting load data is made more accurate, and the timing of resource adjustment based on the prediction results is made more accurate, thereby improving the effect of dynamic resource configuration. It is also beneficial to reduce the number of dynamic resource adjustments without affecting the current system operation status.

[0063] Exemplarily, when the load data includes CPU data, based on the monitored load data, predicting the predicted load data of the first operating system and the second operating system in the next cycle includes: generating time series data corresponding to the CPU data, i.e., time series CPU data, according to the monitored CPU data; decomposing the time series CPU data into three components: average level, trend, and periodicity; using exponential smoothing method to allow the parameters of the prediction model to continuously adapt to the time series CPU data of the first operating system, predicting the CPU load conditions of the two operating systems in the next cycle, and obtaining the predicted CPU data of the first operating system and the second operating system in the next cycle.

[0064] Exemplarily, when the load data includes: memory data, based on the monitored load data, predicting the predicted load data of the first operating system and the second operating system in the next cycle includes: when the remaining memory of the operating system is less than a preset threshold, predicting the memory data to obtain the predicted load data. Here, the method for predicting the memory data can adopt the same method as the above-mentioned method for obtaining the predicted CPU data.

[0065] Step 204: Determine the resource requirement of the first operating system in the next cycle based on the first predicted load data;

[0066] Here, the first predicted load data represents the predicted resource usage of the first operating system in the next cycle. Here, the required resource quantity includes at least one of the following: memory demand quantity and CPU computing power demand quantity.

[0067] Exemplarily, the load data includes: when the CPU data, the required resource amount includes the required vCPU computing power value. Exemplarily, in some embodiments, based on the predicted CPU data, determining the vCPU computing power value required by the first operation in the next cycle includes: obtaining the working mode of the first operating system; based on the working mode and the predicted CPU data, determining the vCPU computing power value required by the first operation in the next cycle.

[0068] Here, the working modes include: navigation mode, music mode, call mode, etc. In practical applications, different allocation strategies can be set for each working mode; for example, the allocation strategy for the navigation mode is: based on 1.5 times the predicted CPU data, the required vCPU computing power value of the first operating system is determined; the allocation strategy for the music mode is: based on 1.2 times the predicted CPU data, the required vCPU computing power value of the first operating system is determined.

[0069] Exemplarily, when the load data includes memory data, the required resource amount includes the required memory amount. At this time, based on the predicted load data, determining the required resource amount of the first operating system in the next cycle includes: determining the memory amount required by the first operation in the next cycle based on the predicted memory data of the first operating system.

[0070] Step 205: Obtaining the amount of resources occupied by the first operating system;

[0071] Here, the occupied resource amount is used to represent the current occupied resource amount of the first operating system.

[0072] Step 206: Allocate resources to the first operating system based on the occupied resource amount and the required resource amount.

[0073] Exemplarily, in actual applications, resource allocation for the first operating system can be achieved by dividing memory blocks for the first operating system, or adjusting the vCPU computing power value allocated to the first operating system, etc. Exemplarily, in actual applications, dividing memory blocks for the first operating system, or adjusting the vCPU computing power value allocated to the first operating system can be achieved by a virtual machine monitor (Hypervisor) of the first terminal.

[0074] Exemplarily, in some embodiments, the resource allocation for the first operating system based on the occupied resource amount and the required resource amount includes: if the occupied resource amount is less than or equal to the required resource amount, increasing the occupied resource amount of the first operating system; if the occupied resource amount is greater than the required resource amount, reducing the occupied resource amount of the first operating system.

[0075] Exemplarily, when the resource is a memory resource, if the occupied resource amount is less than or equal to the required resource amount, the memory resource amount of the first operating system is increased to meet the required resource amount of the first operating system in the next cycle. The memory resource amount of the first operating system can be increased by allocating an appropriate amount of memory blocks from an idle random access memory (RAM) to the first operating system.

[0076] Exemplarily, in some embodiments, when the resource allocation is the allocation of memory resources, the method also includes: detecting the free storage space of the first terminal; if the free RAM is less than a preset free threshold, controlling the first operating system to perform memory garbage collection to release memory blocks; and placing the released memory blocks into the free storage space.

[0077] Exemplarily, when the resource is a CPU resource, if the occupied resource amount is less than or equal to the required resource amount, the CPU resource amount of the first operating system is increased to meet the required resource amount of the first operating system in the next cycle. In practical applications, increasing the CPU resource amount of the first operating system can be achieved by increasing the vCPU computing power value allocated to the first operating system.

[0078] Exemplarily, in some embodiments, the method further includes: monitoring second load data of a second operating system of the first terminal; wherein the second load data includes actual load data of the second operating system in at least two cycles; based on the second load data, predicting second predicted load data of the second operating system in the next cycle; and allocating resources to the second operating system based on the second predicted load data.

[0079] Here, by dynamically allocating resources for the second operating system of the first terminal, dynamic adjustment of resources for the operating systems of the first terminal and the second terminal is achieved simultaneously.

[0080] Exemplarily, in some embodiments, the method further includes: obtaining priority levels of the first operating system and the second operating system; determining a priority operating system based on the priority levels; and giving priority to satisfying the resource demand of the priority operating system when the total amount of resource allocation of the first terminal does not satisfy the total amount of resource demand of the first operating system and the second operating system in the next cycle.

[0081] By setting the priority level, resources can be shared between the first terminal and the second terminal, and if the total amount of resources cannot simultaneously meet the total amount of resources required by the first operating system and the second operating system in the next cycle, the amount of resources required by the priority operating system will be met first to ensure the normal operation of the priority operating system.

[0082] Here, the execution subject of step 201 to step 206 may be a processor of a dynamically configured resource device.

[0083] The technical solution of the embodiment of the present application can improve the accuracy of the prediction result by predicting the load data of the first operating system based on the actual load data of multiple cycles when the second terminal uses the resources of the first terminal. By determining the required resource amount of the first operating system in the next cycle based on the first predicted load data, and allocating resources to the first operating system based on the occupied resource amount and the required resource amount, it can realize dynamic configuration of resources of the first operating system and improve the efficiency of resource utilization.

[0084] In order to better reflect the purpose of this application, further examples are given based on the embodiments of this application. This application proposes a method for dynamically configuring resources, which is applied to a first terminal. For example, Figure 3 This is a third flow chart of the method for dynamically configuring resources in an embodiment of the present application.

[0085] like Figure 3 As shown, the method for dynamically configuring resources may specifically include:

[0086] Step 301: when detecting that a first terminal is connected to a second terminal, starting a virtual machine created for the second terminal in the first terminal;

[0087] Here, the first terminal and the second terminal may be smart terminals such as mobile phones, computers, and car computers. Here, when it is detected that the first terminal is connected to the second terminal, the virtual machine created for the second terminal in the first terminal is started, so that the second terminal can use the memory, CPU and other resources of the first terminal.

[0088] Step 302: monitoring first load data of the first operating system of the virtual machine and second load data of the second operating system of the first terminal;

[0089] Step 303: predicting first predicted load data of the first operating system in the next cycle and second predicted load data of the second operating system in the next cycle based on the monitored load data;

[0090] Exemplarily, in actual applications, predicting the first predicted load data of the first operating system in the next cycle based on the first load data includes: when detecting that a prediction condition is met, predicting the first predicted load data of the first operating system in the next cycle based on the first load data. Exemplarily, in actual applications, the prediction conditions include: the current time reaches the prediction time point, or the current remaining resource amount is less than a preset threshold.

[0091] Exemplarily, in some embodiments, the method further includes: determining the remaining resource amount of the first operating system based on the first load data; predicting the first predicted load data of the first operating system in the next cycle based on the first load data, including: if the remaining resource amount is less than a preset threshold, predicting the first predicted load data of the first operating system in the next cycle based on the first load data.

[0092] By making a prediction when the current remaining resource amount is less than the preset threshold, the timing of predicting load data is made more accurate, and the timing of resource adjustment based on the prediction results is made more accurate, thereby improving the effect of dynamic resource configuration. It is also beneficial to reduce the number of dynamic resource adjustments without affecting the current system operation status.

[0093] It should be noted that the method for predicting the second predicted load data of the second operating system in the next cycle is the same as the method for predicting the first predicted load data of the first operating system in the next cycle.

[0094] Step 304: Determine the resource requirements of the first operating system and the second operating system in the next cycle based on the predicted load data;

[0095] Specifically, based on the predicted load data, determine the required resource amounts of the first operating system and the second operating system in the next cycle, including: based on the predicted load data of the first operating system, determine the required resource amount required for the first operation in the next cycle; based on the predicted load data of the second operating system, determine the required resource amount required for the second operation in the next cycle.

[0096] Exemplarily, the load data includes: when the CPU data, the required resource amount includes the required vCPU computing power value. Exemplarily, in some embodiments, based on the predicted CPU data, determining the vCPU computing power value required by the first operation in the next cycle includes: obtaining the working mode of the first operating system; based on the working mode and the predicted CPU data, determining the vCPU computing power value required by the first operation in the next cycle.

[0097] When the load data includes memory data, the required resource amount includes the required memory amount. At this time, based on the predicted load data, determining the required resource amount of the first operating system in the next cycle includes: determining the memory amount required by the first operation in the next cycle based on the predicted memory data of the first operating system.

[0098] It should be noted that, based on the second predicted load data of the second operating system, the required resource amount of the second operation in the next cycle can be determined by using the above method consistent with the first operating system.

[0099] Step 305: Obtain the resource usage of the first operating system and the second operating system;

[0100] Exemplarily, the load data includes: when the load data is CPU data, the resource occupancy includes the vCPU computing power value occupancy, which is the vCPU computing power value currently occupied by the operating system; when the load data includes memory data, the resource occupancy includes the memory occupancy, which is the memory currently occupied by the operating system.

[0101] Step 306: Allocate resources to the first operating system and the second operating system based on the required resource amount.

[0102] Exemplarily, allocating resources to the first operating system and the second operating system based on the required resource amount includes: determining the total required resource amounts of the first operating system and the second operating system in the next cycle based on the required resource amount; if the total is less than the total resource allocation amount of the first terminal, allocating resources to each operating system according to the required resource amount of each system.

[0103] Exemplarily, in some embodiments, the method also includes: if the total number is less than or equal to the total resource allocation of the first terminal, obtaining the priority levels of the first operating system and the second operating system; determining a priority operating system based on the priority levels; and when allocating resources to each operating system, giving priority to satisfying the required resource amount of the priority operating system.

[0104] Here, the execution subject of step 301 to step 306 may be a processor of a device for dynamically configuring resources.

[0105] The technical solution of the embodiment of the present application can improve the accuracy of the prediction result by predicting the load data of the first operating system and the second operating system based on the actual load data including multiple cycles when the second terminal uses the resources of the first terminal; and allocate resources of the second operating system and the second operating system based on the predicted load result, so as to realize dynamic configuration of resources of the first operating system and the second operating system, improve the utilization efficiency of resources, and avoid waste of core resources.

[0106] In order to better reflect the purpose of this application, based on the above embodiments of this application, further examples are given with the first terminal being a mobile phone and the second terminal being a car computer as an example. This application proposes a method for dynamically configuring resources, which is applied to mobile phones.

[0107] When the mobile phone is connected to the vehicle environment, the vehicle operating system can share the mobile phone's resources. The mobile phone's virtual machine monitor (Hypervisor) provides a virtual environment for the vehicle, and monitors the vehicle virtual operating system (equivalent to the first operating system) and the mobile phone operating system (equivalent to the second operating system). According to the system load, it dynamically controls the actual CPU usage of the vehicle operating system, thereby allocating reasonable resources to the vehicle system and the mobile phone system.

[0108] The method specifically includes:

[0109] Step 401: Monitor whether the mobile phone is connected to the vehicle environment. When connected to the vehicle environment, start or wake up the cockpit virtual machine (equivalent to the virtual machine created for the second terminal in the first terminal in this application), and give part of the mobile phone resources to the virtual machine for use. When leaving the vehicle environment, exit or suspend the cockpit virtual machine, and the resources used by the virtual machine are completely or maximized and returned to the mobile phone system.

[0110] Step 402: When the mobile phone and the cockpit virtual machine are running, CPU resources and memory resources are dynamically adjusted between the mobile phone and the virtual machine.

[0111] In actual applications, step 402 is implemented by the load monitoring module, decision module and resource allocation module of the first terminal; wherein the resource allocation module includes: a CPU resource allocation module and a memory resource allocation module.

[0112] Specifically, the load monitoring module monitors the load data of the vehicle computer Guest OS1 (equivalent to the first operating system) and the mobile phone Guest OS2 (equivalent to the second operating system), and provides the load data to the decision module.

[0113] The decision module determines the CPU resources and memory resources allocated to the vehicle computer Guest OS1 and the mobile phone Guest OS2 according to the load data obtained by the load monitoring module.

[0114] Specifically, determining the CPU resources allocated to the car machine Guest OS1 and the mobile phone Guest OS2 includes: according to the CPU data of the load monitoring module, decomposing the CPU load of the time series into three components: average level, trend, and periodicity; using the exponential smoothing method to make the model parameters continuously adapt to the actual value of the Guest OS CPU load series, so as to predict the CPU load of the two Guest OS in the next cycle, and set the vCPU computing power value allocated to each Guest OS in combination with the working mode. Through the historical CPU usage data, the CPU allocation quota for the next cycle is predicted and set to improve the responsiveness of the application.

[0115] Specifically, determining the memory resources allocated to the vehicle computer Guest OS1 and the mobile phone Guest OS2 includes: recording the size of the Guest OS memory used after each startup; setting the initial memory of the Guest OS to near the recorded value at the next startup, which is conducive to reducing the number of dynamic memory adjustments in the later stage.

[0116] Determining the memory resources allocated to the vehicle computer Guest OS1 and the mobile phone Guest OS2 includes: When the remaining memory of Guest OS1 or Guest OS2 is less than the threshold, predict the memory data of Guest OS1 or Guest OS2 in the next cycle; determine the memory value allocated to the Guest OS based on the prediction result; divide the appropriate block blocks to the corresponding Guest OS to achieve hot plugging of the Guest OS memory to meet the needs of the Guest OS. When the free RAM is insufficient, notify all Guest OS to perform memory GC, release the memory blocks, put them into the free RAM, achieve hot unplugging of the Guest OS memory, and protect the hot unplugged memory from being accessed to prevent malicious attacks.

[0117] The initial startup memory value of the Guest OS is set based on historical memory usage data. The memory usage in the next cycle is predicted based on the memory usage trend during operation to improve memory usage efficiency.

[0118] The CPU resource allocation module is used to dynamically set the CPU usage policy of each Guest OS according to the decision of the decision module. Here, the Hypervisor in the CPU resource allocation module can use the priority-driven virtual CPU (vCPU) concept to dynamically set the CPU policy. Exemplary, Figure 4 Schematic diagram of CPU usage in the embodiment of this application. Figure 4 As shown in the figure, GuestOS 1 and Guest OS 2 can share the computing power of CPU2. When using CPU2 at the same time, the priority setting can ensure that a certain Guest OS is used first. The Hypervisor can dynamically adjust the computing power value of the vCPU. When only one OS is configured to use the physical CPU, it means that the CPU is exclusively used.

[0119] When a vCPU is added to the Guest OS, the CPU resource allocation module adds the vCPU to the CPU queue and notifies the Guest OS kernel to schedule the vCPU. If there is only one vCPU in the CPU queue, it means that the Guest OS exclusively occupies the physical CPU. When a vCPU is reduced in the Guest OS, the CPU resource allocation module notifies the Guest OS kernel to eliminate the vCPU queue. After completion, the vCPU is removed from the physical CPU queue. When a Guest OS is set to use the CPU first, the CPU scheduling algorithm (time-sharing scheduling, CPU affinity, etc.) in the Hypervisor is set to meet the CPU computing power value of the Guest OS. Among them, each Guest OS needs to ensure the existence of at least one vCPU.

[0120] By dynamically setting the strategies of each Guest OSCPU, the physical CPU can be dynamically switched between the exclusive mode and the shared mode of the vehicle Guest OS1 and the mobile phone Guest OS2 without affecting the operation of the original mobile phone OS system.

[0121] The memory resource allocation module is used to dynamically set the memory usage strategy of each Guest OS according to the decision of the decision module. According to the decision module plan, the memory of each Guest OS is dynamically increased or decreased to realize the dynamic division of memory resources.

[0122] Specifically, the decision module obtains the initial memory, the minimum remaining memory lower limit, and the memory value allocated to each Guest OS; when the remaining memory of the Guest OS is less than the minimum remaining memory lower limit threshold, appropriate blocks are allocated to the corresponding Guest OS to meet the needs of the Guest OS. When the free RAM is insufficient, all Guest OS are notified to perform memory GC, and the memory blocks are released and put into the free RAM to implement hot unplugging of the Guest OS memory. The Hypervisor protects the hot unplugged memory from being accessed to prevent malicious attacks.

[0123] The technical solution of the embodiment of the present application can improve the accuracy of the prediction result by predicting the load data of the vehicle computer and the mobile phone operating system based on the actual load data of multiple cycles when the vehicle computer uses the resources of the mobile phone. By determining the required resource amount of the vehicle computer and the mobile phone operating system in the next cycle based on the first predicted load data, and then realizing dynamic resource allocation for the vehicle computer and the mobile phone operating system, it can realize dynamic configuration of resources of the vehicle computer and the mobile phone operating system, improve resource utilization efficiency, and avoid waste of core resources.

[0124] Figure 5 Schematic diagram of the composition structure of the device for dynamically configuring resources in the embodiment of the present application, showing a device for implementing a method for dynamically configuring resources, the device 50 specifically includes:

[0125] The processing module 501 is configured to start a virtual machine created in the first terminal for the second terminal when detecting that the first terminal is connected to the second terminal;

[0126] A monitoring module 502 is used to monitor first load data of a first operating system of the virtual machine; wherein the first load data includes actual load data of the first operating system in at least two cycles, and the actual load data is used to characterize the amount of resources used by the first operating system;

[0127] The processing module 501 is further configured to predict first predicted load data of the first operating system in a next cycle based on the first load data;

[0128] The processing module 501 is further configured to allocate resources to the first operating system based on the first predicted load data.

[0129] In some embodiments, the processing module 501 is used to determine the amount of resources required by the first operating system in the next cycle based on the first predicted load data; obtain the amount of resources occupied by the first operating system; and allocate resources to the first operating system based on the occupied amount of resources and the required amount of resources.

[0130] In some embodiments, the processing module 501 is further used to increase the amount of resources occupied by the first operating system if the amount of resources occupied is less than or equal to the required amount of resources; if the amount of resources occupied is greater than the required amount of resources, reduce the amount of resources occupied by the first operating system.

[0131] In some embodiments, the processing module 501 is also used to determine the remaining resources of the first operating system based on the first load data; if the remaining resources are less than a preset threshold, based on the first load data, predict the first predicted load data of the first operating system in the next cycle.

[0132] In some embodiments, the processing module 501 is also used to obtain actual load data of the first operating system during at least one historical startup; based on the actual load data during at least one historical startup, determine the startup resource requirement of the first operating system; when the virtual machine is started, configure resources for the first operating system based on the startup resource requirement.

[0133] In some embodiments, the monitoring module 502 is also used to monitor the second load data of the second operating system of the first terminal; wherein the second load data includes the actual load data of the second operating system in at least two cycles; the processing module 501 is also used to predict the second predicted load data of the second operating system in the next cycle based on the second load data; and allocate resources to the second operating system based on the second predicted load data.

[0134] In some embodiments, the processing module 501 is also used to obtain the priority levels of the first operating system and the second operating system; determine the priority operating system based on the priority levels; and when the total amount of resource allocation of the first terminal does not meet the total amount of resource requirements of the first operating system and the second operating system in the next cycle, give priority to meeting the resource requirements of the priority operating system.

[0135] Based on the hardware implementation of each unit in the above-mentioned device for dynamically configuring resources, an embodiment of the present application also provides an electronic device. Figure 6 FIG. 1 is a schematic diagram of the composition structure of the electronic device in the embodiment of the present application. Figure 6 As shown, the device 60 includes: a processor 601 and a memory 602 configured to store a computer program that can be run on the processor;

[0136] The processor 601 is configured to execute the steps of the method in the aforementioned embodiment when running a computer program.

[0137] Of course, in practical applications, Figure 6As shown, the various components in the electronic device are coupled together via a bus system 603. It is understood that the bus system 603 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 603 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 6 Various buses are labeled as bus system 603.

[0138] In practical applications, the processor may be at least one of an application-specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It is understandable that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present application do not specifically limit this.

[0139] The above-mentioned memory can be a volatile memory (volatile memory), such as a random access memory (RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above-mentioned types of memory, and provide instructions and data to the processor.

[0140] In an exemplary embodiment, the embodiment of the present application further provides a computer-readable storage medium, such as a memory including a computer program, and the computer program can be executed by a processor of an electronic device to complete the steps of the aforementioned method.

[0141] It should be understood that the terms used in this application are only for the purpose of describing specific embodiments, and are not intended to limit the application. The singular forms of "a", "" and "the" used in this application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items. The expressions "have", "may have", "include" and "include", or "may include" and "may include" in this application can be used to indicate the presence of corresponding features (e.g., elements such as numerical values, functions, operations or components), but the presence of additional features is not excluded.

[0142] It should be understood that, although the terms first, second, third, etc. may be used in this application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other, and are not necessarily used to describe a specific order or sequence. For example, without departing from the scope of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. The technical solutions recorded in the embodiments of the present application can be arbitrarily combined without conflict. In several embodiments provided in the present application, it should be understood that the disclosed methods, devices and equipment can be implemented in other ways. The embodiments described above are merely schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0143] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0144] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0145] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.

Claims

1. A method for dynamically configuring resources, characterized in that: Applied to a first terminal, the method includes: When detecting that the first terminal is connected to a second terminal, starting a virtual machine created for the second terminal in the first terminal; Monitoring first load data of a first operating system of the virtual machine; wherein the first load data includes actual load data of the first operating system in at least two cycles, and the actual load data is used to characterize the amount of resources used by the first operating system; Based on the first load data, predicting first predicted load data of the first operating system in a next cycle; Allocating memory resources or CPU resources to the first operating system based on the first predicted load data; Based on the first load data, determining the remaining resources of the first operating system; The predicting, based on the first load data, first predicted load data of the first operating system in the next cycle includes: If the remaining resource amount is less than a preset threshold, first predicted load data of the first operating system in a next cycle is predicted based on the first load data.

2. The method according to claim 1, characterized in that The allocating resources to the first operating system based on the first predicted load data includes: Determining the amount of resources required by the first operating system in the next cycle based on the first predicted load data; Obtaining the amount of resources occupied by the first operating system; Based on the occupied resource amount and the required resource amount, resources are allocated to the first operating system.

3. The method according to claim 2, characterized in that The allocating resources to the first operating system based on the occupied resource amount and the required resource amount includes: If the occupied resource amount is less than or equal to the required resource amount, increasing the occupied resource amount of the first operating system; If the occupied resource amount is greater than the required resource amount, the occupied resource amount of the first operating system is reduced.

4. The method according to claim 1, characterized in that: The method further comprises: Acquire actual load data of at least one historical startup of the first operating system; Determining the amount of resources required for starting the first operating system based on the actual load data during the at least one historical startup; When the virtual machine is started, resources are configured for the first operating system based on the startup required resource amount.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Monitoring second load data of a second operating system of the first terminal; wherein the second load data includes actual load data of the second operating system in at least two cycles; Based on the second load data, predicting second predicted load data of the second operating system in a next cycle; Based on the second predicted load data, resources are allocated to the second operating system.

6. The method according to claim 5, characterized in that The method further comprises: Obtaining priority levels of the first operating system and the second operating system; determining a priority operating system based on the priority level; When the total amount of resource allocation of the first terminal does not meet the total amount of resource requirements of the first operating system and the second operating system in the next cycle, the amount of resource requirements of the priority operating system are preferentially met.

7. A device for dynamically configuring resources, the device comprising: A processing module, configured to start a virtual machine created in the first terminal for the second terminal when detecting that the first terminal is connected to the second terminal; A monitoring module, configured to monitor first load data of a first operating system of the virtual machine; wherein the first load data includes actual load data of the first operating system in at least two cycles, and the actual load data is used to characterize the amount of resources used by the first operating system; The processing module is further used to predict first predicted load data of the first operating system in a next cycle based on the first load data; The processing module is further used to allocate memory resources or CPU resources to the first operating system based on the first predicted load data; The processing module is also used to determine the remaining resources of the first operating system based on the first load data; if the remaining resources are less than a preset threshold, predict the first predicted load data of the first operating system in the next cycle based on the first load data.

8. An electronic device, characterized in that: The electronic device comprises: a processor and a memory configured to store a computer program capable of running on the processor, Wherein, the processor is configured to execute the steps of the method according to any one of claims 1 to 6 when running the computer program.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Resource adjustment method and device

    CN106598702A

  • Load management method and system for cloud application system

    CN106933650A

  • Virtualization system and resource allocation method thereof

    US20120060168A1