Terminal and application cold starting method

By adjusting the loading order of the class loader, the problem of slow cold start speed of the application is solved, and the effect of improving class loading efficiency and reducing redundant search for branches is achieved.

CN119917178APending Publication Date: 2025-05-02JUHAOKAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411865927.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

During cold startup, the class loader's parent delegation mechanism causes low class loading efficiency and high redundancy, which affects the cold startup speed.

Method used

By obtaining the first sorting result and the second sorting result of the class loader, adjust the loading order to optimize the loading order of the class loader, reduce redundant search branches, and improve the efficiency of class search and class loading.

Benefits of technology

The cold start speed of the application is improved, and by optimizing the loading order of the class loader, redundant search branches during the class loading process are reduced, and the efficiency of class search and class loading is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917178A_ABST
    Figure CN119917178A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a terminal and an application cold starting method. When the terminal performs cold start on the application, the loading sequence of the class loader is obtained through a first sorting result determined by the native delegation sequence of the class loader and a second sorting result determined by the number of the to-be-loaded classes needing to be loaded by the class loader, so that the class loader is controlled to load the classes needed by application operation according to the loading sequence. According to the embodiment of the invention, the terminal optimizes the loading sequence of the class loader, so that redundant search branches in the class loading process can be reduced, the class search and class loading efficiency is improved, and the cold start speed of the application is favorably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of terminal technology, and in particular, relates to a terminal and application cold start method. Background Art

[0002] When using a terminal, a user can start an application provided by the terminal to interact with the terminal or obtain media data through the application. An application can integrate multiple business plug-ins, which can extend the application's functions to increase the application's flexibility and scalability. Therefore, when the application is cold started, the class loader needs to load the classes required for the business plug-in to run so that the application can run normally.

[0003] In the process of loading classes through the class loader, the class loader can follow the parent delegation mechanism to search and load the required classes. Among them, when loading a class, the child class loader needs to first send a request to query the class to the parent class loader. When the parent class loader finds the class required by the child class loader, it can directly load the class. When the parent class loader does not find the class required by the child class loader, the child class loader will query the class by itself. This query method will not load classes repeatedly and can reduce the probability of missing classes, but the efficiency of query and loading is low.

[0004] In addition, the host class loader usually has already loaded the commonly used system classes. Therefore, when the plug-in class loader queries and loads the business classes based on the parent delegation mechanism, it also needs to follow the query order of system class loader query, host class loader query, and plug-in class loader query, which will affect the efficiency of the host class loader in processing the loaded system classes, resulting in low overall class loading efficiency and high redundancy, and slow application cold start speed. Summary of the invention

[0005] The embodiment of the present application provides a terminal and application cold start method to solve the problem of slow application cold start speed.

[0006] In a first aspect, the present application provides a terminal, comprising: a display and a controller. The controller is configured to:

[0007] In response to a startup instruction for cold starting a target application, a first sorting result and a second sorting result of a class loader required for cold starting the target application are obtained; the first sorting result is a sorting result determined according to a parent delegation mechanism of the class loader; the second sorting result is used to characterize a transition loading order of the class loader loading a to-be-loaded class; the second sorting result includes first data and second data arranged according to a numerical value relationship; the first data includes the number of classes to be loaded that the class loader hits based on cached class information; the second data includes the number of classes to be loaded that the class loader does not hit based on cached class information;

[0008] According to the first sorting result, the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result is adjusted to obtain a loading order so that the second data corresponding to the child class loader in the parent delegation class loader is located after the first data and the second data corresponding to the parent class loader; the parent delegation class loader includes the class loader corresponding to the first sorting result;

[0009] Control the class loader to load the class to be loaded according to the loading order;

[0010] When the class loader is loaded, start the target application.

[0011] In this way, the terminal can obtain a mixed sorting result based on the first sorting result and the second sorting result, and determine the loading order according to the mixed sorting result. By optimizing the loading order of the class loader, the redundant search branches of the class loader in the process of searching for classes can be reduced, thereby improving the class search efficiency and class loading efficiency, which is conducive to improving the cold start speed of the application.

[0012] In some feasible implementations, the controller executes, in response to a startup instruction for cold-starting a target application, obtaining a first sorting result of a class loader associated with the target application, and is specifically configured as follows:

[0013] Obtain the parent delegation class loader required for the target application cold start; the parent delegation class loader includes the system class loader and the host class loader; the system class loader is the parent access object of the host class loader;

[0014] According to the delegation relationship between the system class loader and the host class loader, the arrangement order of the first data and the second data corresponding to the system class loader and the host class loader is set to obtain a first sorting result, so that the second data corresponding to the host class loader is located at the last position of the first sorting result.

[0015] In this way, the native delegation mechanism of the system class loader and the host class loader is retained in the first sorting result. During the application startup process, the system class loader and the host class loader are adjacent parent-child class relationships, which will not generate too many redundant search branches and the search path will be shorter. In addition, the loading order of important classes can still be maintained to ensure the normal operation of the application.

[0016] In some feasible implementations, the first data includes a first count value and a first ID, the first count value is used to record the number of classes to be loaded whose hit status required by the class loader is the first hit status; the second data includes a second count value and a second ID, the second count value is used to record the number of classes to be loaded whose hit status required by the class loader is the second hit status; the initial values ​​of the first count value and the second count value are both 0; the controller executes in response to a startup instruction for cold starting the target application, and obtains a second sorting result of the class loader associated with the target application, and is specifically configured as follows:

[0017] Acquire a first counting sequence and a second counting sequence; the first counting sequence includes at least one first counting value; the second counting sequence includes at least one second counting value;

[0018] Sorting the first count value and the second count value according to the numerical values ​​of the first count value and the second count value to obtain a numerical sorting result;

[0019] Based on the numerical sorting result, the arrangement order of the first ID corresponding to the first count value and the second ID corresponding to the second count value is set to obtain a second sorting result.

[0020] In this way, the first counting sequence and the second counting sequence can be used to respectively count the first counting values ​​of the classes already cached in multiple class loaders and the second counting values ​​of the classes to be queried, so that the corresponding classes can be loaded preferentially according to the information of the classes cached by the class loader, thereby improving the class loading efficiency of the class loader.

[0021] In some feasible implementations, before the controller executes the acquisition of the first count sequence and the second count sequence corresponding to the class loader, the controller is further configured to:

