Process management method and device, electronic equipment and storage medium
By allocating process resources for part of the code of the Android application, especially the process separately allocating processes for abnormal running modules, the low fluency caused by process management in the Android operating system is solved, and the smoothness of the application operation and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202510362732.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-07-11
AI Technical Summary
在安卓操作系统中,应用程序的进程管理导致流畅度低,尤其是在异常情况下,进程被直接关闭影响用户体验。
By allocating process resources to part of the application's code, especially the code that runs the module abnormally, a process is allocated separately, and the main process contains only normal code, reducing process allocation of infrequent functional modules, and optimizing memory and thread resource usage.
Improves the smoothness of the application, reduces memory and resource usage, reduces the risk of application lag, and ensures that the main process can still run normally under abnormal conditions.
Smart Images

Figure CN120295779A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of electronic devices, and particularly relates to a process management method, apparatus, electronic device, and storage medium. Background Art
[0002] In the Android operating system, the Android system virtual machine will defaultly allocate a process for each application (APP) to run. Different processes are independent of each other, which can ensure that each APP runs separately without affecting each other. Each APP process has a separate memory data space, and the memory data spaces of different APP processes are also isolated from each other. When the user opens a new APP, the system will defaultly allocate a new process, and when the user closes the APP, it is equivalent to exiting the process.
[0003] In the related art, all function modules of the APP need to be configured in each APP process, occupying a large amount of memory space and excessive resource allocations such as threads. And when the APP runs abnormally, if the Android system virtual machine captures the exception, the corresponding APP process will be directly closed. For example, if the APP exits abnormally, it will affect the user experience and result in poor running fluency of the APP.
[0004] Therefore, the process management solution in the related art has the defect of low fluency of application programs. Summary of the Invention
[0005] The purpose of the embodiments of this application is to provide a process management method, apparatus, electronic device, and storage medium, which can solve the problem of low fluency of application programs.
[0006] In a first aspect, the embodiments of this application provide a process management method, which includes:
[0007] When the application is in the first running state, allocate a first process based on the first code of the application, and allocate process resources for the first process;
[0008] Wherein, the first code is a part of the code of the application.
[0009] In a second aspect, the embodiments of this application provide a process management apparatus, which includes:
[0010] A first allocation module, configured to allocate a first process according to the first code of the application and allocate process resources for the first process when the application is in the first running state;
[0011] Wherein, the first code is a part of the code of the application.
[0012] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory stores a program or instructions that can run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0013] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instructions are stored, and when the program or instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0014] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is used to run a program or instructions to implement the method described in the first aspect.
[0015] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0016] In the embodiment of the present application, when the application is in the first running state, a first process is allocated based on the first code of the application, and process resources are allocated to the first process; wherein, the first code is part of the code of the application. By allocating a process to part of the code of the application, for example, when the application is in an abnormal running state, the code corresponding to the abnormal running module can be separately allocated a process, so that the main process of the application only contains normal code, thereby enabling the main process of the application to run normally, improving the fluency of the application. Also, a process can be allocated to the function modules commonly used by the user, and for the function modules that are not commonly used, a process is not allocated first, so as to reduce the data volume of the code in the APP process of the application, reduce the occupancy of resources such as memory space and threads by the APP process, and improve the fluency of the application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flowchart of a process management method provided by an embodiment of the present application;
[0018] Figure 2 is a logic block diagram for detecting whether the main process runs abnormally in some embodiments of the present application;
[0019] Figure 3 is a logic block diagram for extracting the code corresponding to the abnormal running module and its related resource files from the main process;
[0020] Figure 4 is a schematic diagram of a function module in some embodiments of the present application;
[0021] Figure 5 It is a logic block diagram for allocating APP processes to common function modules in some embodiments of the present application;
[0022] Figure 6 It is a schematic structural diagram of a process management device provided by an embodiment of the present application;
[0023] Figure 7 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0024] Figure 8 It is a schematic hardware structure diagram of an electronic device provided by an embodiment of the present application. Specific embodiments
[0025] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0026] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data may be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object may be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means that the related objects before and after are in an "or" relationship.
[0027] Next, in conjunction with the accompanying drawings, the process management method, process management device, electronic device, and readable storage medium provided by the embodiments of the present application will be described in detail through specific embodiments and their application scenarios.
[0028] Refer to Figure 1 , the process management method provided by the embodiments of the present application includes the following steps:
[0029] Step 101: When the application is in the first running state, allocate a first process based on the first code of the application and allocate process resources to the first process; wherein, the first code is a part of the code of the application.
[0030] In some embodiments, the execution subject of the process management method provided by the embodiments of the present application may be an electronic device installed with an Android system, which can use an Android virtual machine (hereinafter referred to as a virtual machine) to convert the bytecode of an application into machine code, and allocate runtime memory and process resources to the application to ensure that these applications can run smoothly on electronic devices with various Android systems.
[0031] In some embodiments, the first process may be the main process or the auxiliary process of the application.
[0032] It should be noted that some codes in the embodiments of the present application can be understood as the codes corresponding to some functional modules, or belong to the codes of some code classes, such as the codes of a certain code class of a certain functional module. Among them, the code class can also be called a "code logic class". Among them, the functional module can be a module in the main process that can implement the corresponding function, which includes code blocks, resource files, and even configuration files for implementing the corresponding function.
[0033] In some embodiments, allocating a first process based on the first code of the application and allocating process resources to the first process can be understood as: only allocating APP processes to some functional modules in the application, not allocating APP processes to the remaining other functional modules in the application, and allocating process resources that can meet the requirements of these functional modules to the APP process according to the process resources required by the functional modules for which the process is allocated. For example, the more or more complex the functional modules in the APP process are, the more process resources are allocated to the APP process.
[0034] In other embodiments, allocating a first process based on the first code of the application and allocating process resources to the first process can be understood as: only allocating processes to the codes of some code classes in the application, not allocating APP processes to the codes of the remaining other code classes in the application, and allocating process resources that can meet the requirements of these code classes to the APP process according to the process resources required by the code classes for which the process is allocated. For example, when an exception occurs during the operation of the APP process, obtain the code classes related to the exception, that is, the exception code classes, and extract the codes corresponding to these exception code classes from the APP process. In this way, the APP can run normally.
[0035] The embodiments of the present application can be applied to at least the following two scenarios:
[0036] Scenario 1: There is code with runtime exceptions in the application. At this time, the code with runtime exceptions can be separated from the APP main process of the application, and a first process and process resources are separately allocated for the separated exception code. At this time, the exception code runs in the first process, and the APP main process only runs the code that can run normally. At this time, there will be no problem that the APP main process is captured by the virtual machine due to a runtime exception and the APP main process is shut down. Among them, shutting down the APP main process is also called "killing the APP main process". In this way, even if there are runtime exceptions in the application, the first process can skip the code related to the exception, so that the APP main process can continue to run, that is, the application can continue to run.
[0037] Scenario 2: When the application starts, only APP processes are allocated for some functional modules in the application. For example, extract the commonly used functional modules in the application, allocate APP processes for them, and allocate process resources matching the commonly used functional modules for the APP processes. At this time, the number of functional modules in the APP process can be reduced, and the process resources occupied by the APP process can be reduced.
[0038] In some embodiments, the process resources may include memory resources, computing resources, thread resources, etc. used by the process during operation, and no specific limitation is made here.
[0039] As an optional embodiment, the first running state is an abnormal running state, and the first code is the code corresponding to the abnormal running module of the application; the method further includes:
[0040] When starting the application, allocate a main process for the application and allocate process resources for the main process;
[0041] The step of, when the application is in the first running state, allocating a first process based on the first code of the application and allocating process resources for the first process includes:
[0042] When the application is in an abnormal running state, separate the code corresponding to the abnormal running module of the application from the main process, allocate a first process based on the code corresponding to the abnormal running module of the application, and allocate process resources for the first process.
[0043] In some embodiments, when starting an application, the default assigned main process may include all functional modules in the application. Instead, when an exception occurs during the operation of the main process, the code corresponding to the abnormal operation module that affects or causes the exception is extracted from the main process, and an additional first process is allocated for the extracted code and resource files, so that the code corresponding to the extracted abnormal operation module is no longer executed in the main process, enabling the main process to run normally.
[0044] In some other embodiments, when starting an application, the default assigned main process may only include some functional modules in the application. For example, functional modules that are not commonly used during the historical use of the application or have had exceptions may not be included in the main process.
[0045] In some embodiments, the code corresponding to the above abnormal operation module may represent the code in the abnormal operation module that causes the exception when an exception occurs during the operation of the main process.
[0046] Optionally, in the case where the code causing the abnormal operation of the main process is coupled with other codes in the main process, the code corresponding to the abnormal operation module may further include other codes in the main process that are coupled with the functional module causing the exception.
[0047] In some embodiments, the abnormal operation module may further include resource files and configuration files related to the code corresponding to the abnormal operation module. In this way, during the process of allocating the first process based on the code corresponding to the abnormal operation module of the application and allocating process resources for the first process, the first process can be allocated for the code corresponding to the abnormal operation module and related resource files according to the configuration file, and during the process of allocating process resources for the first process.
[0048] In some embodiments, the above resource files may include resource files such as xml and drawable that may be used during the execution of code classes.
[0049] In some embodiments, the above configuration files may include configuration files such as AndroidManifest and build.gradle that may be used during the execution of code classes.
[0050] Among them, the descriptions of the functions and formats of xml, drawable, AndroidManifest, and build.gradle are as follows:
[0051] 1. The xml file is used to determine the UI layout style, and the format of the xml file is as follows:
[0052] <?xml version="1.0" encoding="utf-8"?>
[0053] <LinearLayout xmlns:android="http: / / schemas.android.com / apk / res / android"
[0054] android:orientation="vertical"
[0055] android:layout_width="match_parent"
[0056] android:layout_height="match_parent">
[0057]
[0058] 2. Drawable files are mainly used to store various image resources.
[0059] 3. The AndroidManifest file is used to configure the name and theme of the APP, the permissions that need to be applied for, such as storage, network, etc. The AndroidManifest file is also used to configure which page components are in the APP, so that the system can find and register them on the system. The format of the AndroidManifest file is as follows:
[0060]
[0061] 4. The build.gradle file is mainly used to determine the version number of the APP, the dependent libraries that need to be used, etc. The format of the build.gradle file is as follows:
[0062]
[0063]
[0064] In some embodiments, the exceptions that may occur during the operation of the main process may include: runtime exceptions such as null pointers, loop deadlocks, and extremely high power consumption.
[0065] In some embodiments, during the operation of the main process, the operating system, application counter, system virtual machine, etc. can implement an exception detection function to determine whether the operation of the main process is abnormal and locate the abnormal code class. For example, a null pointer exception can be captured by the system virtual machine, and a loop deadlock can be captured through the application counter, etc., because a method or code block is continuously executed, and a power consumption anomaly can be detected by the system power consumption (BatteryStats) service.
[0066] For example: As Figure 2 shown, the framework service provided by the operating system and the system virtual machine can jointly implement the function of detecting the abnormal operation of the APP process.
[0067] It should be noted that different exception detection strategies can be adopted for different types of exceptions during the operation of the APP process.
[0068] For example: 1) The detection strategy for the abnormal operation of the APP process can be that the Android system uses Java's exception mechanism to capture unhandled exceptions.
[0069] By default, if an exception occurs at a certain line of code inside the APP when the virtual machine is running, for example, the object of the program is empty and not assigned a value, this is a null pointer exception. Since it is an empty object, the program code cannot continue to execute. In this embodiment, by using Java's exception mechanism to actively capture this exception, the abnormal code class can be extracted from the main process, and it can be avoided that when this exception is not actively captured, the exception is thrown to the virtual machine, causing the virtual machine to actively terminate the APP process.
[0070] 2) The detection strategy for exceptions caused by insufficient resources such as memory can be that the APP process will be allocated a maximum memory by the system. If the total memory requested by the application exceeds this threshold, an out-of-memory exception may be caused. Based on this, the out-of-memory exception can be judged according to the size between the total memory requested by the application and the maximum memory allocated to the APP process.
[0071] 3) The detection strategy for being stuck and unresponsive can be that if the main thread of the application (also called the user interface (UserInterface, UI) thread) is blocked for more than a certain time during execution, or the main thread of the application does not respond to user input events within a specific time (for example, 5 seconds), the system will consider the application unresponsive.
[0072] This is generally because the main thread is blocked by long-term calculations, waiting for input / output (Input / Output, I / O) operations (such as file reading and writing, network requests) or other blocking operations.
[0073] 4) The detection strategy for high power consumption can be as follows: If an application overuses hardware resources or has excessive background activities, it will be recorded and detected by the system's BatteryStats service.
[0074] For example: If an application frequently or for a long time uses power-consuming hardware resources such as the Global Positioning System (GPS), camera, Wi-Fi, Bluetooth, and mobile data); or if the application performs a large number of unnecessary or frequent tasks in the background, such as network refreshing and data synchronization; or if there are time-consuming calculation tasks running in the background, it will be recorded and detected by the system's BatteryStats service. Based on the detection results, if it is determined that the power consumption of the application exceeds a preset threshold, it can be determined that a power consumption anomaly has occurred.
[0075] When an anomaly of the main process is detected in the above manner, the code with anomalies and the methods in the code in the main process can be located, so that the anomalous code, other codes in the main process that are coupled to the anomalous code, and related resource files can be extracted from the main process.
[0076] For example: Suppose the system locates that the method method2 of code A has an anomaly, then code A and other codes in the main process that are coupled to code A and related resource files are extracted.
[0077] This embodiment can be applied to the above Scenario 1. Anomalous code can be extracted from the main process of the application, and a first process and corresponding process resources can be allocated to it. In this way, when the application runs to the anomalous location, it jumps to the first process, ensuring that the main process of the application can run normally and reducing the resource occupancy of the main process.
[0078] As an optional embodiment, allocating a first process based on the first code of the application and allocating process resources to the first process includes:
[0079] Compiling the code corresponding to the abnormal operation module of the application and the resource files related to the code corresponding to the abnormal operation module according to the configuration file of the code corresponding to the abnormal operation module of the application to obtain a first code file;
[0080] Allocating a first process to the first code file and allocating process resources to the first process.
[0081] Among them, the first code file can be that the system virtual machine converts the bytecode of the application into machine code, so that after allocating runtime memory and process resources for it, the first code file can run smoothly on various Android devices.
[0082] For example: As Figure 3 shown, after the system extracts the code corresponding to the abnormal operation module and the relevant resource files, according to the configuration files, such as the AndroidManifest and build.gradle files, etc., it is recompiled and packaged through the built-in compiler of the system, and the system virtual machine reallocates the first process and the resources required by the first process, such as memory space and CPU resource scheduling, etc. In this way, the abnormal code and relevant resource files are removed from the original main process. When the user operates on the page and the process runs to the original abnormal position, the new first process runs the abnormal code, which will not affect the normal operation of the original main process.
[0083] In this embodiment, after separating the code corresponding to the abnormal operation module and the relevant resource files from the main process, a new first process can also be allocated for the code corresponding to the abnormal operation module and the relevant resource files according to the configuration file, so as to run the code corresponding to the abnormal operation module in the new first process, which can make the running process of the application more smooth and facilitate the continuation of the function corresponding to the abnormal code after the exception is recovered.
[0084] For example: If the exception is a memory overflow of the original main process, and the total memory exceeds the maximum memory allocated by the system, causing a memory overflow exception, but there is still remaining system memory, then after separating this part into a new process, the new process will be allocated a new memory space by the system, and the exception can be handled without affecting the user's use.
[0085] Another example: If the exception is caused by lags, etc.: there are too many thread applications or task executions in the original main process, resulting in the inability to respond to user click input events, then the separated new process can share this part of the tasks, which will not affect the user's execution, and the exception can also be handled; if it is caused by a programming error in the program itself, it cannot be handled and requires the program developer to handle it, but after separation, it will not affect other functions in the main process.
[0086] It should be noted that in this embodiment, the above-mentioned first process can be allocated and the corresponding process resources can be allocated when the application runs to the abnormal position corresponding to the abnormal code. In this way, when the application runs normally, the application can have only one main process; when the application runs to the abnormal position, the application has a main process and a first process.
[0087] In some embodiments, after the above first process is allocated, the first process can be released.
[0088] For example: the first process can be released when the user finishes the service operation involving the first process, such as exiting the function module involved in the exception code; or when the user directly exits or kills the main process of the application, the first process is also released.
[0089] As an alternative embodiment, in the case where the application is in an abnormal running state, extracting the code corresponding to the abnormal running module of the application from the main process includes:
[0090] In the case where the application is in an abnormal running state, if the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process is less than a preset threshold, then extract the code corresponding to the abnormal running module and the resource files related to the code corresponding to the abnormal running module from the main process.
[0091] In this embodiment, when the coupling degree between the code corresponding to the abnormal running module and the remaining code in the main process is less than the preset threshold, it means that the code corresponding to the abnormal running module has relatively less coupling with the remaining code and is relatively independent, so that the code corresponding to the abnormal running module and its related resource files can be more easily extracted from the main process, which can simplify the complexity of extracting the code corresponding to the abnormal running module and its related resource files from the main process.
[0092] As an alternative embodiment, the method further includes:
[0093] In the case where the application is in an abnormal running state, if the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process is greater than or equal to the preset threshold, then mark the logical area of the code corresponding to the abnormal running module and skip the marked logical area.
[0094] In contrast to the previous embodiment, in this embodiment, when the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process is greater than or equal to the preset threshold, it means that the code corresponding to the abnormal running module has a relatively deep coupling with the remaining code of the main process, making it difficult to extract the code corresponding to the abnormal running module from the main process. At this time, only the logical area of the code corresponding to the abnormal running module in the main process is marked to skip these marked logical areas during the running of the main process to ensure the normal running of the main process.
[0095] As an alternative embodiment, the method further includes:
[0096] Determine the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process according to the corresponding relationship between the dependency information and the coupling degree of the code corresponding to the abnormal operation module;
[0097] Wherein, the dependency information is used to indicate the dependency relationship and degree of dependency between the code corresponding to the abnormal operation module and the remaining code of the main process.
[0098] In some embodiments, when the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is data coupling, the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is less than the preset threshold, wherein the data coupling is the transfer of simple data values between different code classes;
[0099] When the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is stamp coupling, the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is less than the preset threshold, wherein the stamp coupling is the transfer of complex data structures between different code classes;
[0100] When the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is control coupling, the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is greater than or equal to the preset threshold, wherein the control coupling is that one code class controls the execution of another code class;
[0101] When the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is external coupling, the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is greater than or equal to the preset threshold, wherein the external coupling is that different code classes mutually depend on external systems or third-party dependency libraries.
[0102] For example, when the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is data coupling, it is determined that the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is low, that is, less than the preset threshold; when the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is marked coupling, the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is relatively low, slightly higher than the coupling degree corresponding to data coupling, and less than the preset threshold; when the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is control coupling, it is determined that the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is high, and greater than or equal to the preset threshold; when the dependency information indicates that the dependency relationship between the code corresponding to the abnormal operation module and the remaining code of the main process is external coupling, it is determined that the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process is high, higher than the coupling degree corresponding to control coupling, and greater than or equal to the preset threshold.
[0103] In this embodiment, the dependency information of the code corresponding to the abnormal operation module can be used to judge the dependency relationship and degree between the code corresponding to the abnormal operation module and the remaining code of the main process, an external system, or a third-party library, and then determine the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process, providing a basis for adopting a scheme of detaching and allocating a new process to the code corresponding to the abnormal operation module or adopting a scheme of marking in the main process to not execute the marked logical area in the main process.
[0104] As an optional embodiment, the first code is the code corresponding to the first function module of the application; the usage frequency of the function corresponding to the first function module is greater than the preset usage frequency;
[0105] When the application is in the first running state, allocating a first process based on the first code of the application and allocating process resources to the first process includes:
[0106] When starting the application, allocating a first process based on the code corresponding to the first function module and allocating process resources to the first process.
[0107] In some embodiments, the first function module may be a frequently used function module in the application, such as the function module corresponding to the home page or the settings page.
[0108] In some embodiments, such as Figure 4As shown, the functional modules in the embodiments of the present application may be modules including code files, resource files, and configuration files.
[0109] In some embodiments, the first functional module may be determined according to the user's historical usage of the application.
[0110] For example: There are usually buried point records for the functions and entrances clicked by the user in the APP. The buried points can record the number of clicks, time, etc. of the user's clicks, which are used for APP business analysis. Through the buried points, the high-frequency and low-frequency operations of the user and the function entrances without operations can be determined. Thus, according to the usage frequency of each functional module in the application by the user, it can be determined which functional modules are the frequently used functional modules by the user, and then these functional modules are determined as the first functional module.
[0111] In some other embodiments, the first functional module may be the functional module with a relatively high usage frequency by most users in the application according to big data statistics.
[0112] In some embodiments, the preset usage frequency is set by the user or configured by the system. For functional modules with a usage frequency greater than or equal to the preset usage frequency, they are considered to be frequently used functional modules and can be extracted as the first functional module process; for functional modules with a usage frequency less than the preset usage frequency, they are considered to be infrequently used functional modules and are not extracted as the first functional module process.
[0113] In some embodiments, the code corresponding to the first functional module may be extracted from the system files of the application. For example: The system can extract the code corresponding to the frequently used functional modules of the user from the Android application package (APK) file of the application.
[0114] In some embodiments, the process allocation policy of the first process may be determined by the virtual machine or applied to the virtual machine through the configuration file in the APP.
[0115] For example: The system integrates the first functional module into the APP process. This part of the first functional module is uniformly allocated processes by the virtual machine. Among them, the common process allocation policy is carried out by the virtual machine. If the APP itself has a process allocation policy application, it can be configured in the build.gradle configuration file, such as configuring the process name, etc.
[0116] Such as Figure 5As shown in the figure, assume that the function modules in a certain APP include module 1, module 2, and module 3. Among them, module 2 is a frequently used function module. When starting the APP, only the function module of module 2 is extracted, which at least includes the code files and resource files of module 2, and a process is allocated to module 2 through the system virtual machine, as well as the process resources corresponding to this process.
[0117] In this embodiment, when the user starts the application program, only the frequently used function modules in the application program are allocated processes and their corresponding process resources, which can reduce the size of the APP process when the application program starts, and reduce the resource occupancy of the APP process, which can improve the speed of starting the application program and reduce the probability and degree of the application program getting stuck.
[0118] As an alternative embodiment, the method further includes:
[0119] In response to a first input to the application program, add the code corresponding to the second function module to the first process; wherein, the first input is used to enable the function corresponding to the second function module, and the usage frequency of the function corresponding to the second function module is less than or equal to the preset usage frequency.
[0120] In this embodiment, when the user operates on the second function module, the second function module is added to the APP process of the application program. In this way, the function modules that are not frequently used by the user can be dynamically added to the APP process according to the user's operation, which can reduce the memory space consumed by the APP process and the system resources allocated, such as threads, CPU resources, etc. without affecting the user's operation.
[0121] It is worth noting that when the user finishes the operation related to the second function module or uses the function related to the second function module, the second function module can be detached from the first process. In this way, the memory space consumed by the APP process and the system resources allocated can be dynamically reduced according to the user's operation.
[0122] As an alternative embodiment, the function modules of the application program adopt a modular structure; the number of the first function modules is at least two;
[0123] When starting the application program, based on the code corresponding to the first function module, allocate a first process and allocate process resources to the first process, including:
[0124] When the application is started, extract the code corresponding to at least two first functional modules, the resource files related to the code corresponding to the at least two first functional modules, and the configuration files of the code corresponding to the at least two first functional modules from the modular code file of the application;
[0125] Integrate the code corresponding to the at least two first functional modules, the resource files related to the code corresponding to the at least two first functional modules, and the configuration files of the code corresponding to the at least two first functional modules to obtain a second code file;
[0126] Allocate a first process to the second code file and allocate process resources to the first process.
[0127] In some embodiments, the functional modules in the application adopt a modular structure. It can be that the application adopts a modular development method. Among them, modular development is a software design and development method, and its core idea is to divide the software system into several independent and reusable modules. Each module is usually responsible for a specific function or a group of related functions. Such a design method helps to improve the maintainability, scalability and team collaboration efficiency of the software.
[0128] In some embodiments, the modular code file can be a modular APK file.
[0129] In some embodiments, the second code file is similar to the first code file and can be a code file that can run smoothly on various Android devices.
[0130] In this embodiment, since the functional modules in the application adopt a modular structure, at least two first functional modules including code files, resource files and configuration files can be simply extracted from the modular code file of the application. In this way, only the at least two extracted first functional modules need to be integrated, and then an APP process and process resources can be uniformly allocated to them, which can simplify the extraction process of the at least two first functional modules and the allocation process of the process and process resources.
[0131] As an alternative embodiment, the step of, when the application is started, allocating a first process based on the code corresponding to the first functional module and allocating process resources to the first process includes:
[0132] When the application is started, determine the page layout file of the first functional module according to the control corresponding to the entry of the first functional module, and extract the code corresponding to the first functional module and the second code coupled with the code corresponding to the first functional module;
[0133] Compile the page layout file of the first functional module, the code corresponding to the first functional module, and the second code coupled with the code corresponding to the first functional module to obtain a third code file;
[0134] Allocate a first process for the third code file and allocate process resources for the first process.
[0135] Among them, the page layout file includes the resource file of the first functional module, and the second code coupled with the code corresponding to the first functional module may include the code files used and relied on by the resource file involved in the code corresponding to the first functional module.
[0136] This embodiment can be applied to the scenario where the functional modules in the application do not adopt a modular structure. At this time, the control corresponding to the entry of the first functional module can be analyzed, and based on this control, the xml page layout file, code, resource file related to the code, and other codes used and relied on by the resource file of the first functional module, that is, the second code coupled with the code corresponding to the first functional module, can be found. These files are extracted, and the extracted files are packaged and compiled to generate a first process.
[0137] Among them, the compilation process of the xml page layout file, code, resource file related to the code, and other codes used and relied on by the resource file is similar to the compilation process of the code corresponding to the abnormal operation module and the resource file related to the code corresponding to the abnormal operation module in the foregoing embodiments, and will not be elaborated here.
[0138] In some embodiments, the third code file is similar to the first code file and can be a code file that can run smoothly on various Android devices.
[0139] In this embodiment, the extraction, compilation, and process allocation of functional modules that are not in a modular structure can be realized.
[0140] In the process management method provided by the embodiments of the present application, the execution subject can be a process management device. In the embodiments of the present application, taking the process management device executing the process management method as an example, the process management device provided by the embodiments of the present application is described.
[0141] Refer to Figure 6 , a process management device 600 provided by the embodiments of the present application includes the following modules:
[0142] A first allocation module 601, configured to allocate a first process according to the first code of the application and allocate process resources for the first process when the application is in the first running state; wherein, the first code is a part of the code of the application.
[0143] In some embodiments, the first operating state is an abnormal operating state, and the first code is the code corresponding to the abnormal operating module of the application program; the process management device 600 further includes:
[0144] A second allocation module, configured to allocate a main process for the application program and allocate process resources for the main process when the application program is started;
[0145] The first allocation module 601 is specifically configured to:
[0146] When the application program is in an abnormal operating state, extract the code corresponding to the abnormal operating module of the application program from the main process, allocate a first process based on the code corresponding to the abnormal operating module of the application program, and allocate process resources for the first process.
[0147] In some embodiments, the first allocation module 601 is specifically configured to:
[0148] When the application program is in an abnormal operating state, if the coupling degree between the code corresponding to the abnormal operating module and the remaining code of the main process is less than a preset threshold, extract the code corresponding to the abnormal operating module and the resource file related to the code corresponding to the abnormal operating module from the main process.
[0149] In some embodiments, the first allocation module 601 includes:
[0150] A first compilation unit, configured to perform compilation processing on the code corresponding to the abnormal operating module of the application program and the resource file related to the code corresponding to the abnormal operating module according to the configuration file of the code corresponding to the abnormal operating module of the application program, to obtain a first code file;
[0151] A first allocation unit, configured to allocate a first process for the first code file and allocate process resources for the first process.
[0152] In some embodiments, the process management device 600 further includes:
[0153] A marking module, configured to, when the application program is in an abnormal operating state, if the coupling degree between the code corresponding to the abnormal operating module and the remaining code of the main process is greater than or equal to a preset threshold, mark the logical area of the code corresponding to the abnormal operating module and skip the marked logical area.
[0154] In some embodiments, the process management device 600 further includes:
[0155] A determination module, configured to determine the coupling degree between the code corresponding to the abnormal operation module and the remaining code of the main process according to the correspondence between the dependency information and the coupling degree of the code corresponding to the abnormal operation module;
[0156] Wherein, the dependency information is used to indicate the dependency relationship and degree of dependency between the code corresponding to the abnormal operation module and the remaining code of the main process.
[0157] In some embodiments, the first code is the code corresponding to the first functional module of the application program; the usage frequency of the function corresponding to the first functional module is greater than a preset usage frequency;
[0158] The first allocation module 601 is specifically configured to:
[0159] When starting the application program, allocate a first process based on the code corresponding to the first functional module and allocate process resources for the first process.
[0160] In some embodiments, the process management device 600 further includes:
[0161] An adding module, configured to, in response to a first input to the application program, add the code corresponding to the second functional module to the first process; wherein, the first input is used to enable the function corresponding to the second functional module, and the usage frequency of the function corresponding to the second functional module is less than or equal to the preset usage frequency.
[0162] In some embodiments, the functional modules of the application program adopt a modular structure; the number of the first functional modules is at least two;
[0163] The first allocation module 601 includes:
[0164] An extraction unit, configured to, when starting the application program, extract the codes respectively corresponding to at least two first functional modules, the resource files related to the codes respectively corresponding to the at least two first functional modules, and the configuration files of the codes respectively corresponding to the at least two first functional modules from the modular code file of the application program;
[0165] An integration unit, configured to integrate the codes respectively corresponding to the at least two first functional modules, the resource files related to the codes respectively corresponding to the at least two first functional modules, and the configuration files of the codes respectively corresponding to the at least two first functional modules to obtain a second code file;
[0166] A second allocation unit, configured to allocate a first process for the second code file and allocate process resources for the first process.
[0167] In some embodiments, the first allocation module 601 includes:
[0168] A processing unit, configured to, when starting the application, determine a page layout file corresponding to an entry of the first functional module according to a control corresponding to the entry of the first functional module, and extract code corresponding to the first functional module and second code coupled to the code corresponding to the first functional module;
[0169] A second compilation unit, configured to perform compilation processing on the page layout file of the first functional module, the code corresponding to the first functional module, and the second code coupled to the code corresponding to the first functional module to obtain a third code file;
[0170] A third allocation unit, configured to allocate a first process for the third code file and allocate process resources for the first process.
[0171] The process management device 600 in the embodiments of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than a terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0172] The process management device 600 in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system.
[0173] The process management device 600 provided in the embodiments of the present application can implement Figure 1 Each process implemented by the method embodiment will not be repeated here to avoid repetition.
[0174] Optionally, as Figure 7As shown in the figure, an embodiment of the present application further provides an electronic device 700, including a processor 701 and a memory 702. A program or instruction that can run on the processor 701 is stored on the memory 702. When the program or instruction is executed by the processor 701, each step of the above-described embodiment of the process management method is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here.
[0175] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0176] Figure 8 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application.
[0177] The electronic device 800 includes, but is not limited to: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, and a processor 810 and other components.
[0178] Those skilled in the art can understand that the electronic device 800 may further include a power supply (such as a battery) for supplying power to each component. The power supply can be logically connected to the processor 810 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 8 The structure of the electronic device shown in does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0179] Among them, the processor 810 is used to allocate a first process based on the first code of the application program and allocate process resources for the first process when the application program is in the first running state;
[0180] Among them, the first code is a part of the code of the application program.
[0181] In some embodiments, the first running state is an abnormal running state, and the first code is the code corresponding to the abnormal running module of the application program;
[0182] The processor 810 is further used to allocate a main process for the application program and allocate process resources for the main process when starting the application program;
[0183] The processor 810 executes the step of allocating a first process based on the first code of the application program and allocating process resources for the first process when the application program is in the first running state, including:
[0184] When the application is in an abnormal running state, extract the code corresponding to the abnormal running module of the application from the main process, allocate a first process based on the code corresponding to the abnormal running module of the application, and allocate process resources for the first process.
[0185] In some embodiments, the extracting, by the processor 810, of the code corresponding to the abnormal running module of the application from the main process when the application is in an abnormal running state includes:
[0186] When the application is in an abnormal running state, if the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process is less than a preset threshold, extract the code corresponding to the abnormal running module and the resource files related to the code corresponding to the abnormal running module from the main process.
[0187] In some embodiments, the allocating, by the processor 810, of a first process based on the first code of the application and allocating process resources for the first process includes:
[0188] Compile the code corresponding to the abnormal running module of the application and the resource files related to the code corresponding to the abnormal running module according to the configuration file of the code corresponding to the abnormal running module of the application to obtain a first code file;
[0189] Allocate a first process for the first code file and allocate process resources for the first process.
[0190] In some embodiments, the processor 810 is further configured to, when the application is in an abnormal running state, if the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process is greater than or equal to a preset threshold, mark the logical area of the code corresponding to the abnormal running module and skip the marked logical area.
[0191] In some embodiments, the processor 810 is further configured to determine the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process according to the correspondence between the dependency information and the coupling degree of the code corresponding to the abnormal running module;
[0192] Wherein, the dependency information is used to indicate the dependency relationship and the degree of dependency between the code corresponding to the abnormal running module and the remaining code of the main process.
[0193] In some embodiments, the first code is the code corresponding to the first functional module of the application; the usage frequency of the function corresponding to the first functional module is greater than a preset usage frequency;
[0194] When the application is in the first running state, the processor 810 executes to allocate a first process based on the first code of the application and allocate process resources for the first process, including:
[0195] When starting the application, allocate a first process based on the code corresponding to the first functional module and allocate process resources for the first process.
[0196] In some embodiments, the processor 810 is further configured to, in response to a first input to the application, add the code corresponding to the second functional module to the first process; wherein, the first input is used to enable the function corresponding to the second functional module, and the usage frequency of the function corresponding to the second functional module is less than or equal to the preset usage frequency.
[0197] In some embodiments, the functional modules of the application adopt a modular structure; the number of the first functional modules is at least two;
[0198] When starting the application, the processor 810 executes to allocate a first process based on the code corresponding to the first functional module and allocate process resources for the first process, including:
[0199] When starting the application, extract the codes respectively corresponding to at least two first functional modules, the resource files related to the codes respectively corresponding to the at least two first functional modules, and the configuration files of the codes respectively corresponding to the at least two first functional modules from the modular code file of the application;
[0200] Integrate the codes respectively corresponding to the at least two first functional modules, the resource files related to the codes respectively corresponding to the at least two first functional modules, and the configuration files of the codes respectively corresponding to the at least two first functional modules to obtain a second code file;
[0201] Allocate a first process for the second code file and allocate process resources for the first process.
[0202] When starting the application, the processor 810 executes to allocate a first process based on the code corresponding to the first functional module and allocate process resources for the first process, including:
[0203] When starting the application, determine the page layout file of the first functional module according to the control corresponding to the entry of the first functional module, and extract the code corresponding to the first functional module and the second code coupled to the code corresponding to the first functional module;
[0204] Compile the page layout file of the first functional module, the code corresponding to the first functional module, and the second code coupled with the code corresponding to the first functional module to obtain a third code file;
[0205] Allocate a first process for the third code file and allocate process resources for the first process.
[0206] In the electronic device provided by the embodiment of the present application, when the application is in the first running state, a first process is allocated based on the first code of the application, and process resources are allocated for the first process; wherein, the first code is a part of the code of the application. By allocating a process for a part of the code of the application, for example, when the application is in an abnormal running state, the code corresponding to the abnormal running module can be allocated a separate process, so that the main process of the application only contains normal code, thereby enabling the main process of the application to run normally, improving the fluency of the application, and also, a process can be allocated for the frequently used functional modules of the user, and for the infrequently used functional modules, a process is not allocated first, so that the data volume of the code in the APP process of the application can be reduced, the occupation of resources such as memory space and threads by the APP process can be reduced, the startup efficiency of the application can be improved, and the risk of the application running stuck can be reduced.
[0207] It should be understood that in the embodiment of the present application, the input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The graphics processing unit 8041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 806 may include a display panel 8061, and the display panel 8061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include two parts: a touch detection device and a touch controller. The other input devices 8072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, which will not be elaborated here.
[0208] The memory 809 can be used to store software programs and various data. The memory 809 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 809 may include a volatile memory or a non-volatile memory, or the memory 809 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 809 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memories.
[0209] The processor 810 may include one or more processing units; optionally, the processor 810 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 810 either.
[0210] The embodiments of the present application also provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above embodiment of the process management method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0211] Among them, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs, etc.
[0212] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above process management method embodiment, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0213] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0214] The embodiments of the present application provide a computer program product. The program product is stored in a storage medium and is executed by at least one processor to implement each process of the above process management method embodiment, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0215] It should be noted that in this article, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitations, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0216] Through the description of the above embodiments, those skilled in the art can clearly understand that the above method of the embodiment can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to enable a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0217] The embodiments of the present application have been described above with reference to the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.
Claims
1. A process management method, characterized in that, Including: When the application is in the first running state, allocate a first process based on the first code of the application, and allocate process resources for the first process; Wherein, the first code is part of the code of the application.
2. The method according to claim 1, characterized in that, The first running state is an abnormal running state, and the first code is the code corresponding to the abnormal running module of the application; The method further includes: When starting the application, allocate a main process for the application, and allocate process resources for the main process; When the application is in the first running state, allocating a first process based on the first code of the application and allocating process resources for the first process includes: When the application is in an abnormal running state, extract the code corresponding to the abnormal running module of the application from the main process, allocate a first process based on the code corresponding to the abnormal running module of the application, and allocate process resources for the first process.
3. The method according to claim 2, wherein When the application is in an abnormal running state, extracting the code corresponding to the abnormal running module of the application from the main process includes: When the application is in an abnormal running state, if the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process is less than a preset threshold, extract the code corresponding to the abnormal running module and the resource file related to the code corresponding to the abnormal running module from the main process.
4. The method according to claim 3, characterized in that, Allocating a first process based on the first code of the application and allocating process resources for the first process includes: According to the configuration file of the code corresponding to the abnormal running module of the application, perform compilation processing on the code corresponding to the abnormal running module and the resource file related to the code corresponding to the abnormal running module to obtain a first code file; Allocate a first process for the first code file, and allocate process resources for the first process.
5. The method according to claim 3, wherein The method further includes: When the application is in an abnormal running state, if the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process is greater than or equal to a preset threshold, mark the logical area of the code corresponding to the abnormal running module, and skip the marked logical area.
6. The method according to any one of claims 3 to 5, characterized in that The method further includes: Determine the coupling degree between the code corresponding to the abnormal running module and the remaining code of the main process according to the correspondence between the dependency information of the code corresponding to the abnormal running module and the coupling degree; Wherein, the dependency information is used to indicate the dependency relationship and dependency degree between the code corresponding to the abnormal running module and the remaining code of the main process.
7. The method according to claim 1, wherein The first code is the code corresponding to the first functional module of the application; the usage frequency of the function corresponding to the first functional module is greater than a preset usage frequency; When the application is in the first running state, allocating a first process based on the first code of the application and allocating process resources for the first process includes: When the application is started, a first process is allocated based on the code corresponding to the first functional module, and process resources are allocated to the first process.
8. The method according to claim 7, wherein The method further includes: In response to a first input to the application, adding the code corresponding to the second functional module to the first process; wherein, the first input is used to enable the function corresponding to the second functional module, and the usage frequency of the function corresponding to the second functional module is less than or equal to the preset usage frequency.
9. The method according to claim 7, wherein The functional modules of the application adopt a modular structure; the number of the first functional modules is at least two; The step of, when the application is started, allocating a first process based on the code corresponding to the first functional module and allocating process resources to the first process includes: When the application is started, extracting the codes respectively corresponding to at least two first functional modules, the resource files related to the codes respectively corresponding to the at least two first functional modules, and the configuration files of the codes respectively corresponding to the at least two first functional modules from the modular code file of the application; Integrating the codes respectively corresponding to the at least two first functional modules, the resource files related to the codes respectively corresponding to the at least two first functional modules, and the configuration files of the codes respectively corresponding to the at least two first functional modules to obtain a second code file; Allocating a first process to the second code file and allocating process resources to the first process.
10. The method according to claim 7, wherein The step of, when the application is started, allocating a first process based on the code corresponding to the first functional module and allocating process resources to the first process includes: When the application is started, determining the page layout file of the first functional module according to the control corresponding to the entry of the first functional module, and extracting the code corresponding to the first functional module and the second code coupled with the code corresponding to the first functional module; Performing a compilation process on the page layout file of the first functional module, the code corresponding to the first functional module, and the second code coupled with the code corresponding to the first functional module to obtain a third code file; Allocating a first process to the third code file and allocating process resources to the first process.
11. A process management device, characterized in that, It includes: A first allocation module, configured to allocate a first process according to the first code of the application and allocate process resources to the first process when the application is in a first running state; Wherein, the first code is a part of the code of the application.
12. The device according to claim 11, wherein, The first running state is an abnormal running state, and the first code is the code corresponding to the abnormal running module of the application; The device further includes: A second allocation module, configured to allocate a main process to the application and allocate process resources to the main process when the application is started; The first allocation module is specifically configured to: In the case where the application is in an abnormal running state, extract the code corresponding to the abnormal running module of the application from the main process, allocate a first process based on the code corresponding to the abnormal running module of the application, and allocate process resources to the first process.
13. The device according to claim 11, wherein, The first code is the code corresponding to the first functional module of the application; the usage frequency of the function corresponding to the first functional module is greater than a preset usage frequency. The first allocation module is specifically used for: When starting the application, allocate a first process based on the code corresponding to the first functional module, and allocate process resources to the first process.
14. An electronic device, characterized in that, It includes a processor and a memory. The memory stores a program or instruction that can run on the processor. When the program or instruction is executed by the processor, it implements the steps of the process management method according to any one of claims 1 to 10.
15. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium. When the program or instruction is executed by a processor, it implements the steps of the process management method according to any one of claims 1 to 10.