Program management method and device, equipment and medium
By decompressing and loading only the required functional modules in an embedded system, the problem of increased memory footprint is solved, system performance is improved, and startup time is shortened.
Patent Information
- Application Number
- CN202411797191.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-14
AI Technical Summary
The prior art in embedded systems requires loading the entire program, which increases memory footprint and affects system performance.
By obtaining the program execution request of the target program, determining the corresponding target function, and selecting the functional module compression package corresponding to the target function from multiple functional module compression packages, decompressing and loading only the required functional modules to reduce memory usage.
This method reduces memory usage, improves system performance, and shortens the initial startup time of the system through an on-demand loading mechanism.
Smart Images

Figure CN119621188A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a program management method, apparatus, device and medium. Background Art
[0002] With the rapid development of science and technology, embedded systems have been widely used in various fields, such as smart home, industrial automation, medical equipment, etc. Specific programs are running on embedded devices. These programs are the core components of embedded systems and are responsible for executing the main functions and tasks of the devices.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems: In the prior art, when a request is received, the program is run to execute the corresponding function. However, when the embedded system generally runs under limited hardware resources, this method increases the memory usage and affects the system performance. Summary of the invention
[0004] The purpose of this application is to provide a program management method, apparatus, device and medium, which can only decompress and load the target functional module compression package instead of all functional modules of the entire target program, thereby reducing memory usage.
[0005] In a first aspect, a program management method is provided, comprising:
[0006] Obtain a program execution request of a target program;
[0007] Determining, according to the program execution request, a target function corresponding to the program execution request;
[0008] Determine a target function module compression package corresponding to the target function from a plurality of function module compression packages of the target program; wherein the function module compression package corresponding to each function module of the target program is compressed at a compression rate determined according to a priority of the function module;
[0009] Decompress and load the target function module compressed package to execute the target function.
[0010] In a preferred example, the present application may be further configured as follows: before obtaining the program execution request of the target program, the process further includes:
[0011] Obtain the priorities corresponding to the multiple functional modules of the target program;
[0012] Determine the compression rate corresponding to the first functional module according to the priority corresponding to the first functional module; the first functional module is any module among the multiple functional modules; compress the first functional module according to the compression rate corresponding to the first functional module to obtain a first functional module compressed package; store the first functional module compressed package.
[0013] In a preferred example, the present application may be further configured as follows: the obtaining of the priorities corresponding to the multiple functional modules of the target program includes:
[0014] Obtaining historical usage frequencies and / or functional importance values corresponding to each of multiple functional modules of the target program;
[0015] The priorities corresponding to the multiple functional modules are determined according to the historical usage frequencies and / or functional importance values corresponding to the multiple functional modules.
[0016] In a preferred example, the present application may be further configured as follows: the storing of the first function module compressed package includes:
[0017] Determining a storage medium corresponding to the first functional module according to the priority corresponding to the first functional module;
[0018] The first function module compression package is stored in a storage medium corresponding to the first function module.
[0019] In a preferred example, the present application can be further configured as follows:
[0020] Acquire the current allocatable load resources of the system and the load demand resource amount corresponding to the target functional module; the allocatable load resources include: CPU resources and / or memory resources;
[0021] Resources are allocated to the target functional module according to the current allocatable load resources of the system, the load demand resource amount and the priority corresponding to the target functional module, wherein the load demand resource amount is obtained by predicting the historical resource usage corresponding to the target functional module.
[0022] In a preferred example, the present application can be further configured as follows:
[0023] Obtaining an adjustment effect of the adjusted load demand resource amount of the target functional module;
[0024] Determining whether the adjustment effect meets preset requirements;
[0025] If not, readjust the load demand resources; if so, continue monitoring;
[0026] Among them, the adjusted load demand resource amount is obtained by adjusting the load demand resource amount corresponding to the target functional module according to the abnormal data in the historical resource usage, and the abnormal data is the abnormal resource usage data of the abnormal execution of the target functional module according to the error log.
[0027] In a preferred example, the present application can be further configured as follows:
[0028] Obtain system performance indicator information for a preset historical period;
[0029] According to the system performance indicator information of the preset historical period, the resource demand of the target program is predicted to obtain the predicted resource usage in the next period;
[0030] The predicted resource usage for the next time period is reserved.
[0031] In a second aspect, a program management device is provided, comprising:
[0032] An acquisition module, used for acquiring a program execution request of a target program;
[0033] A first determining module, configured to determine a target function corresponding to the program execution request according to the program execution request;
[0034] A second determination module is used to determine a target function module compression package corresponding to the target function from a plurality of function module compression packages of the target program; wherein the function module compression package corresponding to each function module of the target program is compressed at a compression rate determined according to a priority of the function module;
[0035] The execution module is used to decompress and load the target function module compressed package to execute the target function.
[0036] In a third aspect, an electronic device is provided, including:
[0037] one or more processors;
[0038] Memory;
[0039] One or more applications, wherein one or more applications are stored in a memory and configured to be executed by one or more processors, and one or more programs are configured to: perform operations corresponding to the program management method shown in any possible implementation method of the first aspect.
[0040] In a fourth aspect, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded by a processor and executes the steps of the program management method shown in any possible implementation method of the first aspect.
[0041] In a fifth aspect, a computer program product is provided, including a computer program, which, when executed by a processor, implements operations corresponding to the program management method shown in any possible implementation manner in the first aspect.
[0042] In summary, the method provided by this application includes the following beneficial technical effects:
[0043] In this scheme, the compression rate of the function modules is determined in advance according to the priority of the function modules. The compression rate of high-priority function modules is lower to ensure that they can be quickly decompressed and loaded when needed; the compression rate of low-priority function modules is higher to save storage space; so that after obtaining the program execution request of the target program, the corresponding target function can be determined according to the program execution request; from the multiple function module compression packages of the target program, the target function module compression package corresponding to the target function is determined, and only the target function module compression package is decompressed and loaded, which reduces memory usage and improves system performance.
[0044] In addition, the present application also provides a program management device, equipment and medium, all of which have the above-mentioned beneficial technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0046] Figure 1 It is a schematic diagram of an application scenario of a program management method provided by an embodiment of the present application;
[0047] Figure 2 This is a flowchart of a program management method provided by an embodiment of the present application;
[0048] Figure 3 This is a flowchart of an on-demand loading mechanism method provided by an embodiment of the present application;
[0049] Figure 4 It is a flowchart of dynamically adjusting the compression level of different functional modules provided by an embodiment of the present application;
[0050] Figure 5 It is a schematic diagram of a modular storage process provided by an embodiment of the present application;
[0051] Figure 6 It is a schematic diagram of a flow chart of operation feedback provided in an embodiment of the present application;
[0052] Figure 7 This is a schematic diagram of a process for obtaining a dynamic resource allocation strategy provided by an embodiment of the present application;
[0053] Figure 8 This is a flowchart of another program management method provided by an embodiment of the present application;
[0054] Fig. 9 It is a structural diagram of a program management device provided in an embodiment of the present application;
[0055] Fig.10 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] This specific embodiment is merely an explanation of the present application and is not a limitation of the present application. After reading this specification, those skilled in the art may make non-creative modifications to the present embodiment as needed, but as long as they are within the scope of the present application, they are protected by the patent law.
[0057] It should be noted that in the optional embodiments of the present application, the object information and other related data involved, when the embodiments in the present application are applied to specific products or technologies, need to obtain the permission or consent of the object, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. In other words, if the embodiments of the present application involve data related to the object, it needs to be obtained with the authorization and consent of the object, the authorization and consent of the relevant departments, and in compliance with the relevant laws, regulations and standards of the country and region. If personal information is involved in the embodiments, the acquisition of all personal information needs to obtain the consent of the individual. If sensitive information is involved, the separate consent of the information subject needs to be obtained. The embodiments also need to be implemented with the authorization and consent of the object.
[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0059] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.
[0060] Existing embedded systems usually face the problem of limited storage space, especially when functions are constantly expanding. The related art adopts a common compression method to uniformly compress the entire program to reduce its occupied space on the storage medium. When it is necessary to execute, the compressed data needs to be decompressed and then the decompressed program is executed. Although traditional compression methods can reduce the storage space occupied, they are often inefficient during decompression and execution, and lack differentiated processing of different parts of the program. The compression and storage of the program do not take into account the frequency of use and functional importance of the module, resulting in inefficient use of storage space. In addition, the system needs to load the entire program when executing, which increases the startup time and memory usage, affecting the execution efficiency of the program.
[0061] In order to solve the above technical problems, the embodiments of the present application provide a program management method, apparatus, device and medium. Specifically, a priority dynamic compression and on-demand loading management method for embedded system programs is provided to solve the problem of storage space limitation, improve the scalability and resource utilization of the system, and reduce the delay of program execution.
[0062] To better understand the solution provided by the embodiments of this application, please refer to Figure 1 , Figure 1 A scenario diagram of a program management method application provided in an embodiment of the present application, wherein an initiator can initiate a program execution request for a target program, and the tasks corresponding to the program execution may be: temperature control tasks, runtime tasks, etc., which are not specifically limited here.
[0063] The present application embodiment provides a program management method, such as Figure 2 , Figure 3 As shown, the method provided in the embodiment of the present application can be executed by an electronic device, and the electronic device is a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The electronic device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The embodiment of the present application is not limited here. The method includes:
[0064] S101, obtaining a program execution request of a target program;
[0065] Among them, the target program is the application program that needs to be started, and an application program can include multiple functional modules. A program execution request refers to an instruction that triggers the target program to start running or execute a certain function. The program execution request includes but is not limited to: the name of the target program, the function name, and parameters, etc., which are used to clearly indicate the specific parameters that need to be executed. For example, when the user clicks the cooling 21°C button for the target program of the air conditioner, a program execution request is obtained, requiring the electronic device to use the cooling function of the target program to achieve the purpose of cooling 21°C.
[0066] In some embodiments, when a user clicks a start button of a graphical user interface (GUI) to trigger the operation of running a program, it is converted into a program execution request so as to obtain a program execution request of a target program. In other embodiments, an electronic device may maintain a queue of program execution requests, and when an electronic device system or other program needs to start a target program, the request is added to the queue; the queue is checked regularly, and the requests therein are processed in sequence. It is understandable that other methods may also be used, which are not limited here.
[0067] S102, determining a target function corresponding to the program execution request according to the program execution request;
[0068] Parse the program execution request to obtain the corresponding target function.
[0069] Specifically, the character string in the program execution request may be matched with a corresponding character string in a mapping table to determine the target function, and the mapping table is a mapping table of multiple character strings and multiple functions that are preset.
[0070] S103, determining a target function module compression package corresponding to a target function from a plurality of function module compression packages of the target program; wherein the function module compression package corresponding to each function module of the target program is obtained by compression at a compression rate determined according to a priority of the function module;
[0071] Among them, the function module compressed package refers to the file package obtained by processing the target program after being split into independent function modules through compression algorithm. The compressed package contains the resources of the function module, but the volume is compressed to save storage space and speed up the transmission speed. The target function refers to the specific function corresponding to the program execution request that you want to access, which corresponds to the function module in the target program. The target function module compressed package is the function module compressed package corresponding to the target function.
[0072] Generally, due to the limited storage space of electronic devices or the large size of applications, storage space may be tight. Therefore, in order to improve efficiency and resource utilization, the application can be split into multiple functional modules, and each functional module is compressed into a compressed package to reduce the pressure on storage space.
[0073] However, the priority of a functional module refers to the priority order determined based on factors such as the importance and / or frequency of use of the functional module. Different functional modules have different priorities. Generally, modules with higher priorities may be frequently accessed. Therefore, when compressing functional modules, modules with higher priorities may be compressed less (i.e., lower compression ratio) to retain more details and performance; while modules with lower priority may be compressed more (i.e., higher compression ratio) to save space. Through the priority compression algorithm, the decompression time of critical functional modules (i.e., high-priority functional modules) and the storage space occupied by non-critical functional modules (i.e., low-priority functional modules) can be effectively reduced, so that in the process of implementing the on-demand loading mechanism, the initial startup time and memory usage can be reduced, thereby improving the execution speed of the program.
[0074] In some embodiments, a list of compressed packages of all function modules of the target program is obtained, the compressed package list including basic information of each compressed package such as name, size, compression ratio, etc.; a compressed package matching the target function name is searched in the list through a matching algorithm and determined as the target function module compressed package; if not found, a prompt message is sent to the user to confirm whether the request is correct, or the name change record is checked to see whether there is any function name change, so as to match and confirm the target function module compressed package again.
[0075] S104, decompress and load the target function module compressed package to execute the target function.
[0076] In an embodiment of the present application, a demand loading mechanism is designed. After receiving a program execution request, only the currently required functional modules need to be loaded and decompressed during program execution, thereby reducing the initial startup time and memory usage of the system.
[0077] It can be seen that in the embodiment of the present application, the compression rate of the function module is determined in advance according to the priority of the function module, and the compression rate of the high-priority function module is lower to ensure that it can be quickly decompressed and loaded when needed; the compression rate of the low-priority function module is higher to save storage space; so that after obtaining the program execution request of the target program, the corresponding target function can be determined according to the program execution request; from the multiple function module compression packages of the target program, the target function module compression package corresponding to the target function is determined, and only the target function module compression package is decompressed and loaded instead of all the function modules of the entire target program, which reduces memory usage and improves operating efficiency. In addition, compared with the related art, the present application uses this on-demand loading method, so that users can experience the required functions more quickly without waiting for the entire program to be loaded.
[0078] Further, a possible implementation method of the present application embodiment is shown in Figure 4Before obtaining the program execution request of the target program, it also includes: obtaining the priorities corresponding to each of the multiple functional modules of the target program; determining the compression rate corresponding to the first functional module according to the priority corresponding to the first functional module; the first functional module is any module among the multiple functional modules; according to the compression rate corresponding to the first functional module, compressing the first functional module to obtain a first functional module compressed package; and storing the first functional module compressed package.
[0079] In the embodiment of the present application, the priority can be determined by tracking the user's operating habits and collecting user behavior data, such as commonly used functions, usage frequency, etc. Specifically, in the embodiment of the present application, the method for determining the priority corresponding to each of the multiple functional modules may include: obtaining the historical usage frequency and / or function importance value corresponding to each of the multiple functional modules of the target program; determining the priority corresponding to each of the multiple functional modules according to the historical usage frequency and / or function importance value corresponding to each of the multiple functional modules.
[0080] Among them, the historical usage frequency refers to the frequency with which the function module has been used by the user in the past period of time (the user can determine this period according to the actual situation), which can indicate the actual usage of the function module, and then indicate the degree of user demand for the function module. It is understandable that the user can be the user who issued the request, or all users corresponding to the target program, which is no longer limited in this embodiment. The function importance value is used to indicate the importance of the function module in the target program, which can be determined by the technician. It is understandable that the lowest compression rate is used for the modules that are necessary for system startup (the modules with the highest frequency of use and the highest priority), and a higher compression rate is used for optional function modules.
[0081] Optionally, the priorities corresponding to the multiple functional modules are determined according to the historical usage frequencies corresponding to the multiple functional modules. Specifically, for each functional module, the priority corresponding to the functional module is determined according to the historical usage frequency corresponding to the functional module and a first preset priority relationship, wherein the first preset priority relationship is a correspondence relationship between multiple usage frequencies and multiple priorities, wherein the multiple usage frequencies can be frequencies or frequency ranges.
[0082] Optionally, the priorities corresponding to the multiple functional modules are determined according to the functional importance values corresponding to the multiple functional modules. Specifically, for each functional module, the priority corresponding to the functional module is determined according to the functional importance value corresponding to the functional module and a second preset priority relationship, wherein the second preset priority relationship is a correspondence relationship between multiple functional importance values and multiple priorities, wherein the multiple functional importance values can be functional importance values or a range of functional importance values.
[0083] Optionally, the priorities corresponding to the multiple functional modules are determined according to the historical usage frequencies and function importance values corresponding to the multiple functional modules.
[0084] In one possible case, the method of calculating the priority of each functional module includes: , where P is the priority, F is the historical usage frequency, I is the function importance value, and α and β are weight coefficients used to adjust the relative importance of the historical usage frequency and the function importance value in the priority calculation. The value range of these two coefficients is usually between 0 and 1, and α+β=1. The values of α and β can be adjusted according to specific needs and scenarios. For example, if the historical usage frequency is considered more important in determining the priority, α can be set larger and β can be set smaller; vice versa, of course, the values of α and β are allowed to be 0. The larger the P value, the greater the priority.
[0085] In one possible case, the method of calculating the priority of each functional module includes: , where Pi is the priority of the i-th function module; Fi is the historical usage frequency of the i-th function module; Ii is the function importance value of the i-th function module; Fj is the historical usage frequency of the j-th function module; Ij is the function importance value of the j-th function module; Favg is the average value of the historical usage frequency of all function modules; α and β are weight coefficients used to adjust the relative importance of historical usage frequency and function importance value in priority calculation, and α+β=1; γ and δ are nonlinear adjustment parameters used to control the nonlinear influence of function importance value and historical usage frequency in priority calculation, which can be adjusted according to actual needs; is an adjustment coefficient used to adjust the impact of historical usage frequency on priority. >0, the priority of high frequency is enhanced; when <0, the priority of high frequency is weakened; n represents the total number of functional modules. The historical usage frequency and functional importance value of each functional module are normalized to eliminate the influence of different dimensions; nonlinear adjustment parameters γ and δ, as well as adjustment coefficients are introduced , to more flexibly reflect the interaction between historical usage frequency and function importance values.
[0086] After obtaining the priority of each functional module, the corresponding compression rate is determined according to the priority, and the functional module is compressed based on the compression rate, and the compressed package is stored. In an embodiment of the present application, in the process of determining the compression rate, in an achievable manner, the priority can be divided into ranges to obtain multiple ranges, and a fixed compression rate is set for each range. For example, the functional module in the high priority range may set a lower compression rate (such as 10%) to maintain its performance and function; the functional module in the medium priority range sets a moderate compression rate (such as 30%); the functional module in the low priority range sets a higher compression rate (such as 60%); and then, after obtaining the priority of the first functional module, the corresponding range can be matched to obtain the corresponding compression rate. In another achievable manner, a linear relationship C=-kP+b is set, where C is the compression rate; k is the slope indicating the magnitude of the compression rate reduction when the priority increases by one unit, which can be set according to experience; P is the priority; b is the initial value of the compression rate, that is, the maximum compression rate.
[0087] Furthermore, the priority of each functional module may be re-determined periodically so as to obtain an accurate level.
[0088] It can be seen that in the embodiment of the present application, a priority dynamic compression algorithm based on program usage frequency and functional importance is proposed, which can dynamically adjust the compression level of different functional modules. For frequently used high-priority key modules, a lower compression rate is used to ensure fast decompression, and for less used low-priority functional modules, a higher compression rate is used to optimize storage space.
[0089] Conventionally, storage media may include: RAM, ROM or external memory. Among them, RAM has the characteristics of high-speed access and is usually used to store programs and data being executed; for modules that require fast response and high-frequency access (such as the core part of the operating system, real-time control algorithms, etc.), storing them in RAM can significantly improve the performance and response speed of the system. ROM is usually used to store fixed, infrequently changed data and programs (such as boot code, firmware, etc.); although the access speed is slightly slower than RAM, ROM has the advantage of data persistence. External memory (such as SD card, hard disk, etc.) is usually used to store large amounts of data or programs that may not need to be accessed immediately or updated frequently; storing infrequently used modules or large data sets in external memory can save valuable internal storage space and allow the system to dynamically load data as needed.
[0090] Therefore, further, in order to optimize the best data storage and management effect, see Figure 5A possible implementation method of an embodiment of the present application is to store a compressed package of a first functional module, including: determining a storage medium corresponding to the first functional module according to a priority corresponding to the first functional module; and storing the compressed package of the first functional module in the storage medium corresponding to the first functional module.
[0091] In the embodiment of the present application, a modular storage structure is proposed. Specifically, the program is decomposed into multiple functional modules, and the functional modules are stored in storage media of different levels, such as RAM, ROM or external memory, according to the priority of the modules. The correspondence between multiple priority ranges and multiple storage media is preset, such as priority range 1 (high priority range) corresponds to RAM, priority range 2 (medium priority range) corresponds to ROM, and priority range 3 (high priority range) corresponds to external memory. Then, according to the range to which the first functional module belongs, the corresponding storage medium is determined.
[0092] It is understandable that storing compressed data packets of functional modules with different priorities on storage media with different costs can optimize storage costs. In addition, storing compressed packets of functional modules with high priority on storage media with faster access speed (such as RAM) can significantly improve the response speed and overall performance, and can reduce data access delays when calling compressed packets, especially in applications that require real-time processing or high-performance computing.
[0093] It can be seen that in the embodiment of the present application, selecting a storage medium according to the priority of the functional module and storing the compressed package in the storage medium can improve storage efficiency and management effect.
[0094] Furthermore, in order to improve resource utilization, the embodiment of the present application provides for dynamically adjusting resource allocation according to the frequency of use of the functional modules and the system load. Specifically, it can dynamically adjust the allocation of resources such as CPU and memory according to the current system load and the needs of the functional modules, thereby reducing resource waste and improving the overall performance of the system. A possible implementation method of the embodiment of the present application also includes: obtaining the current allocatable load resources of the system and the load demand resource amount corresponding to the target functional module; the allocatable load resources include: CPU resources and / or memory resources; allocating resources to the target functional module according to the current allocatable load resources of the system, the load demand resource amount and the priority corresponding to the target functional module, and the load demand resource amount is obtained by predicting the historical resource usage corresponding to the target functional module.
[0095] The load demand resource amount indicates the resources required to run the target function, including: CPU resources and / or memory resources.
[0096] In an embodiment of the present application, the current CPU and memory usage, including the amount of resources used and the total amount of resources, are collected periodically or in real time; based on the collected system information, the currently allocatable amount of CPU and memory resources is calculated.
[0097] The process of determining the load demand resource amount corresponding to the target functional module may include, in an achievable manner: obtaining the historical resource usage corresponding to the target functional module; predicting the load demand resource amount corresponding to the target functional module based on the historical resource usage; and storing the load demand resource amount corresponding to the target functional module. Specifically, the resource usage data of the target functional module in the past period of time is obtained from the database, including the CPU and memory usage; the collected historical data is cleaned to ensure the accuracy and completeness of the data; and the load demand resource amount is predicted based on the historical data, wherein the load demand resource amount may be an average value during this period of time, or an average value based on data under the same or similar working conditions as the current working condition.
[0098] In another achievable manner, it may include: obtaining the adjustment effect of the adjusted load demand resource amount of the target functional module; determining whether the adjustment effect meets the preset requirements; if not, readjusting the load demand resource amount; if so, continuously monitoring; wherein the adjusted load demand resource amount is obtained by adjusting the load demand resource amount corresponding to the target functional module according to the abnormal data in the historical resource usage, and the abnormal data is the abnormal resource usage data of the target functional module execution exception in the error log.
[0099] Among them, the load demand resource amount of the target functional module is obtained, and the load demand resource amount is obtained by predicting the historical resource usage corresponding to the target functional module; if the error log of the time period corresponding to the historical resource usage includes log information of abnormal execution of the target functional module, the abnormal data in the historical resource usage is determined according to the error log; and according to the abnormal data in the historical resource usage, the load demand resource amount corresponding to the target functional module is adjusted; and the adjusted load demand resource amount corresponding to the target functional module is stored.
[0100] Specifically, whether the adjustment effect meets the preset requirements may be determined based on the satisfaction result input by the user, which is not limited in this embodiment.
[0101] In the examples of this application, see Figure 6, collect feedback information, obtain the historical resource usage corresponding to the target functional module and the error log in the system operation, and analyze common problems and performance bottlenecks through the error log. Among them, if the error log of the period corresponding to the historical resource usage includes the log information of the abnormal execution of the target functional module, the abnormal data in the historical resource usage is determined according to the error log; and the load demand resource corresponding to the target functional module is adjusted according to the abnormal data in the historical resource usage; the load demand resource corresponding to the adjusted target functional module is stored. Readjust the load demand resource, and then allocate it according to the adjusted load demand resource, and determine whether the adjustment effect meets the preset requirements (user requirements). If satisfactory feedback from the user is received, continue to monitor; if satisfactory feedback from the user is received, readjust the load demand resource. It should be noted that in the process of readjusting the load demand resource, the load demand resource input by the user can be used as the final load demand resource, and the period of the historical resource usage can be increased or reduced, or the period corresponding to the current period can be re-determined for re-analysis, wherein, if the current period is March, the period corresponding to the current period is March of last year, or the period corresponding to the current period is March of the previous year.
[0102] It can be seen that in the embodiment of the present application, the parameters of the compression algorithm and the resource allocation strategy are automatically adjusted according to the actual situation of the program running to adapt to different usage scenarios.
[0103] The present embodiment does not limit the process of allocating resources to the target functional module according to the current allocable load resources of the system, the load demand resource amount and the priority corresponding to the target functional module, and the user can select according to actual needs.
[0104] For example, all the functional modules that need to be run are sorted according to their priorities, and then the load demand resource amount of each functional module is determined from high to low. The load demand of the functional modules with high levels is met first in the order of priority. If the available resources are insufficient when allocating to a functional module during the allocation process, wait for the resources to be released. Once there are enough resources, allocate resources to the functional module.
[0105] For another example, resources are reserved in advance for a function module whose priority reaches a preset level, and once the function module is used, the reserved resources can be used. Other function modules can use currently open and available resources according to their level and allocate resources based on priority.
[0106] For example, different types of functional modules are allocated resources of different sizes, see Figure 7, the higher the priority, the more resources it allocates. In one achievable manner, the priority can be divided into ranges to obtain multiple ranges, and a fixed amount of resources is set for each range. For example, a higher value may be set for a function module in a high priority range; a moderate value is set for a function module in a medium priority range; and a lower value is set for a function module in a low priority range. Then, after obtaining the value corresponding to the priority of the function module, the corresponding amount of resources is calculated, and the formula can be: , where Ri is the resource allocated to the target functional module i, Q is the current allocatable load resource of the system, Ni is the value corresponding to the priority of the target functional module i, and m is the number of functional modules to be run. is the numerical value corresponding to the priority of functional module j.
[0107] It is understandable that other methods can also be used to implement the process of allocating resources to the target functional modules, such as resource allocation algorithms based on machine learning, resource allocation strategies based on market mechanisms, etc., which are not limited here.
[0108] It can be seen that in the embodiments of the present application, it is possible to implement a scheme for allocating resources to the target functional module based on the system's current allocatable load resources, the load demand resource amount predicted by the target functional module's historical resource usage, and the priority of the target functional module, thereby implementing a dynamic resource allocation strategy, and dynamically adjusting the allocation of resources such as CPU and memory based on the current system load and the needs of the functional modules, thereby ensuring the reasonable allocation and utilization of system resources.
[0109] Furthermore, the priority can be updated regularly so that the compression rate and resource allocation strategy of the compression algorithm can be automatically adjusted according to the actual situation of program operation and the user's operating habits, so that the system performance can be automatically adjusted according to actual usage, thereby improving the system stability and user experience and adapting to different usage scenarios.
[0110] Furthermore, it is also possible to monitor system performance indicators in real time, such as CPU usage, memory usage, I / O operation speed, etc.
[0111] A possible implementation of the embodiment of the present application also includes:
[0112] Obtain system performance indicator information for a preset historical period;
[0113] According to the system performance indicator information of the preset historical period, the resource demand of the target program is predicted to obtain the predicted resource usage in the next period;
[0114] Reserve the predicted resource usage for the next period.
[0115] In the embodiment of the present application, performance indicator data about the target program in a previous time period (preset historical period) is collected, including but not limited to key performance indicators such as CPU usage, memory usage, disk I / O, etc. The indicator data includes data of the target program and each functional module of the target program. Machine learning algorithms such as cluster analysis, decision trees, time series analysis, neural networks, etc. are applied to predict user behavior and resource requirements.
[0116] It can be seen that in the embodiment of the present application, by obtaining user behavior data for a period of history and predicting, the predicted resource usage for the next period can be obtained. Based on historical data and trend analysis, future resource requirements can be predicted and adjusted in advance.
[0117] Based on any of the above embodiments, see Figure 8 , providing a specific method flow, including:
[0118] Analyze the usage frequency and functional importance of each functional module of the program as the basis for module classification;
[0119] For key modules, a low compression rate is used and the compressed modules are stored in RAM or ROM; for non-key modules, a high compression rate is used and the compressed modules are stored in external memory;
[0120] After the system starts, the currently required modules are loaded on demand;
[0121] Dynamic resource allocation;
[0122] Moreover, during the operation of the system, feedback information is collected;
[0123] Analyze the feedback information and continuously monitor when no optimization is needed. When optimization is needed, dynamically adjust the resource allocation strategy based on the analysis results, such as automatically adjusting compression parameters and resource allocation strategy.
[0124] Furthermore, the present application can also distribute tasks among multiple processors or cores to balance the load; optimize I / O operations, reduce waiting time and improve data transmission efficiency; and allow users to customize resource allocation strategies according to personal needs.
[0125] A program management device provided in an embodiment of the present application is introduced below. The program management device described below and the program management method described above can be referred to each other. The program management device of this embodiment is set in an electronic device. Fig. 9 , Fig. 9 This is a structural block diagram of a program management device according to one embodiment of the present application, comprising:
[0126] An acquisition module 210, used to acquire a program execution request of a target program;
[0127] A first determination module 220, configured to determine a target function corresponding to the program execution request according to the program execution request;
[0128] The second determining module 230 is used to determine a target function module compressed package corresponding to a target function from a plurality of function module compressed packages of the target program; wherein the function module compressed package corresponding to each function module of the target program is compressed at a compression rate determined according to a priority of the function module;
[0129] The execution module 240 is used to decompress and load the target function module compressed package to execute the target function.
[0130] In one achievable manner, the present invention further includes:
[0131] A priority acquisition module, used to acquire the priorities corresponding to the multiple functional modules of the target program;
[0132] A pre-compression module is used to determine a compression rate corresponding to the first functional module according to a priority corresponding to the first functional module; the first functional module is any module among the multiple functional modules; according to the compression rate corresponding to the first functional module, compress the first functional module to obtain a first functional module compression package;
[0133] The storage module is used to store the compressed package of the first functional module.
[0134] In one achievable manner, the priority acquisition module is used to:
[0135] Obtaining historical usage frequencies and / or functional importance values corresponding to each of multiple functional modules of the target program;
[0136] The priorities corresponding to the multiple functional modules are determined according to the historical usage frequencies and / or functional importance values corresponding to the multiple functional modules.
[0137] In one achievable manner, the storage module is used to determine a storage medium corresponding to the first functional module according to a priority corresponding to the first functional module;
[0138] The first function module compression package is stored in a storage medium corresponding to the first function module.
[0139] In one achievable manner, the present invention further includes:
[0140] The resource acquisition module is used to obtain the current allocatable load resources of the system and the load demand resource quantity corresponding to the target functional module; the allocatable load resources include: CPU resources and / or memory resources;
[0141] The allocation module is used to allocate resources to the target functional module according to the current allocatable load resources of the system, the load demand resource quantity and the priority corresponding to the target functional module. The load demand resource quantity is obtained by predicting the historical resource usage corresponding to the target functional module.
[0142] In one achievable manner, the present invention further includes:
[0143] A feedback module, used to obtain the adjustment effect of the adjusted load demand resource quantity of the target functional module;
[0144] Determine whether the adjustment effect meets the preset requirements;
[0145] If not, readjust the load demand resources; if so, continue monitoring;
[0146] Among them, the adjusted load demand resource quantity is obtained by adjusting the load demand resource quantity corresponding to the target functional module according to the abnormal data in the historical resource usage, and the abnormal data is the abnormal resource usage data of the target functional module execution exception according to the error log.
[0147] In one achievable manner, the present invention further includes:
[0148] The prediction module is used to obtain the system performance indicator information of the preset historical period; predict the resource demand of the target program according to the system performance indicator information of the preset historical period, and obtain the predicted resource usage of the next period;
[0149] The reservation module is used to reserve the predicted resource usage for the next period of time.
[0150] An electronic device is provided in an embodiment of the present application, such as Fig.10 As shown, Fig.10 The electronic device 300 shown includes: a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, such as through a bus 302. Optionally, the electronic device 300 may also include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one, and the structure of the electronic device 300 does not constitute a limitation on the embodiments of the present application.
[0151] The processor 301 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0152] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0153] The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0154] The memory 303 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the contents shown in the above method embodiment.
[0155] Fig.10 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0156] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.
[0157] An embodiment of the present application provides a computer program product, including a computer program, which implements the corresponding contents of the aforementioned method embodiment when the computer program is executed by a processor.
[0158] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0159] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A program management method, characterized in that: include: Obtain a program execution request of a target program; Determining, according to the program execution request, a target function corresponding to the program execution request; Determine a target function module compression package corresponding to the target function from a plurality of function module compression packages of the target program; wherein the function module compression package corresponding to each function module of the target program is compressed at a compression rate determined according to a priority of the function module; Decompress and load the target function module compressed package to execute the target function.
2. The program management method according to claim 1, characterized in that: Before obtaining the program execution request of the target program, the method further includes: Obtain the priorities corresponding to the multiple functional modules of the target program; Determine the compression rate corresponding to the first functional module according to the priority corresponding to the first functional module; the first functional module is any module among the multiple functional modules; compress the first functional module according to the compression rate corresponding to the first functional module to obtain a first functional module compressed package; store the first functional module compressed package.
3. The program management method according to claim 2, characterized in that: The obtaining of the priorities corresponding to the multiple functional modules of the target program includes: Obtaining historical usage frequencies and / or functional importance values corresponding to each of multiple functional modules of the target program; The priorities corresponding to the multiple functional modules are determined according to the historical usage frequencies and / or functional importance values corresponding to the multiple functional modules.
4. The program management method according to claim 2, characterized in that: The storing of the first function module compressed package includes: Determining a storage medium corresponding to the first functional module according to the priority corresponding to the first functional module; The first function module compression package is stored in a storage medium corresponding to the first function module.
5. The program management method according to claim 1, characterized in that: Also includes: Obtaining the current allocatable load resources of the system and the load demand resource amount corresponding to the target functional module; The allocatable load resources include: CPU resources and / or memory resources; Resources are allocated to the target functional module according to the current allocatable load resources of the system, the load demand resource amount and the priority corresponding to the target functional module, wherein the load demand resource amount is obtained by predicting the historical resource usage corresponding to the target functional module.
6. The program management method according to claim 5, characterized in that: Also includes: Obtaining an adjustment effect of the adjusted load demand resource amount of the target functional module; Determining whether the adjustment effect meets preset requirements; If not, readjust the load demand resources; if so, continue monitoring; Among them, the adjusted load demand resource amount is obtained by adjusting the load demand resource amount corresponding to the target functional module according to the abnormal data in the historical resource usage, and the abnormal data is the abnormal resource usage data of the abnormal execution of the target functional module according to the error log.
7. The program management method according to any one of claims 1 to 6, characterized in that: Also includes: Obtain system performance indicator information for a preset historical period; According to the system performance indicator information of the preset historical period, the resource demand of the target program is predicted to obtain the predicted resource usage in the next period; The predicted resource usage for the next time period is reserved.
8. A program management device, characterized in that: include: An acquisition module, used for acquiring a program execution request of a target program; A first determining module, configured to determine a target function corresponding to the program execution request according to the program execution request; A second determination module is used to determine a target function module compression package corresponding to the target function from a plurality of function module compression packages of the target program; wherein the function module compression package corresponding to each function module of the target program is compressed at a compression rate determined according to a priority of the function module; The execution module is used to decompress and load the target function module compressed package to execute the target function.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the program management method according to any one of claims 1 to 7 when running the computer program.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the program management method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Application management method and device, electronic equipment and computer readable storage medium
CN121300874A