System resource loading method and apparatus, electronic device, and computer storage medium

By classifying system resources by type and analyzing loading time, and by adopting a multi-threaded loading method, the problem of excessively long system startup time on embedded platforms was solved, and the system startup speed was improved.

CN117891574BActive Publication Date: 2026-04-14SHENZHEN TCL DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN TCL DIGITAL TECH CO LTD
Filing Date
2024-01-03
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Due to the continuous updates and expansions of the software system, the hardware performance of the embedded platform is limited, resulting in excessively long system startup times.

Method used

By acquiring the system resources that the system needs to load during the target startup phase, the system is divided into multiple groups according to resource type. The loading time is collected and divided into the first resource group and the second resource group. Multi-threaded loading is used when starting the loading process.

Benefits of technology

It achieves precise and efficient allocation of system resources, improves system startup speed, reduces startup time, and ensures stable system operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117891574B_ABST
    Figure CN117891574B_ABST
Patent Text Reader

Abstract

The application relates to the terminal technical field and discloses a system resource loading method and device, electronic equipment and computer storage medium, which comprises the following steps: acquiring system resources required to be loaded in a target starting stage of a system, dividing the system resources according to resource types of the system resources to obtain a plurality of grouping units; collecting loading time lengths of the grouping units, dividing the grouping units according to the loading time lengths to obtain at least two resource groups, and the resource groups comprise a first resource group and a second resource group; starting a loading process of the system, and performing multi-thread loading on the system resources in the loading process based on the first resource group and the second resource group. The application realizes accurate and efficient division of the system resources, ensures stable operation of the system, improves the starting speed of the system and reduces the starting time length of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, specifically to a system resource loading method, apparatus, electronic device, and computer storage medium. Background Technology

[0002] In various consumer electronics products such as televisions and set-top boxes, software systems, such as the Android system, are required to enable the functions of the hardware devices they reside in. However, as the functions and systems of various hardware are constantly updated and expanded, the size of the software systems themselves is also gradually increasing. Furthermore, due to the highly customizable nature of software systems, a large number of system services and application software are also built into the system, which limits the inherent hardware performance of embedded platforms, resulting in problems such as excessively long system startup times. Summary of the Invention

[0003] This application provides a system resource loading method, apparatus, electronic device, and computer storage medium, which can solve the technical problem of excessively long system startup time.

[0004] This application provides a system resource loading method, including:

[0005] Obtain the system resources that the system needs to load during the target startup phase, and divide the system resources according to their resource types to obtain multiple grouping units;

[0006] The loading time of each group unit is collected, and the group units are divided according to the loading time to obtain at least two resource groups, the resource groups including a first resource group and a second resource group;

[0007] The loading process of the system is started, and the system resources are loaded in a multi-threaded manner based on the first resource group and the second resource group in the loading process.

[0008] Furthermore, the system resources are divided according to their resource types to obtain multiple grouping units, including:

[0009] The system resources are divided according to the resource types to obtain multiple types of resources and multiple basic resources;

[0010] Obtain the class package name to which the class resource belongs, and group the class resources according to the class package name to obtain multiple first grouping units;

[0011] Obtain the resource attributes of the basic resources, and group the basic resources according to the resource attributes to obtain multiple second grouping units.

[0012] Furthermore, the loading time of each of the aforementioned grouping units includes:

[0013] Obtain the sub-loading duration corresponding to each of the system resources;

[0014] The loading time of each group unit is obtained by statistically analyzing the sub-loading time of system resources in each group unit.

[0015] Furthermore, the grouping unit is divided according to the loading time to obtain at least two resource groups, which include a first resource group and a second resource group, including:

[0016] Construct a first queue and a second queue, and select a target queue from the first queue and the second queue based on the first base duration of the first queue and the second base duration of the second queue;

[0017] Based on the loading time, select a group unit that meets the preset conditions from multiple group units to obtain a target group unit, and add the target group unit to the target queue;

[0018] If there are unselected group units among the multiple group units, the base duration of the target queue is updated according to the loading duration, and the updated base duration is used as the base duration of the target queue, until there are no unselected group units. Then, the first queue that has been selected is used as the first resource group, and the second queue that has been selected is used as the second resource group.

[0019] Furthermore, the above-mentioned selection of target grouping units from multiple grouping units that meet preset conditions based on the loading time includes:

[0020] The multiple grouping units are sorted according to the loading time to obtain a sorting sequence;

[0021] According to the position of each grouping unit in the sorting sequence, the grouping unit that meets the preset conditions is selected from the sorting sequence as the target grouping unit.

[0022] Furthermore, the above-mentioned selection of grouping units that meet preset conditions from the sorting sequence according to their positions in the sorting sequence includes:

[0023] Based on the position of each grouping unit in the sorting sequence, grouping units are selected as candidate units from the sorting sequence;

[0024] Determine whether there is a dependency relationship between the candidate unit and the grouping unit in the target queue;

[0025] If the candidate unit and any grouping unit in the target queue have the dependency relationship, the candidate unit is determined to be the target grouping unit.

[0026] Furthermore, the system resources are divided according to their resource types to obtain multiple grouping units, including:

[0027] Candidate resources and driver resources are selected from the system resources;

[0028] The candidate resources are divided according to their resource types to obtain multiple grouping units;

[0029] The process of starting the loading process of the system, based on the first resource group and the second resource group, involves multi-threaded loading of system resources during the loading process, including:

[0030] Create a third resource group corresponding to the aforementioned driver resource;

[0031] The loading process of the system is started, and the system resources are loaded in a multi-threaded manner based on the first resource group, the second resource group and the third resource group.

[0032] Accordingly, embodiments of this application provide a system resource loading apparatus, including:

[0033] The acquisition module is used to acquire the system resources that the system needs to load during the target startup phase, and divide the system resources according to the resource type to obtain multiple grouping units;

[0034] A grouping module is used to collect the loading time of each grouping unit, divide the grouping unit according to the loading time, and obtain at least two resource groups, wherein the resource groups include a first resource group and a second resource group.

[0035] The loading module is used to start the loading process of the system and load the system resources in a multi-threaded manner based on the first resource group and the second resource group in the loading process.

[0036] Furthermore, this application also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the system resource loading method provided in this application.

[0037] Furthermore, embodiments of this application also provide a computer storage medium storing a computer program adapted for loading by a processor to execute any of the system resource loading methods provided in embodiments of this application.

[0038] Furthermore, this application also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the system resource loading methods provided in this application.

[0039] In this embodiment, by acquiring the system resources that the system needs to load during the target startup phase, the system resources are divided according to their resource types to obtain multiple group units, thus achieving a preliminary division of system resources. Then, the loading time of each group unit is collected, and the group units are divided according to the loading time to obtain at least two resource groups, including a first resource group and a second resource group, thus achieving a further precise division of system resources. Subsequently, the system loading process is started, and the system resources are loaded using multi-threading based on the first and second resource groups during the loading process, achieving a precise and efficient division of system resources. This ensures stable system operation while improving system startup speed and reducing system startup time. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 This is a schematic flowchart of an embodiment of the system resource loading method provided in this application;

[0042] Figure 2 This is a schematic flowchart of another embodiment of the system resource loading method provided in this application;

[0043] Figure 3 This is a schematic flowchart of another embodiment of the system resource loading method provided in this application;

[0044] Figure 4 This is a schematic diagram of the system resource loading device provided in the embodiments of this application;

[0045] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0046] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0047] This application provides a system resource loading method, apparatus, electronic device, and computer storage medium. The system resource loading apparatus can be integrated into an electronic device, which can be a server, a terminal, or other similar device.

[0048] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.

[0049] The terminal can be a smart system, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and the server can be connected directly or indirectly through wired or wireless communication, which is not limited herein.

[0050] Furthermore, in the embodiments of this application, "multiple" refers to two or more. The terms "first" and "second," etc., in the embodiments of this application are used for distinguishing descriptions and should not be construed as implying relative importance.

[0051] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.

[0052] Please see Figure 1 , Figure 1 This is a flowchart illustrating a system resource loading method provided in an embodiment of this application. The system resource loading method may include:

[0053] S101. Obtain the system resources that the system needs to load during the target startup phase, and divide the system resources according to the resource type to obtain multiple grouping units.

[0054] In this embodiment, before system startup, the system resources required for the target startup phase are pre-acquired. The target startup phase is the stage where the system prepares for the virtual machine to run, such as the Zygote phase in Android. During this phase, the system needs to pre-load resources required for the virtual machine's operation, such as classes, .so files, .jar packages, fonts, graphics libraries, etc. These system resources are the resources required to run the virtual machine corresponding to the system. All system resources are divided according to their resource types, resulting in multiple grouping units. Specifically, system resources can be divided into class resource types and basic types. Dividing system resources according to these types yields multiple class resources and multiple basic resources. Class resources are the class files required for the current system virtual machine to run and for system services, while basic resources are some basic runtime resources required for the system's corresponding virtual machine to run, such as graphics runtime resources (Drawables). Then, class resources and basic resources are grouped separately to obtain multiple grouping units.