[0022] Create a counting array; the counting array includes counting units, each class loader corresponds to two counting units; one counting unit is used to record the first counting value; and the other counting unit is used to record the second counting value;

[0023] When the hit status of the current class to be loaded is the first hit status, controlling the first count value corresponding to the class loader that needs to load the current class to be loaded to be increased by 1; if there is no class with the hit status of the first hit status in the subsequent classes to be loaded, generating a first count sequence according to the first count values ​​corresponding to each class loader;

[0024] When the hit status of the current class to be loaded is the second hit status, the second count value corresponding to the class loader that needs to load the current class to be loaded is controlled to be increased by 1; if there is no class with a hit status of the second hit status in the subsequent classes to be loaded, a second count sequence is generated according to the second count values ​​corresponding to each class loader.

[0025] In this way, the process of class loading by the class loader can be recorded in real time through the counting array, and the number of classes in the two hit states required by the class loader can be recorded, so as to obtain the second sorting result by sorting according to the number of classes.

[0026] In some feasible implementations, the controller executes creating a count array and is further configured to:

[0027] If the current class to be loaded is a class to be loaded that is hit by the class loader based on the cached class information, then the hit state of the current class to be loaded is marked as the first hit state;

[0028] If the current class to be loaded is a class to be loaded that is not hit by the class loader based on the cached class information, the hit state of the current class to be loaded is marked as the second hit state.

[0029] In this way, the name of the class to be loaded can be used to query whether there is an identical class in the class information already cached by the class loader, and then the hit status of the class to be loaded can be marked according to the query result, and then the class to be loaded can be classified to update the first count value or the second count value according to the classification result of the class to be loaded.

[0030] In some feasible implementations, the controller performs sorting on the first count value and the second count value according to the numerical values ​​of the first count value and the second count value to obtain a second sorting result, which is specifically configured as follows:

[0031] According to the magnitude of the first count value and the second count value, performing a primary sort on the first count value in the first count sequence and the second count value in the second count sequence to obtain a second sub-sort result;

[0032] If the first count value and the second count value belonging to the same class loader are the same, the first ID corresponding to the first count value belonging to the same class loader is set at the leading position of the second ID corresponding to the second count value belonging to the same class loader;

[0033] If in the second sub-sorting result, the first ID of the same class loader is located after the second ID, the first ID is adjusted to the preceding position of the second ID to obtain a second sorting result; the first ID is adjacent to the second ID.

[0034] In this way, the second sorting result can be determined according to the first count value and the second count value corresponding to each class loader. And the class loader is controlled to load the class according to the second sorting result. By setting the first ID corresponding to the first count value of the same class loader before the second ID corresponding to the second count value, the class loader can be controlled to preferentially load the cached class to be loaded, which is conducive to improving the class loading efficiency.

[0035] In some feasible implementations, the controller adjusts the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result according to the first sorting result, and is specifically configured as follows:

[0036] According to the first sorting result, the second ID corresponding to the host class loader is adjusted to a post-sequence position of the first ID and the second ID corresponding to the system class loader to obtain the loading order.

[0037] In this way, the order of important class loading can be maintained and the normal operation of applications can be maintained on the basis of retaining the parent delegation mechanism of the host class loader and the system class loader. Based on the division of the two methods of class loading, the host class loader can be controlled to load the cached classes first, which is conducive to improving the efficiency of class loading.

[0038] In some feasible implementations, the class loader further includes a plug-in class loader; the controller executes the control of the class loader to load the class to be loaded according to the loading order, and is specifically configured as follows:

[0039] If the current class to be loaded is a duplicate class, the plug-in class loader is prohibited from loading the duplicate class, and the control system class loader is prohibited from loading the duplicate class; the duplicate class is the class to be loaded corresponding to the plug-in class loader and the system class loader, and the class name of the duplicate class in the plug-in class loader and the system class loader is different.

[0040] In this way, in the process of controlling the class loader to load classes, by searching for the overwritten class and deleting the overwritten class corresponding to the business class loader, it is possible to avoid the problem of the same class having multiple names when the application loads the overwritten class, resulting in application startup exceptions due to the same class being loaded by different class loaders.

[0041] In some feasible implementations, the controller is further configured to:

[0042] If the class to be loaded replicated by the plug-in class loader includes the class to be loaded replicated by the system class loader, and the replicated class is the class to be loaded required by the plug-in class loader, the replicated classes of the plug-in class loader and the system class loader are packaged to obtain a replicated class data packet;

[0043] Load the replicated class data package into the host class loader.

[0044] In this way, by packaging the overwritten class into the host class loader, it is possible to prevent the host class loader from accessing the class to be loaded from the system class loader. As the class to be loaded is a overwritten class, after the host class loader loads the overwritten class, the application startup exception occurs because the class names of the overwritten class in the host class loader and the business class loader are different.

[0045] In a second aspect, an embodiment of the present application provides an application cold start method, including:

[0046] In response to a startup instruction for cold starting a target application, a first sorting result and a second sorting result of a class loader required for cold starting the target application are obtained; the first sorting result is a sorting result determined according to a parent delegation mechanism of the class loader; the second sorting result is used to characterize a transition loading order of classes to be loaded by the class loader; the second sorting result includes first data and second data arranged according to a numerical value relationship; the first data includes the number of classes to be loaded that the class loader hits based on cached class information; the second data includes the number of classes to be loaded that the class loader does not hit based on cached class information;

[0047] According to the first sorting result, the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result is adjusted to obtain a loading order so that the second data corresponding to the child class loader in the parent delegation class loader is located after the first data and the second data corresponding to the parent class loader; the parent delegation class loader includes the class loader corresponding to the first sorting result;

[0048] Control the class loader to load the class to be loaded according to the loading order;

[0049] When the class loader is loaded, start the target application.

[0050] In this way, the terminal can adopt the application cold start method provided by the embodiment of the second aspect, and optimize the loading order of the class loader to load the class, so as to reduce the redundant branches and search paths generated by the class loader when searching for the class. In this way, the efficiency of the class loader loading the class is improved, and the speed of the application cold start can be improved.

[0051] It can be seen from the above technical content that an embodiment of the present application provides a terminal and application cold start method. When the terminal cold starts the application, the loading order of the class loader is obtained through the first sorting result determined by the native delegation order of the class loader and the second sorting result determined by the number of classes to be loaded by the class loader, so as to control the class loader to load the classes required for the application to run according to the loading order. By optimizing the loading order of the class loader, the terminal can reduce redundant search branches in the class loading process, improve the efficiency of class search and class loading, and help to improve the cold start speed of the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0053] Figure 1 A schematic diagram of a display interface of a terminal provided in an embodiment of the present application;