[0055] There are multiple types of resources and basic resources. Based on the category to which each type of resource belongs, all type resources can be divided into multiple first-group units. One category corresponds to one first-group unit, and one first-group unit includes at least one type resource. Type resources within the same first-group unit belong to the same category. Based on the resource type of basic resources, all basic resources can be divided into multiple second-group units. One resource type corresponds to one second-group unit, and one second-group unit includes at least one basic resource. Basic resources within the same second-group unit belong to the same resource type.

[0056] S102. Collect the loading time of each group unit, divide the group unit according to the loading time, and obtain at least two resource groups, the resource groups including a first resource group and a second resource group.

[0057] In this embodiment, each group unit includes at least one system resource. The loading time of each group unit is calculated by summing the sub-loading times of all system resources within the group unit. The sub-loading time of each system resource can be determined by the startup loading time of various resources and basic resources during testing, and the sub-loading times of each system resource may be different. When the loading time of each group unit is obtained, all group units are divided according to the loading time to obtain a first resource group and a second resource group. Specifically, when the loading time of each group unit is obtained, a group set consisting of all group units is constructed. The group set is divided into a first resource group and a second resource group according to the loading time, such that the difference between the basic times corresponding to the first resource group and the second resource group is within a preset range.

[0058] In addition, two empty queues can be constructed, namely the first queue and the second queue. When dividing the group set, two group units are selected from the group set. These two group units are assigned to the first queue and the second queue respectively, and the loading time corresponding to these two group units is used as the initial base time for the first queue and the second queue respectively. Then, the base time of the first queue and the second queue are compared, and the target queue is selected from the first queue and the second queue according to the comparison result; and a group unit is selected from the remaining group units in the group set other than the two group units as the target group unit and added to the target queue. Each time the target group unit is divided, the base time of the target queue is updated. The base time of the target queue is the cumulative loading time of all group units in the target queue. The base time of the current target queue is compared with the base time of the other queue, and the target queue is selected again according to the comparison result. The target group unit is selected again from the group set and added to the currently selected target queue; until all group units in the group set are assigned to the corresponding queues. This achieves the division of the group set. The first queue obtained after the division is the first resource group, and the second queue obtained after the division is the second resource group.

[0059] S103. Start the loading process of the system, and load the system resources in a multi-threaded manner based on the first resource group and the second resource group in the loading process.

[0060] In this embodiment, the loading process of the system is the process corresponding to the system's target startup phase, such as the process corresponding to the Zygote startup phase in the Android system. Within this target startup phase process, resources in the first resource group and the second resource group are loaded simultaneously, thus achieving fast loading of all system resources. Specifically, a first loading task corresponding to all system resources in the first resource group and a first loading thread corresponding to the first resource group are created; a second loading task corresponding to all system resources in the second resource group and a second loading thread corresponding to the second resource group are created. When the system's loading process is started, the first and second loading threads run in parallel within this loading process, and the first and second loading tasks are executed in parallel based on the first and second loading threads. Therefore, fast loading of system resources is achieved within the system startup loading process.

[0061] The system resource loading method proposed in this application obtains all system resources that the system needs to load during the target startup phase, divides the system resources according to their resource types, and obtains multiple group units. Then, it collects the loading time of each group unit, divides the group units according to the loading time, and obtains a first resource group and a second resource group. Then, it starts the system loading process, and loads system resources in a multi-threaded manner based on the first and second resource groups. This achieves accurate and efficient division of system resources, which improves the system startup speed and reduces the system startup time while ensuring stable system operation.

[0062] like Figure 2 As shown, Figure 2 This is a flowchart illustrating another embodiment of this application. In some embodiments of this application, the system resources are divided according to their resource types to obtain multiple grouping units, including:

[0063] S201. Divide the system resources according to the resource types to obtain multiple types of resources and multiple basic resources;

[0064] S202. Obtain the class package name to which the class resource belongs, and group the class resources according to the class package name to obtain multiple first grouping units;

[0065] S203. Obtain the resource attributes of the basic resources, and group the basic resources according to the resource attributes to obtain multiple second grouping units.

[0066] In this embodiment, system resources are divided according to resource type to obtain class resources and basic resources. The class package (pkg) name to which each type of resource belongs is obtained. Based on this class package name, the class package to which each class resource belongs can be determined, thus obtaining the first grouping unit for class resource division. Specifically, each type of resource is grouped according to its class package name, resulting in first grouping units corresponding to different class package names. All class resources within the same first grouping unit have the same class package name. The resource attributes of each basic resource are obtained, and the basic resources are grouped according to these resource attributes, resulting in multiple second grouping units corresponding to different resource attributes. The resource attributes of basic resources can be determined by the filename or source library of the basic resource. All basic resources within the same second grouping unit have the same resource attributes.