[0054] Figure 2 A timing diagram of a class loader provided in an embodiment of the present application querying a class to be loaded based on a parent delegation mechanism;

[0055] Figure 3 A timing diagram of starting a target application based on an optimized class loader loading sequence provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of a counting array provided in an embodiment of the present application;

[0057] Figure 5 A flow chart for generating a second sorting result provided in an embodiment of the present application;

[0058] Figure 6 A schematic diagram of a counting process of a counting array provided in an embodiment of the present application;

[0059] Figure 7 A flowchart of counting hit states according to a class to be loaded provided in an embodiment of the present application;

[0060] Figure 8 A schematic diagram of a second sorting result adjustment process provided in an embodiment of the present application;

[0061] Fig. 9 A flowchart of the replication process provided in the embodiment of the present application;

[0062] Fig.10 A flow chart of the application cold start method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] The following embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following embodiments do not represent all implementations consistent with the present application. They are only examples of systems and methods consistent with some aspects of the present application as detailed in the claims.

[0064] like Figure 1 As shown, when using a terminal, a user can perform interactive actions with the terminal or obtain media data by starting an application installed in the terminal. For example, when the terminal is a TV, the user can start application A in the TV to obtain media data of movies through application A. After receiving a start instruction input by the user to start application A, the TV can control application A to start.

[0065] It is understandable that some applications in the TV are not started before the user enters the start command. Therefore, the process of the TV starting such applications specified by the user is a cold start process. When the application is cold started, it is necessary to run various service plug-ins integrated in the application itself to expand the functions of the application through various service plug-ins. Furthermore, when the application is running the service plug-in, it is necessary to call the plug-in class loader to load the class required for the service plug-in to run.

[0066] Among them, during the class loading process, the terminal can follow the parent delegation mechanism to control the class loader to load the required class. Figure 2 As shown, the terminal needs to call the system class loader, host class loader, and plug-in class loader during the cold start process of application A, wherein the system class loader is the parent of the host class loader and the plug-in class loader, and the host class loader is the parent of the plug-in class loader.

[0067] In this way, when the terminal controls the plug-in class loader to load the required class, after the plug-in class loader determines the target class to be loaded, it will send a message to the host class loader that the target class needs to be loaded, and then the host class loader will process the target class required by the plug-in class loader. On the basis of having a parent class loader, the host class loader will continue to send a message to the system class loader to load the target class, and the system class loader will query the class. In this way, when the system class loader queries the target class, it will directly load the target class. When the system class loader does not query the target class, it will feedback the message that the target class has not been found to the host class loader, and the host class loader can start to query the target class. When the host class loader queries the target class, the target class can be loaded. When the host class loader does not query the target class, it can feedback the message that the target class has not been found to the plug-in class loader, and the business plug-in class will actively query the target class.

[0068] Therefore, during the cold start of the terminal application, the query mechanism based on parent delegation can prevent each class loader from repeatedly loading the target class. However, during the process of the class loader querying the target class, it needs to request and feedback step by step, which increases the query path length of the class loader and increases the query branches. This leads to a slow cold start of the application.

[0069] Moreover, during the cold start of an application, for example, some commonly used system classes and basic business classes have already been loaded in the host class loader. This mechanism itself can improve the efficiency of the host class loader in loading, verifying, and initializing classes, but when controlling the plug-in class loader to load the target class based on the parent delegation mechanism, the host class loader also needs to process the message sent by the plug-in class loader for loading the target class, which will affect the host class loader's processing efficiency for classes that have already been loaded or cached, resulting in a slower cold start of the application.

[0070] In order to solve the above problems, some embodiments of the present application provide a terminal, which includes: a display and a controller. The terminal can be a tablet computer, a mobile phone, a desktop computer, a display device (including a TV). The terminal can display a user interface through the display so that the user can perform multiple operations such as selecting the content they want to watch, calling a setting menu for setting terminal parameters, and starting a target application through the user interface. Among them, the display can display icons corresponding to multiple target applications in the user interface, so that the user can select the target application through focus selection, voice selection and other methods to start the target application, and then obtain media data through the target application or perform interactive actions that the target application can provide with the terminal.

[0071] In some embodiments, when the terminal receives a startup instruction input by the user through the control device, it can perform a cold start on the application that is not started, so as to provide the user with the service required by the user through the target application. Figure 3 As shown, the controller is configured as:

[0072] S100: In response to a start instruction for cold starting a target application, obtaining a first sorting result and a second sorting result of class loaders required for cold starting the target application.

[0073] In some embodiments, after receiving the start instruction, the terminal can determine the target application corresponding to the start instruction. In this way, the terminal can obtain the service plug-in integrated with the target application and determine the class loader required for the service plug-in to run according to the service plug-in.

[0074] In some embodiments, the terminal can obtain the target application during the cold start process to control the system class loader, host class loader, plug-in class loader query and access the target class. Among them, the system class loader can load system classes, such as classes in JDK (Java Development Kit, Java Tool Development Kit) and classes in Framework. The host class loader can be a class loader that has been hooked (hook processing, used for extension or host class loader) and is used to load the host terminal code. The host terminal code refers to the code loaded by the host class loader and running in the host application. The core functions and business logic of the host application can be run based on the host terminal code. The plug-in class loader is used to load the code in the plug-in, such as player code, platform plug-in code, and business operation code. The code loaded by the host class loader and the plug-in class loader is part of the class that needs to be loaded.

[0075] After obtaining the class loader corresponding to the target application, the terminal can control the class loader to load the class that needs to be loaded for the cold start of the target application. It should be noted that in some embodiments of the present application, parent delegation class loaders and non-parent delegation class loaders are included. Among them, the parent delegation class loader can be a system class loader and a host class loader. The system class loader and the host class loader still load the classes to be loaded according to the parent delegation mechanism to improve the loading security of important classes to be loaded, and ensure the orderliness when loading these classes. Therefore, based on the parent delegation mechanism of the system class loader and the host class loader, the first sorting result can be obtained.

[0076] In some embodiments, the controller executes a target instruction corresponding to a target application for cold starting, and obtains a first sorting result of a class loader associated with the target application, and is specifically configured as follows:

[0077] Gets the parent delegation class loader required for cold start of the target application.

[0078] According to the delegation relationship between the system class loader and the host class loader, the arrangement order of the first data and the second data corresponding to the system class loader and the host class loader is set to obtain a first sorting result, so that the second data corresponding to the host class loader is located at the last position of the first sorting result.

[0079] In some embodiments, the system class loader is the parent access object of the host class loader. The delegation relationship here is a parent delegation mechanism. This means that when loading a class, the host class loader can first send a loading request to the system class loader, and the system class will first query and load the class to be loaded. If the system class fails to query the class to be loaded, the host class loader will query and load the class to be loaded.

[0080] It should be noted that in some embodiments, the terminal does not completely control the class loader to load the class to be loaded based on the parent delegation mechanism, but divides the loading method of the class loader into two parts, one part is that the class loader queries and loads the class to be loaded based on the cached class information, and the other part is that the class loader queries and loads the class to be loaded based on the uncached class information. That is, loadClass (loading method based on the parent delegation mechanism) is split into findLoadedClass (loading method based on the cached class information of the class loader) and findClass (custom loading method).

[0081] The cached class information here refers to the parent class information, interface information, method information, etc. of the class to be loaded that is pre-loaded in the class loader. Therefore, the class loader can quickly load the corresponding class to be loaded according to the cached class information.

[0082] Take the example that the class loaders required for the cold start of the target application in some embodiments include the platform class loader, the system class loader, the plug-in class loader, and the host class loader. The custom class loading method adopted by the platform class loader and the plug-in class loader can realize the query and loading of the class to be loaded by reading the bytecode of the class to be loaded from the file system, the network and some resources. However, in some embodiments, the custom class loading method corresponding to the system class loader and the host class loader is still a method that complies with the parent delegation mechanism. To ensure that the core class library will not be loaded by the custom class loaders such as the plug-in class loader and the platform class loader, it is beneficial to maintain the security and consistency of the operating platform where the target application is located.

[0083] Therefore, in some embodiments, the terminal can set the second data corresponding to the host class loader to the last position in the first sorting result according to the delegation relationship between the system class loader and the host class loader, so as to ensure that the system class loader and the host class loader can still maintain the parent delegation mechanism. In addition, the terminal can also adjust the positions of the first data and the second data corresponding to each class loader in the second sorting result according to the first sorting result, so that in the loading order, the system class loader and the host class loader can still maintain the parent delegation mechanism.

[0084] It should be noted that in the first sorting result, the first data corresponding to the host class loader, the first data corresponding to the system class loader, and the second data can still be sorted according to the numerical value. That is, the purpose of the first sorting result is to set the second data corresponding to the host class loader to the last position to retain the parent delegation mechanism of the host class loader and the system class loader, and to enable the parent delegation mechanism of the host class loader and the system class loader to still be retained in the loading order.

[0085] In some embodiments, the terminal also needs to obtain a second sorting result of the class loader to determine the order in which the class loader loads the classes to be loaded according to the first sorting result and the second sorting result. The second sorting result includes first data and second data arranged according to the numerical value relationship. The first data includes the number of classes to be loaded that the class loader hits based on the cached class information, and the second data includes the number of classes to be loaded that the class loader does not hit based on the cached class information.

[0086] It is understandable that the class loader loads the class to be loaded faster when it loads the class to be loaded according to the cached class information than when it loads the class to be loaded without the cached class information. Therefore, by splitting the loading method based on the parent delegation mechanism, the loading speed of the class loader can be improved by giving priority to the class loader to load the class to be loaded according to the cached class information.

[0087] In this way, each class loader can query and load the class to be loaded through these two query methods during the process of loading the class to be loaded. Among them, the first data may include the number of classes to be loaded that the class loader hits based on the cached class information, and the second data may include the number of classes to be loaded that the class loader hits not based on the cached class information but through other query methods. It can be understood that different class loaders can query the class to be loaded through these two methods, and the efficiency of the class loader querying the class can be determined based on the first data and the second data of different class loaders, as well as the sorting of the loading order of the class loader, thereby optimizing the loading order of the class loader, which is conducive to improving the loading efficiency of the class loader.

[0088] In some embodiments, Figure 5 As shown, the controller executes a startup instruction corresponding to the cold-start target application to obtain a second sorting result of the class loader associated with the target application, and is specifically configured as follows:

[0089] A first count sequence and a second count sequence are obtained.

[0090] The first count value and the second count value are sorted according to the numerical values ​​of the first count value and the second count value to obtain a numerical sorting result.

[0091] Based on the numerical sorting result, the arrangement order of the first ID corresponding to the first count value and the second ID corresponding to the second count value is set to obtain a second sorting result.

[0092] It is understandable that the first counting sequence includes at least one first counting value, and the second counting sequence includes at least one second counting value. The first counting value here refers to the number of classes to be loaded that the class loader hits based on the cached class information. The target application cold start corresponds to several class loaders, and the first counting sequence contains several first counting values. For example, the target application cold start corresponds to the system class loader, the host class loader, the plug-in class loader, and the platform class loader. Then the first counting sequence includes 4 first counting values ​​corresponding to the system class loader, the host class loader, the plug-in class loader, and the platform class loader. Similarly, the second counting sequence also includes 4 second counting values ​​corresponding to the system class loader, the host class loader, the plug-in class loader, and the platform class loader.

[0093] After obtaining the first count sequence and the second count sequence, the terminal can perform mixed sorting of the first count value and the second count value according to the numerical relationship between the first count value and the second count value to obtain a numerical sorting result. The numerical relationship can be the size of the numerical value. In addition, the first data also includes a first ID, and the second data also includes a second ID, so that different class loaders can be distinguished by the first ID and the second ID, as well as the query class corresponding to different class loaders. The first ID and the second ID can be sorted according to the numerical sorting result of the first count value and the second count value, so that the second sorting result obtained by sorting the first ID and the second ID represents the loading order of the class loaders.

[0094] In some embodiments, the first IDs of the platform class loader, the system class loader, the plug-in class loader, and the host class loader can be set to a0, b0, c0, and d0 respectively; the second IDs of the platform class loader, the system class loader, the plug-in class loader, and the host class loader can be set to a1, b1, c1, and d1 respectively. Among them, a0=200, a1=300, b0=0, b=0, c0=1000, c1=5000, d0=2000, and d1=100.