[0067] This embodiment divides system resources into class resources and basic resources based on resource type. Then, class resources and basic resources are further divided according to class package name and resource attributes to obtain the first grouping unit and the second grouping unit. This achieves the initial grouping of class resources and basic resources, improves the accuracy and precision of system resource grouping, and avoids the problem of system instability caused by unclear grouping.

[0068] In some embodiments of this application, the loading time of each of the aforementioned grouping units includes:

[0069] Obtain the sub-loading duration corresponding to each of the system resources;

[0070] The loading time of each group unit is obtained by statistically analyzing the sub-loading time of system resources in each group unit.

[0071] In this embodiment, the sub-loading time is the loading time required for each system resource during the target startup phase. The sub-loading time corresponding to each system resource is obtained, and then the sub-loading time of the system resources in each group unit is statistically analyzed to obtain the loading time of each group unit. In one embodiment, while grouping the class resources in the system resources, the loading time of the group units corresponding to the class resources can also be statistically analyzed. Specifically, when determining all class resources in the system resources, the class resources are loaded sequentially. Each time a class resource is loaded, it is determined whether the current class resource and the previously loaded class resource belong to the same category. If the current class resource and the previously loaded class resource belong to the same category, the sub-loading time of the current class resource in that category is added to the sub-loading time of the previously loaded class resource in that category to obtain the loading time of the group unit corresponding to the current category. If the current class resource and the previously loaded class resource do not belong to the same category, a new variable is created for the category corresponding to the current class resource; this new variable is a new group unit. The loading times of the sub-loading times of the class resources belonging to the new variable are accumulated to obtain the loading time of the group unit corresponding to the new variable. All class resources are loaded sequentially, and the class resource is compared with the previously loaded class resource. The sub-loading times of class resources of the same category are accumulated; for class resources of different categories, a new variable is created, until all class resources are loaded. This completes the grouping of all class resources and the calculation of the loading time of each group unit.

[0072] This embodiment obtains the sub-loading time corresponding to each system resource, and then counts the sub-loading time of the system resources in each group unit to obtain the loading time of each group unit. This achieves accurate and efficient statistics on the loading time of each group unit, further improving the system startup speed.

[0073] like Figure 3 As shown, Figure 3 This is a flowchart illustrating another embodiment of this application. In some embodiments of this application, the grouping unit is divided according to the loading time to obtain at least two resource groups, wherein the resource groups include a first resource group and a second resource group, including:

[0074] S301. Construct a first queue and a second queue, and select a target queue from the first queue and the second queue based on the first basic duration of the first queue and the second basic duration of the second queue.

[0075] S302. Select a group unit that meets the preset conditions from the multiple group units according to the loading time to obtain the target group unit, and add the target group unit to the target queue.

[0076] S303. If there are unselected group units among the multiple group units, the base duration of the target queue is updated according to the loading duration, and the updated base duration is used as the base duration of the target queue, until there are no unselected group units. Then, the first queue that has been selected is used as the first resource group, and the second queue that has been selected is used as the second resource group.

[0077] In this embodiment, the first queue and the second queue are two pre-defined empty queues. The first queue and the second queue each correspond to different base durations, where the first queue corresponds to a first base duration and the second queue corresponds to a second base duration. These base durations can be preset durations. The first queue and the second queue are constructed, and a target queue is selected from them based on the first base duration and the second base duration. Specifically, the first base duration and the second base duration are compared. If the first base duration is longer than the second base duration, the second queue is determined as the target queue; if the second base duration is longer than the first base duration, the first queue is determined as the target queue. In the initial state (i.e., before grouping units are assigned to corresponding queues), the base durations of the first queue and the second queue are preset durations.

[0078] Then, based on the loading time of each group unit, group units that meet preset conditions are selected from multiple group units and added to the target queue. These target group units are the ones that meet the preset conditions. Specifically, all group units are sorted according to their loading time to obtain a sorted sequence. Group units whose positions match the preset target positions are selected from the sorted sequence as target group units. For example, the group unit at the first position in the sorted sequence is selected as the target group unit. This target group unit is then added to the target queue.

[0079] After adding the target group unit to the target queue, it is determined whether there are any unselected group units among the current multiple group units. If there are unselected group units, the base duration of the target queue is updated according to the loading duration, and this updated base duration is used as the base duration of the target queue, until there are no unselected group units. Specifically, when there are unselected group units, the loading duration corresponding to the selected target group unit is obtained, and this loading duration is added to the base duration of the target queue to obtain the updated base duration; this updated base duration is used as the base duration of the target queue. When the target queue is the first queue, the base duration of the target queue is the first base duration; when the target queue is the second queue, the base duration of the target queue is the second base duration. Then, the process returns to the step of filtering the target queue from the first queue and the second queue based on the first base duration of the first queue and the second base duration of the second queue, until all group units have been selected. If there are no unselected group units among multiple group units, meaning that all group units have been selected, then the first queue that has been selected will be designated as the first resource group, and the second queue that has been selected will be designated as the second resource group.

[0080] For example, after obtaining the first base duration corresponding to the first queue and the second base duration corresponding to the second queue, if the first base duration is longer than the second base duration, the second queue is determined as the target queue. The first group unit is then selected according to the order of all group units and designated as the target group unit. This target group unit is then assigned to the second queue. Next, it is determined whether any unselected group units exist among the multiple group units. If so, the loading duration corresponding to the target group unit is accumulated with the second base duration of the second queue to obtain an updated second base duration, which is then used as the second base duration of the second queue. Afterward, the first and second base durations are compared. If the second base duration is longer than the first base duration, the first queue is determined as the target queue. The second group unit is then selected according to the order of all group units and designated as the target group unit. This target group unit is then assigned to the first queue. If any unselected group units exist among the multiple group units, the loading time corresponding to that target group unit is accumulated with the first base time of the first queue to obtain an updated first base time. This updated first base time is then used as the first base time of the first queue. This process continues until all group units have been selected and no unselected group units remain. This first resource group is then considered the first queue after partitioning, and the second resource group is considered the second queue after partitioning.

[0081] This embodiment achieves precise and efficient division of grouping units, improving the system startup speed.

[0082] In some embodiments of this application, the above-mentioned selection of a target grouping unit from a plurality of grouping units that meets preset conditions based on the loading duration includes:

[0083] The multiple grouping units are sorted according to the loading time to obtain a sorting sequence;

[0084] According to the position of each grouping unit in the sorting sequence, the grouping unit that meets the preset conditions is selected from the sorting sequence as the target grouping unit.

[0085] In this embodiment, there are multiple grouping units. The grouping units are sorted according to their loading duration to obtain a sorted sequence. Specifically, the grouping unit with the smallest loading duration is obtained and used as the first grouping unit. All grouping units are then sorted in ascending order of loading duration to obtain the sorted sequence. Alternatively, the grouping unit with the largest loading duration can be obtained and used as the first grouping unit. All grouping units are then sorted in descending order of loading duration to obtain a sorted sequence. When obtaining the sorted sequence, grouping units that meet preset conditions are selected as target grouping units based on their positions within the sequence. These preset conditions can be preset target positions. The grouping unit at the preset target position is selected from the sorted sequence as the target grouping unit.

[0086] This embodiment sorts the grouping units by loading time to obtain a sorted sequence, and selects the grouping units that meet the preset conditions from the sorted sequence according to the position of each grouping unit in the sorted sequence as the target grouping unit, thereby realizing the rapid sorting of grouping units and improving the screening efficiency of target grouping units.

[0087] In some embodiments of this application, the above-mentioned selection of grouping units that meet preset conditions from the sorting sequence according to the position of each grouping unit in the sorting sequence as the target grouping unit includes:

[0088] Based on the position of each grouping unit in the sorting sequence, grouping units are selected as candidate units from the sorting sequence;

[0089] Determine whether there is a dependency relationship between the candidate unit and the grouping unit in the target queue;

[0090] If the candidate unit and any grouping unit in the target queue have the dependency relationship, the candidate unit is determined to be the target grouping unit.

[0091] In this embodiment, the queue corresponding to the grouped unit can also be determined based on the dependency relationship. Specifically, each grouped unit in the sorting sequence has a corresponding sorting number, and the position of the candidate unit in the sorting sequence can be determined based on this sorting number. When selecting a grouped unit from the sorting sequence, the grouped units can be selected sequentially according to their sorting numbers, either from smallest to largest or from largest to smallest, and each selected grouped unit is used as a candidate unit. After each selection, the sorting sequence is updated, that is, the selected grouped units are removed from the sorting sequence to obtain an updated sorting sequence; in the next selection, the remaining grouped units are selected from the updated sorting sequence. Therefore, when selecting grouped units from smallest to largest as described above, each selected grouped unit is the first grouped unit in the current sorting sequence; when selecting grouped units from largest to smallest as described above, each selected grouped unit is the last grouped unit in the current sorting sequence. In addition, grouped units can also be selected from the middle or other positions according to their positions in the sorting sequence to obtain candidate units.