[0095] In this way, the numerical sorting result obtained by sorting the first numerical value and the second numerical value may be {5000, 2000, 1000, 300, 200, 100, 0, 0}. Then, the sorting result of the first ID and the second ID corresponding to the first numerical value and the second numerical value may be determined according to the numerical sorting result, that is, the second sorting result {c1, d0, c0, a1, a0, d1, b0, b1}.

[0096] The terminal counts the number of times each query method used by the class loader hits the class to be loaded, and determines the second sorting result based on the statistical result, which can effectively optimize the loading order of the class loader when loading the class to be loaded in combination with the actual loading efficiency of the class loader. This can improve the loading speed of the class loader and the speed of cold start of the target application.

[0097] In some embodiments, the terminal can record the number of times the class loader hits the class to be loaded through various query methods through a counting array. Figure 6 As shown, before the controller executes to obtain the first counting sequence and the second counting sequence corresponding to the class loader, it is also configured as follows:

[0098] Create an array of counts.

[0099] When the hit status of the current class to be loaded is the first hit status, controlling the first count value corresponding to the class loader that needs to load the current class to be loaded to be increased by 1; if there is no class with the hit status of the first hit status in the subsequent classes to be loaded, generating a first count sequence according to the first count values ​​corresponding to each class loader;

[0100] When the hit status of the current class to be loaded is the second hit status, the second count value corresponding to the class loader that needs to load the current class to be loaded is controlled to be increased by 1; if there is no class with a hit status of the second hit status in the subsequent classes to be loaded, a second count sequence is generated according to the second count values ​​corresponding to each class loader.

[0101] like Figure 4 As shown, the counting array includes counting units, because each class loader includes two ways of querying the class to be loaded in some embodiments, so each class loader corresponds to two counting units, one of which is used to record the first counting value, and the other two are used to record the second counting value. That is, the number of counting units included in the counting array is twice the number of class loaders.

[0102] In some embodiments, the first count value, the first count ID, the second count value, and the second count ID can be stored in a count array in a corresponding relationship. The initial values ​​of the first count value and the second count value are both 0.

[0103] It is understandable that the terminal can mark the hit status of the class to be loaded according to the result of the class loader querying the class to be loaded through the query method, and then distinguish the query method adopted by the class loader through the hit status of the class to be loaded, so as to facilitate the adjustment of the first count value and the second count value corresponding to the class loader. Figure 7 As shown, the controller executes the creation of the count array and is also configured as:

[0104] If the current class to be loaded is a class to be loaded that is hit by the class loader based on the cached class information, the hit state of the current class to be loaded is marked as the first hit state.

[0105] If the current class to be loaded is a class to be loaded that is not hit by the class loader based on the cached class information, the hit state of the current class to be loaded is marked as the second hit state.

[0106] In some embodiments, the class to be loaded with a hit status of the first hit status refers to the class that the class loader has queried through the cached class information. The class to be loaded with a hit status of the second hit status refers to the class that the class loader has queried without using the cached class information. When the class loader queries the class to be loaded in two query modes, the first count value and the second count value in the count array can be updated according to the class query result of the class loader.

[0107] For example, when the terminal detects that the plug-in class loader has queried the class to be loaded through the cached class information, the first count value corresponding to c0 in the count array can be adjusted from 0 to 1. In this way, the terminal can record the number of classes to be loaded that each class loader has queried through the cached class information through the count array. Similarly, the terminal can also record the number of classes to be loaded that each class loader has queried through other methods through the count array, which will not be repeated here.

[0108] When any class loader cannot find the class to be loaded through one of the query methods, the count value corresponding to the query method of this class loader will not be adjusted. Furthermore, when all class loaders required for the cold start of the target application cannot find the class to be loaded through one of the query methods, a count sequence corresponding to this query method can be generated.

[0109] It is understandable that the class loader will query in combination with the preset query time and query path during the process of querying the class to be loaded. When the query time or query path is exhausted, if the class loader still has not queried the class to be loaded according to the corresponding query method, the class loader needs to change the query method and re-query the class to be loaded. For example, when the plug-in class loader searches for the class to be loaded according to the preset query path in the cached class information, the class to be loaded is not found through the preset query path, then the class loader needs to change the query method and no longer query the class to be loaded according to the cached class information.

[0110] Thus, in some embodiments, the terminal can determine whether to generate the first counting sequence and the second counting sequence corresponding to the query method in combination with the query progress of the class loader. For example, when the platform class loader, the system class loader, the plug-in class loader, and the host class loader are in the process of querying the class to be loaded based on the cached class information, they can no longer query the class to be loaded through the cached class information, then the terminal can generate the first counting sequence to complete the statistics of the first counting values ​​of each class loader.

[0111] Similarly, when these class loaders can no longer query the to-be-loaded class through the customized query method, the terminal can generate a second counting sequence to complete the statistics of the second counting values ​​of each class loader.

[0112] After generating the first counting sequence and the second counting sequence, the terminal may sort the first counting values ​​in the first counting sequence and the second counting values ​​in the second counting sequence according to the numerical relationship.

[0113] like Figure 8 As shown, the controller performs sorting on the first count value and the second count value according to the numerical values ​​of the first count value and the second count value to obtain a second sorting result, which is specifically configured as follows:

[0114] According to the magnitude of the first count value and the second count value, performing a primary sort on the first count value in the first count sequence and the second count value in the second count sequence to obtain a second sub-sort result;

[0115] If the first count value and the second count value belonging to the same class loader are the same, the first ID corresponding to the first count value belonging to the same class loader is set at the leading position of the second ID corresponding to the second count value belonging to the same class loader;

[0116] If in the second sub-sorting result, the first ID of the same class loader is located after the second ID, the first ID is adjusted to the preceding position of the second ID to obtain a second sorting result; the first ID is adjacent to the second ID.

[0117] In some embodiments, sorting can be performed according to the size of the numerical value. For example, the first count value and the second count value corresponding to the platform class loader, the system class loader, the plug-in class loader, and the host class loader are respectively: a0=200, a1=300, b0=0, b=0, c0=1000, c1=5000, d0=2000, d1=100. In this way, the arrangement order of the second sub-sorting result {c1, d0, c0, a1, a0, d1, b0, b1} can be obtained by sorting in order from large to small. Because the numerical values ​​of the first count value and the second count value can reflect the efficiency of the query method adopted by the class loader, the larger the count value, the more efficient the corresponding query method is. Therefore, the method of sorting in order from large to small is more suitable for application scenarios that improve the efficiency of class loaders.