[0092] When selecting candidate units from the sorted sequence, it is determined whether there is a dependency relationship between the candidate unit and the grouped units in the target queue. Specifically, the dependency relationship is the relationship between the candidate unit and the existing grouped units in the target queue. If there is a dependency relationship between the candidate unit and any existing grouped unit in the target queue, the candidate unit is assigned to the target queue. If there is no dependency relationship between the candidate unit and any existing grouped unit in the target queue, the candidate unit is assigned to another queue outside the target queue.

[0093] This embodiment selects candidate units from the sorted sequence and obtains the dependency relationship between the candidate units and the grouping units in the target queue, so that candidate units with dependencies can be divided into the same queue, and further improves the stability of the system when the first resource group and the second resource group are obtained.

[0094] In some embodiments of this application, the system resources are divided according to their resource types to obtain multiple grouping units, including:

[0095] Candidate resources and driver resources are selected from the system resources;

[0096] The candidate resources are divided according to their resource types to obtain multiple grouping units;

[0097] The process of starting the loading process of the system, based on the first resource group and the second resource group, involves multi-threaded loading of system resources during the loading process, including:

[0098] Create a third resource group corresponding to the aforementioned driver resource;

[0099] The loading process of the system is started, and the system resources are loaded in a multi-threaded manner based on the first resource group, the second resource group and the third resource group.

[0100] In this embodiment, to more accurately divide system resources, when the system resources required to be loaded during the target startup phase are obtained, candidate resources and driver resources are selected from the system resources. Candidate resources include class resources and basic resources, while driver resources are resources other than class and basic resources in the system resources during the target startup phase. Specifically, driver resources include system fonts, drivers, and shared objects (SOs). Alternatively, driver resources can also be assigned to the basic resources of the candidate resources. When a driver resource is assigned to the basic resources, there is no need to select candidate and driver resources from the system resources; all system resources are directly divided according to the resource type corresponding to that system resource to obtain group units. The group units are then processed according to the loading duration.

[0101] When candidate resources and driver resources are obtained, for candidate resources, they are divided according to their resource type to obtain multiple group units. The loading time of each group unit is collected, and the group units are further divided according to the loading time to obtain the first resource group and the second resource group finally obtained from the candidate resources. For driver resources, a third resource group corresponding to the driver resource is created. When loading system resources, loading threads corresponding to the first, second, and third resource groups are created respectively. The loading threads corresponding to the three resource groups run in parallel in the loading process, thus achieving fast loading of all system resources.

[0102] This embodiment filters candidate resources and driver resources from system resources, processes the candidate resources and driver resources respectively, and then performs multi-threaded parallel loading on the first resource group, the second resource group corresponding to the candidate resources and the third resource group corresponding to the driver resources. This achieves accurate loading of system resources and further improves the partitioning accuracy and loading speed of system resources.

[0103] To facilitate better implementation of the system resource loading method provided in this application, this application also provides an apparatus based on the above-described system resource loading method. The meanings of the terms used are the same as in the above-described system resource loading method, and specific implementation details can be found in the descriptions within the method embodiments.

[0104] For example, such as Figure 4As shown, the system resource loading device may include: an acquisition module 401, a grouping module 402, and a loading module 403. Among them,

[0105] The acquisition module 401 is used to acquire the system resources that the system needs to load during the target startup phase, and divide the system resources according to the resource type to obtain multiple grouping units;

[0106] Grouping module 402 is used to collect the loading time of each grouping unit, divide the grouping unit according to the loading time, and obtain at least two resource groups, wherein the resource groups include a first resource group and a second resource group;

[0107] The loading module 403 is used to start the loading process of the system and perform multi-threaded loading of the system resources based on the first resource group and the second resource group in the loading process.

[0108] In one embodiment of this application, the acquisition module 401 includes:

[0109] A partitioning unit is used to partition the system resources according to the resource type, resulting in multiple class resources and multiple basic resources;

[0110] The first grouping unit is used to obtain the class package name to which the class resource belongs, and to group the class resource according to the class package name to obtain multiple first grouping units;

[0111] The second grouping unit is used to obtain the resource attributes of the basic resources, and group the basic resources according to the resource attributes to obtain multiple second grouping units.

[0112] In one embodiment of this application, the grouping module 402 includes:

[0113] The acquisition unit is used to acquire the sub-loading duration corresponding to each of the system resources;

[0114] The statistics unit is used to count the sub-loading time of system resources in each grouping unit to obtain the loading time of each grouping unit.

[0115] In one embodiment of this application, the grouping module 402 includes:

[0116] A construction unit is used to construct a first queue and a second queue, and to filter out a target queue from the first queue and the second queue based on the first base duration of the first queue and the second base duration of the second queue.