[0118] Using the second sub-sorting result {c1, d0, c0, a1, a0, d1, b0, b1} obtained in the above embodiment, the values ​​of the first count value and the second count value corresponding to the same class loader may be the same, so the second sub-sorting result needs to be improved based on the second sub-sorting result.

[0119] For example, when the first count value and the second count value corresponding to a0 and a1 are the same, a0 can be set in the leading position of a1 in the second sub-sorting result. Because the query method corresponding to a0 is to query the class to be loaded based on the cached class information, the query method corresponding to a0 is more efficient than the query method corresponding to a1. By setting a0 in the leading position of a1, the class loader can preferentially query the class to be loaded based on the query method of the cached class information, which is beneficial to improving the efficiency of the class loader loading classes.

[0120] In some embodiments, based on the high efficiency of querying the class to be loaded through the cached class information, the first ID and the second ID in the second sub-sorting result can continue to be adjusted. That is, when the first ID corresponding to the same class loader is located after the second ID, the first ID is set in the pre-order position of the second ID in the second sub-sorting result. For example, in the second sub-sorting result, c1 is located in the pre-order position of c0, and c0 can be set in the pre-order position of c1 through adjustment. In this way, the second count value corresponding to c1 is large, which can indicate that the plug-in class loader has a high efficiency through the query method corresponding to c1, so it can be ranked in the pre-order position of the second sub-sorting result. On this basis, c0 is set in the pre-order position of c1, based on the high efficiency of the query method corresponding to c0, which is based on the query efficiency of the cached class information query, it will not affect the query efficiency of the class loader, but can improve the overall loading efficiency of the class loader by preferentially controlling the class loader to query the class to be loaded according to the cached class information.

[0121] In this way, the second sub-sorting result is fine-tuned according to the numerical relationship between the first count value and the second count value of the class loader and the corresponding query method, and the second sorting result {c0, c1, d0, a0, a1, d1, b0, b1} is obtained. Based on this sorting method, the loading efficiency of the class loader can be further improved.

[0122] S200: Adjust the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result according to the first sorting result to obtain a loading order so that the second data corresponding to the child class loader in the parent delegation class loader is located after the first data and the second data corresponding to the parent class loader.

[0123] It is understandable that when the sorting method of the first sorting result and the sorting method of the second sorting result have an adaptive relationship, it is easier to modify the second sorting result according to the first sorting result. For example, when the second sorting result is arranged in order from large to small values, the first sorting result is also arranged in the order of parent first and child last. In this way, the second sorting result can be adjusted directly through the delegation relationship represented by the first sorting result.

[0124] In some embodiments, based on the second sorting result, the second sorting result needs to be adjusted according to the delegation relationship between the system class loader and the host class loader to ensure that the system class loader and the host class loader can still follow the parent delegation mechanism in the second sorting result to ensure the security and orderliness of core class loading.

[0125] The second sorting result {c0, c1, d0, a0, a1, d1, b0, b1} in the above embodiment is used, d0 corresponds to the method by which the host class loader queries the class to be loaded based on the cached class information, but the host class loader must also follow the parent delegation mechanism to send a loading request to the system class loader before querying the class to be loaded based on the cached class information, and d1 corresponds to the method by which the host class loader queries the class to be loaded based on the parent delegation mechanism. b0 corresponds to the method by which the system class loader queries the class to be loaded based on the cached class information, and b1 corresponds to the method by which the system class loader queries the class to be loaded based on the custom loading method. At this time, the second sorting result can be adjusted according to the delegation relationship between the system class loader and the host class loader represented by the first sorting result. That is, the controller adjusts the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result according to the first sorting result, and is specifically configured as follows:

[0126] According to the first sorting result, the second ID corresponding to the host class loader is adjusted to a subsequent position of the first ID and the second ID corresponding to the system class loader to obtain a loading order.

[0127] In some embodiments, the first sorting result can be obtained by arranging the upper and lower levels of the delegation relationship, and the terminal can determine that the system class loader is the parent of the host class loader when obtaining the first sorting result. Therefore, the terminal can adjust the positions of b0, b1, d0, and d1 in the second sorting result on the basis that the system class loader is the parent of the host class loader.

[0128] For example, in the second sorting result, d1 corresponding to the host class loader is set in the post-order position of b0 and b1 corresponding to the system class loader. Because d1 corresponds to the query method of the host class loader to query the class to be loaded based on the parent delegation mechanism, d1 can be set in the post-order position in the second sorting result to give priority to the more efficient class query method.

[0129] It should be noted that the reason why d0 can be set in the leading position in the second sorting result is that d0 corresponds to the host class loader first executing the parent delegation mechanism and then executing the query method of querying the class to be loaded based on the cached class information. The prerequisite for the host class loader to execute d0 is that when the system class loader receives the loading request from the host class loader, it fails to find the class corresponding to the loading request, so the host class loader needs to execute the query method of querying the class to be loaded based on the cached class information. That is, when the value corresponding to d0 is not 0, it means that setting d0 in the leading position of the second sorting result according to the first count value corresponding to d0 does not violate the parent delegation mechanism between the host class loader and the system class loader.

[0130] In this way, after the terminal adjusts the second sorting result according to the first sorting result, it can obtain the loading order of the class loaders associated with the cold start of the target application {c0, c1, d0, a0, a1, b0, b1, d1} when the target application is cold started.

[0131] It is understandable that by splitting the native delegation mechanism of the class loader, the class loader with high loading efficiency can be controlled to query and load the class to be loaded first. And the class loader can be controlled to query and load the class to be loaded in a way with high query efficiency. This can improve the loading efficiency of the class loader, thereby improving the cold start speed of the target application. And,

[0132] Based on the above loading order {c0, c1, d0, a0, a1, b0, b1, d1}, only the parent delegation mechanism of the host class loader and the system class loader is retained, which can ensure the orderliness and security of the core class library loading. And by only retaining the loading path between the host class loader and the system class loader, the branches of the class loader in the class query process can be effectively trimmed and the query path of the class loader in the class query process can be shortened.

[0133] S300: Controlling the class loader to load the class to be loaded according to the loading order.

[0134] It is understandable that after obtaining the optimized loading sequence, the terminal can control the class loader to load the to-be-loaded class according to the loading sequence.