[0117] A selection unit is used to select a grouping unit that meets preset conditions from a plurality of grouping units according to the loading time, to obtain a target grouping unit, and to add the target grouping unit to the target queue;

[0118] An update unit is configured to update the base duration of the target queue according to the loading duration if there are unselected group units among the multiple group units, and use the updated base duration as the base duration of the target queue, until there are no unselected group units, then the first queue that has been selected is used as the first resource group, and the second queue that has been selected is used as the second resource group.

[0119] In one embodiment of this application, the selection unit includes:

[0120] A sorting unit is used to sort multiple grouping units according to the loading time to obtain a sorting sequence;

[0121] Selecting a sub-unit is used to select a grouping unit that meets a preset condition from the sorting sequence according to the position of each grouping unit in the sorting sequence, and that is the target grouping unit.

[0122] In one embodiment of this application, the above-mentioned selection subunit includes:

[0123] A candidate unit is used to select a grouping unit as a candidate unit from the sorting sequence according to the position of each grouping unit in the sorting sequence;

[0124] A dependency confirmation unit is used to determine whether there is a dependency relationship between the candidate unit and the grouping unit in the target queue;

[0125] A target confirmation unit is used to determine the candidate unit as the target grouping unit if the candidate unit and any grouping unit in the target queue have the dependency relationship.

[0126] In one embodiment of this application, the system resource loading device further includes:

[0127] A filtering unit is used to filter candidate resources and driving resources from the system resources;

[0128] An initial partitioning unit is used to partition the candidate resources according to their resource types to obtain multiple grouping units;

[0129] A creation unit is used to create a third resource group corresponding to the driving resource;

[0130] The loading unit is used to start the loading process of the system and, based on the first resource group, the second resource group and the third resource group, perform multi-threaded loading of the system resources in the loading process.

[0131] The system resource loading device proposed in this application enables precise and efficient allocation of system resources, thereby improving system startup speed and reducing system startup time while ensuring stable system operation.

[0132] In practice, each of the above modules can be implemented as an independent entity or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation methods and corresponding beneficial effects of each of the above modules, please refer to the previous method embodiments, which will not be repeated here.

[0133] This application also provides an electronic device, which may be a server or a terminal, etc. Figure 5 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:

[0134] The electronic device may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer storage media, a power supply 603, and an input unit 604. Those skilled in the art will understand that... Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0135] in:

[0136] The processor 601 is the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes computer programs and / or modules stored in the memory 602, and calls data stored in the memory 602, to perform various functions and process data. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.

[0137] The memory 602 can be used to store computer programs and modules. The processor 601 executes various functional applications and data processing by running the computer programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, computer programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.

[0138] The electronic device also includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0139] The electronic device may also include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0140] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the electronic device loads the executable files corresponding to the processes of one or more computer programs into the memory 602 according to the following instructions, and the processor 601 runs the computer programs stored in the memory 602 to realize various functions, such as:

[0141] Obtain the system resources that the system needs to load during the target startup phase, and divide the system resources according to their resource types to obtain multiple grouping units;

[0142] The loading time of each group unit is collected, and the group units are divided according to the loading time to obtain at least two resource groups, the resource groups including a first resource group and a second resource group;

[0143] The loading process of the system is started, and the system resources are loaded in a multi-threaded manner based on the first resource group and the second resource group in the loading process.

[0144] The electronic device proposed in this application achieves precise and efficient allocation of system resources, thereby improving system startup speed and reducing system startup time while ensuring stable system operation.

[0145] For details on the specific implementation methods and corresponding beneficial effects of the above operations, please refer to the detailed description of the system resource loading method above, which will not be repeated here.

[0146] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a computer program, or by a computer program controlling related hardware. The computer program can be stored in a computer storage medium and loaded and executed by a processor.

[0147] Therefore, embodiments of this application provide a computer storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the system resource loading methods provided in embodiments of this application. For example, the computer program can execute the following steps:

[0148] Obtain the system resources that the system needs to load during the target startup phase, and divide the system resources according to their resource types to obtain multiple grouping units;

[0149] The loading time of each group unit is collected, and the group units are divided according to the loading time to obtain at least two resource groups, the resource groups including a first resource group and a second resource group;

[0150] The loading process of the system is started, and the system resources are loaded in a multi-threaded manner based on the first resource group and the second resource group in the loading process.

[0151] The computer storage medium proposed in this application enables precise and efficient allocation of system resources, thereby improving system startup speed and reducing system startup time while ensuring stable system operation.

[0152] For details on the specific implementation methods and corresponding beneficial effects of the above operations, please refer to the previous embodiments, which will not be repeated here.

[0153] The computer storage medium may include: read-only memory (ROM), random access memory (RAM), hard disk or optical disk, etc.