[0135] In some embodiments, the loading order of the plug-in class loader may be earlier than the loading order of the system class loader, and some of the classes to be loaded required by the plug-in class loader and the system class loader may be the same. Such classes to be loaded are overwritten classes. When the overwritten class is loaded by both the plug-in class loader and the system class loader at the same time, a loading exception will occur. Therefore, the terminal needs to handle such an exception, that is, the controller executes the control class loader to load the class to be loaded according to the loading order, which is specifically configured as follows:

[0136] If the current class to be loaded is a duplicate class, the plug-in class loader is prohibited from loading the duplicate class, and the control system class loader is prohibited from loading the duplicate class; the duplicate class is the class to be loaded corresponding to the plug-in class loader and the system class loader, and the class name of the duplicate class in the plug-in class loader and the system class loader is different.

[0137] In some embodiments, the terminal can determine whether there is a duplicate class by checking the class names of the plug-in class loader and the system class loader (the package name of the data packet corresponding to the class). When the duplicate class is found, for example, when the current class to be loaded is a duplicate class, the terminal can prohibit the plug-in class loader from loading the duplicate class, or delete the duplicate class in the plug-in class loader after the plug-in class loader loads the duplicate class. And the system class loader can be controlled to load the duplicate class. In this way, only the system class loader loads the duplicate class in the class loader, which can solve the problem of loading abnormalities caused by the same class being distributed in two class loaders and having different class names.

[0138] In some embodiments, the reason for the generation of the overwritten class is that the class required by the plug-in class loader overwrites the class required by the system class loader. The class required by the system class loader may be a core class, so for example, the host class loader must also load this type of core class according to the needs of the system class loader during the cold start process of the target application. Take the example of an overwritten class with a class name of X1 in the plug-in class loader and a class name of X2 in the system class loader. The class name obtained by the host class loader when requesting the overwritten class from the system class loader is X2. The class name of the overwritten class loaded by the plug-in class loader according to the loading order is X1. In this way, the same overwritten class has different names, so after the host class loader loads X2, a loading exception will occur when performing a type check on X2, which will cause an exception in the cold start of the target application. However, when some overwritten classes are used to be compatible with different system versions, the terminal should not be able to prohibit or delete the overwritten classes in the plug-in class loader. In order to solve this problem, if Fig. 9 As shown, the controller is also configured as:

[0139] If the class to be loaded replicated by the plug-in class loader includes the class to be loaded replicated by the system class loader, and the replicated class is the class to be loaded required by the business plug-in class loader, the replicated class of the plug-in class loader and the system class loader are packaged to obtain a replicated class data packet.

[0140] Load the replicated class data package into the host class loader.

[0141] In some embodiments, when the terminal finds a replication class for compatibility with different system versions, it can package the replication class in the plug-in class loader and the system class loader to obtain a replication class data packet. The replication class data packet is further loaded into the host class loader. In this way, the host class loader loads both X1 and X2. When the host class loader requests X2 from the system class loader based on the parent delegation mechanism, since X2 no longer exists in the system class loader and X1 does not exist in the plug-in class loader, the host class can load X2 and X1 according to the replication class data packet.

[0142] Thus, taking the Java runtime environment as an example, the uniqueness of the class loaded in the host class loader is determined by the name of the class and the type of the class loader. Therefore, the terminal can regard X1 and X2 in the host class loader as two different classes, so that the host class loader can be compatible with different version requirements based on X1 and X2 provided by the overwritten class data package. And it can avoid the loading exception caused by the overwritten class during the loading process.

[0143] S400: When the class loader completes loading, start the target application.

[0144] In some embodiments, the terminal can start the target application when the class loader has loaded the corresponding class, so that the user can obtain the required media data or interact with the terminal according to the target application. Accordingly, the terminal can display the startup process and the page after startup of the target application through the display, so that the user can understand the response of the terminal to the startup instruction.

[0145] like Fig.10 As shown, some embodiments of the present application also provide an application cold start method, and the application cold start method includes:

[0146] S1: In response to a startup instruction for cold starting a target application, a first sorting result and a second sorting result of a class loader required for cold starting the target application are obtained; the first sorting result is a sorting result determined according to a parent delegation mechanism of the class loader; the second sorting result is used to characterize a transition loading order of the class loader; the second sorting result includes first data and second data arranged in numerical value relationship; the first data includes the number of classes to be loaded that are hit by the class loader based on cached class information; the second data includes the number of classes to be loaded that are not hit by the class loader based on cached class information.

[0147] S2: adjusting the arrangement order of the first data and the second data corresponding to the parent delegate class loader in the second sorting result according to the first sorting result to obtain a loading order; the native delegate class loader includes the class loader corresponding to the first sorting result.

[0148] S3: Control the class loader to load the class to be loaded according to the loading order.

[0149] S4: When the class loader completes loading, start the target application.

[0150] In some embodiments, when the terminal receives a startup instruction input by the user for cold starting the target application, the loading order of the class loader can be optimized, and the class loader can be controlled to load the classes to be loaded required for the target application to run through the optimized loading order. By splitting the native delegation mechanism and optimizing the loading order of the class loader according to the sorting result determined by the loading efficiency of the class loader, the redundant branches generated by the class loader during the loading process can be removed, and the query path of the class loader to query the classes to be loaded can be shortened, thereby improving the overall loading efficiency of the class loader, which is conducive to improving the cold start speed of the target application.

[0151] It can be seen from the above technical content that an embodiment of the present application provides a terminal and application cold start method. When the terminal cold starts the application, the loading order of the class loader is obtained through the first sorting result determined by the native delegation order of the class loader and the second sorting result determined by the number of classes to be loaded by the class loader, so as to control the class loader to load the classes required for the application to run according to the loading order. By optimizing the loading order of the class loader, the terminal can reduce redundant search branches in the class loading process, improve the efficiency of class search and class loading, and help to improve the cold start speed of the application.

[0152] Similar parts between the embodiments provided in this application can be referenced to each other. The specific implementation methods provided above are only a few examples under the general concept of this application and do not constitute a limitation on the protection scope of this application. For those skilled in the art, any other implementation methods expanded based on the scheme of this application without creative work belong to the protection scope of this application.

Claims