[0154] Since the computer program stored in the computer storage medium can execute the steps in any of the system resource loading methods provided in the embodiments of this application, the beneficial effects that any of the system resource loading methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0155] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer storage medium. A processor of a computer device reads the computer instructions from the computer storage medium and executes the computer instructions, causing the computer device to perform the aforementioned system resource loading method.

[0156] The above provides a detailed description of a system resource loading method, apparatus, electronic device, and computer storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A system resource loading method, characterized by, include: The system resources that the system needs to load during the target startup phase are obtained, and the system resources are divided according to their resource types to obtain multiple grouping units, including: filtering candidate resources and driver resources from the system resources; and dividing the candidate resources according to their resource types to obtain multiple grouping units. The loading time of each group unit is collected, and the group units are divided according to the loading time to obtain at least two resource groups, the resource groups including a first resource group and a second resource group; The loading process of the system is initiated, and the system resources are loaded in a multi-threaded manner based on the first resource group and the second resource group in the loading process, including: creating a third resource group corresponding to the driver resource; initiating the loading process of the system, and loading the system resources in a multi-threaded manner based on the first resource group, the second resource group and the third resource group in the loading process.

2. The system resource loading method of claim 1, wherein, The system resources are divided according to their resource types to obtain multiple grouping units, including: The system resources are divided according to the resource types to obtain multiple types of resources and multiple basic resources; Obtain the class package name to which the class resource belongs, and group the class resources according to the class package name to obtain multiple first grouping units; Obtain the resource attributes of the basic resources, and group the basic resources according to the resource attributes to obtain multiple second grouping units.

3. The system resource loading method of claim 1, wherein, The loading time of each of the group units is collected, including: Obtain the sub-loading duration corresponding to each of the system resources; The loading time of each group unit is obtained by statistically analyzing the sub-loading time of system resources in each group unit.

4. The system resource loading method of claim 1, wherein, The process of dividing the grouping unit according to the loading time to obtain at least two resource groups, wherein the resource groups include a first resource group and a second resource group, includes: Construct a first queue and a second queue, and select a target queue from the first queue and the second queue based on the first base duration of the first queue and the second base duration of the second queue; Based on the loading time, select a group unit that meets the preset conditions from multiple group units to obtain a target group unit, and add the target group unit to the target queue; If there are unselected group units among the multiple group units, the base duration of the target queue is updated according to the loading duration, and the updated base duration is used as the base duration of the target queue, until there are no unselected group units. Then, the first queue that has been selected is used as the first resource group, and the second queue that has been selected is used as the second resource group.

5. The system resource loading method according to claim 4, characterized in that, The step of selecting a target group unit from multiple group units that meet preset conditions based on the loading time includes: The multiple grouping units are sorted according to the loading time to obtain a sorting sequence; According to the position of each grouping unit in the sorting sequence, the grouping unit that meets the preset conditions is selected from the sorting sequence as the target grouping unit.

6. The system resource loading method according to claim 5, characterized in that, The step of selecting a target grouping unit from the sorting sequence that meets a preset condition according to the position of each grouping unit in the sorting sequence includes: Based on the position of each grouping unit in the sorting sequence, grouping units are selected as candidate units from the sorting sequence; Determine whether there is a dependency relationship between the candidate unit and the grouping unit in the target queue; If the candidate unit and any grouping unit in the target queue have the dependency relationship, the candidate unit is determined to be the target grouping unit.

7. A system resource loading device, characterized in that, include: The acquisition module is used to acquire the system resources that the system needs to load during the target startup phase, and to divide the system resources according to their resource types to obtain multiple grouping units, including: filtering candidate resources and driver resources from the system resources; and dividing the candidate resources according to their resource types to obtain multiple grouping units. A grouping module is used to collect the loading time of each grouping unit, divide the grouping unit according to the loading time, and obtain at least two resource groups, wherein the resource groups include a first resource group and a second resource group; A loading module is used to start the loading process of the system and perform multi-threaded loading of system resources in the loading process based on the first resource group and the second resource group, including: creating a third resource group corresponding to the driver resource; starting the loading process of the system and performing multi-threaded loading of system resources in the loading process based on the first resource group, the second resource group and the third resource group.

8. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing a computer program, and the processor running the computer program in the memory to perform the system resource loading method according to any one of claims 1 to 6.

9. A computer storage medium, characterized in that, The computer storage medium stores a computer program adapted for loading by a processor to execute the system resource loading method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Preloading method, electronic equipment and storage medium

    CN114706633A

  • Resource loading method and device, electronic equipment and computer readable storage medium

    CN116339860A