1. A terminal, characterized in that: include: monitor; The controller is configured as: In response to a startup instruction for cold starting a target application, obtaining a first sorting result and a second sorting result of class loaders required for cold starting the target application; the first sorting result is a sorting result determined according to a parent delegation mechanism of the class loader; The second sorting result is used to characterize the transition loading order of the class loader loading the class to be loaded; the second sorting result includes first data and second data arranged according to the numerical value relationship; the first data includes the number of classes to be loaded that the class loader hits based on the cached class information; the second data includes the number of classes to be loaded that the class loader does not hit based on the cached class information; adjusting the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result according to the first sorting result to obtain a loading order so that the second data corresponding to the child class loader in the parent delegation class loader is located after the first data and the second data corresponding to the parent class loader; the parent delegation class loader includes the class loader corresponding to the first sorting result; Controlling the class loader to load the class to be loaded according to the loading order; When the class loader completes loading, the target application is started.

2. The terminal according to claim 1, characterized in that The controller executes, in response to a start instruction for cold starting a target application, obtaining a first sorting result of a class loader associated with the target application, and is specifically configured as follows: Obtaining a parent delegated class loader required for cold start of the target application; the parent delegated class loader includes a system class loader and a host class loader; the system class loader is a parent access object of the host class loader; According to the delegation relationship between the system class loader and the host class loader, the arrangement order of the first data and the second data corresponding to the system class loader and the host class loader is set to obtain a first sorting result, so that the second data corresponding to the host class loader is located at the last position of the first sorting result.

3. The terminal according to claim 1, characterized in that: The first data includes a first count value and a first ID, the first count value is used to record the number of classes to be loaded whose hit status is the first hit status required by the class loader; the second data includes a second count value and a second ID, the second count value is used to record the number of classes to be loaded whose hit status is the second hit status required by the class loader; the initial values ​​of the first count value and the second count value are both 0; the controller executes in response to a startup instruction for cold starting a target application, and obtains a second sorting result of the class loader associated with the target application, and is specifically configured as follows: Acquire a first counting sequence and a second counting sequence; the first counting sequence includes at least one first counting value; the second counting sequence includes at least one second counting value; Sorting the first count value and the second count value according to the numerical values ​​of the first count value and the second count value to obtain a numerical sorting result; Based on the numerical sorting result, an arrangement order of the first ID corresponding to the first count value and the second ID corresponding to the second count value is set to obtain a second sorting result.

4. The terminal according to claim 3, characterized in that: Before the controller executes the acquisition of the first counting sequence and the second counting sequence corresponding to the class loader, the controller is further configured to: Creating a counting array; the counting array includes counting units, each of the class loaders corresponds to two counting units; one of the counting units is used to record the first counting value; and the other counting unit is used to record the second counting value; When the hit status of the current class to be loaded is the first hit status, controlling the first count value corresponding to the class loader that needs to load the current class to be loaded to be increased by 1; if there is no class with the hit status of the first hit status in the subsequent classes to be loaded, generating a first count sequence according to the first count values ​​corresponding to each class loader; When the hit status of the current class to be loaded is the second hit status, the second count value corresponding to the class loader that needs to load the current class to be loaded is controlled to be increased by 1; if there is no class with a hit status of the second hit status in the subsequent classes to be loaded, a second count sequence is generated according to the second count values ​​corresponding to each class loader.

5. The terminal according to claim 4, characterized in that: The controller executes the creation of a count array and is also configured to: If the current class to be loaded is a class to be loaded that is hit by the class loader based on the cached class information, marking the hit state of the current class to be loaded as a first hit state; If the current class to be loaded is a class to be loaded that is not hit by the class loader based on the cached class information, the hit state of the current class to be loaded is marked as a second hit state.

6. The terminal according to claim 3, characterized in that: The controller performs sorting on the first count value and the second count value according to the numerical values ​​of the first count value and the second count value to obtain a second sorting result, and is specifically configured as follows: sorting the first count values ​​in the first count sequence and the second count values ​​in the second count sequence according to the numerical values ​​of the first count value and the second count value to obtain a second sub-sorting result; If the first count value and the second count value belonging to the same class loader are the same, the first ID corresponding to the first count value belonging to the same class loader is set at the leading position of the second ID corresponding to the second count value belonging to the same class loader; If in the second sub-sorting result, the first ID of the same class loader is located after the second ID, the first ID is adjusted to the preceding position of the second ID to obtain a second sorting result; the first ID is adjacent to the second ID.

7. The terminal according to claim 6, characterized in that: The controller adjusts the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result according to the first sorting result, and is specifically configured as follows: According to the first sorting result, the second ID corresponding to the host class loader is adjusted to a subsequent position of the first ID and the second ID corresponding to the system class loader to obtain the loading order.

8. The terminal according to claim 1, characterized in that: The class loader also includes a plug-in class loader; the controller controls the class loader to load the class to be loaded according to the loading order, and is specifically configured as follows: If the current class to be loaded is a replicated class, the plug-in class loader is prohibited from loading the replicated class, and the control system class loader is prohibited from loading the replicated class; the replicated class is a class to be loaded corresponding to the plug-in class loader and the system class loader, and the class name of the replicated class in the plug-in class loader and the system class loader is different.

9. The terminal according to claim 8, characterized in that: The controller is also configured to: If the class to be loaded replicated by the plug-in class loader includes the class to be loaded replicated by the system class loader, and the replicated class is the class to be loaded required by the plug-in class loader, packing the replicated class of the plug-in class loader and the system class loader to obtain a replicated class data packet; The replicated class data packet is loaded into the host class loader.

10. An application cold start method, characterized in that: include: In response to a start instruction for cold starting a target application, obtaining a first sorting result and a second sorting result of class loaders required for cold starting the target application; The first sorting result is a sorting result determined according to the parent delegation mechanism of the class loader; The second sorting result is used to characterize the transition loading order of the class loader loading the class to be loaded; the second sorting result includes first data and second data arranged according to the numerical value relationship; the first data includes the number of classes to be loaded that the class loader hits based on the cached class information; the second data includes the number of classes to be loaded that the class loader does not hit based on the cached class information; adjusting the arrangement order of the first data and the second data corresponding to the parent delegation class loader in the second sorting result according to the first sorting result to obtain a loading order so that the second data corresponding to the child class loader in the parent delegation class loader is located after the first data and the second data corresponding to the parent class loader; the parent delegation class loader includes the class loader corresponding to the first sorting result; Controlling the class loader to load the class to be loaded according to the loading order; When the class loader completes loading, the target application is started.