A method, device, equipment and storage medium for optimizing device startup performance
By dynamically adjusting the garbage collection mechanism of eMMC memory and building a write accelerator, the write performance in the equipment startup stage is optimized, and the problems of startup time and stability caused by insufficient write performance in the existing technology are solved, and the equipment is started quickly and smoothly.
Patent Information
- Application Number
- CN202510561477.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2045-04-30
AI Technical Summary
In the prior art, using eMMC devices only focuses on read performance optimization, it is difficult to meet the actual usage needs. Inadequate write performance leads to prolonging the startup time and stability problems, affecting the normal start-up of the device.
By obtaining the working status of the device host and its eMMC memory, dynamically adjusting the trigger conditions of the garbage collection mechanism and building a startup write acceleration table, optimizing the write operation performance, including postponing the trigger time of the front-end garbage collection mechanism during the startup phase, adjusting the frequency of the background garbage collection mechanism, and building a startup write acceleration table based on the write operation type to reduce the frequency of table lookup.
Improves the startup performance and stability of the device, ensures the device starts quickly and smoothly, optimizes the write performance, and avoids write errors and delay problems.
Smart Images

Figure CN120085928B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of memory, and particularly to a method, device, equipment and storage medium for optimizing the startup performance of a device. Background Art
[0002] In the technical field of electronic devices, devices using an Embedded Multi Media Card (eMMC) are widely applied, including smart phones, tablet computers, smart wearable devices and various embedded systems, etc. The startup performance, as a key indicator of these devices, directly affects the user experience and the overall performance evaluation of the device. During the startup phase of the device host, there are two operations: reading and writing. In the prior art, the main focus of optimization is on improving the reading performance. The reason is that quickly reading key data such as operating system files and startup configuration files can significantly shorten the startup time of the device host. However, in actual application scenarios, the writing performance also has an important impact on the startup performance that cannot be ignored. During the startup phase of the device host, a large number of system initialization operations need to be performed, including writing system logs, caching data, and temporary configuration information, etc. If the writing performance is poor, it will lead to an extended startup time.
[0003] In addition, the writing performance will also have a significant impact on the stability of the device host during the startup phase. Insufficient writing performance is likely to cause problems such as incorrect data writing and excessive delays, which will lead to serious consequences such as system crashes and data loss, making the device unable to start normally or malfunction after startup. In current devices using eMMC, only focusing on optimizing the reading performance has been difficult to meet the actual usage requirements, and the impact of the writing performance on the startup performance urgently needs to be taken seriously. Therefore, there is an urgent need to propose a technical solution that can comprehensively consider the reading and writing performance and effectively improve the overall performance and stability during the startup phase to make up for the deficiencies of the prior art. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, system, device and storage medium for optimizing the startup performance of a device, which optimizes the startup performance by starting from the writing operation during the startup phase of the device, and solves the technical problem that in the prior art, devices using eMMC only focusing on optimizing the reading performance have been difficult to meet the actual usage requirements.
[0005] To solve the above technical problem, the present invention is realized through the following technical solutions:
[0006] The present invention provides a method for optimizing the startup performance of a device, which includes:
[0007] Obtain the working states of the device host and its eMMC memory, where the working state of the device host includes the startup phase and the running phase, and the working state of the eMMC memory includes the idle state and the busy state;
[0008] When the device host is in the startup phase, adjust the condition for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the triggering time of the foreground garbage collection mechanism in the startup phase;
[0009] When the eMMC memory is in the idle state, dynamically adjust the condition for the eMMC memory to trigger the background garbage collection mechanism according to the working state of the device host.
[0010] In an embodiment of the present invention, the obtaining the working states of the device host and its eMMC memory includes:
[0011] After the device host is powered on or reset, obtain the working state and data write volume of the eMMC memory;
[0012] When the data write volume of the eMMC memory is less than a preset data write volume threshold, it is determined that the device host is currently in the startup phase.
[0013] In an embodiment of the present invention, the when the device host is in the startup phase, adjust the condition for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the triggering time of the foreground garbage collection mechanism in the startup phase, includes:
[0014] Detect the current working state of the device host;
[0015] If the device host is currently in the startup phase, dynamically adjust the default remaining capacity threshold for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the triggering time of the foreground garbage collection mechanism in the startup phase, where the preset remaining capacity threshold is less than the default remaining capacity threshold.
[0016] In an embodiment of the present invention, the when the eMMC memory is in the idle state, dynamically adjust the condition for the eMMC memory to trigger the background garbage collection mechanism according to the working state of the device host, includes:
[0017] Detect the current working states of the device host and the eMMC memory;
[0018] When the device host is in the startup phase and the eMMC memory is in the idle state, adjust the default time threshold for the eMMC memory to trigger the background garbage collection mechanism to a first preset time threshold, where the first preset time threshold is less than the default time threshold;
[0019] Detect whether the device host has triggered the foreground garbage collection mechanism during the startup phase, and perform secondary adjustment on the first preset time threshold according to the detection result.
[0020] In an embodiment of the present invention, the detecting whether the device host has triggered the foreground garbage collection mechanism during the startup phase, and performing secondary adjustment on the first preset time threshold according to the detection result includes:
[0021] Detect whether the device host has triggered the foreground garbage collection mechanism during the startup phase;
[0022] If the device host has triggered the foreground garbage collection mechanism during the startup phase, adjust the first preset time threshold for the eMMC memory to trigger the background garbage collection mechanism to a second preset time threshold, where the second preset time threshold is less than the first preset time threshold.
[0023] In an embodiment of the present invention, the method further includes:
[0024] Detect the type of write operation performed by the device host during the startup phase, and construct a startup write acceleration table according to the type of write operation;
[0025] When a subsequent write operation is initiated, use the startup write acceleration table for assisted table lookup to reduce the table lookup frequency during the write operation in the startup phase.
[0026] In an embodiment of the present invention, the detecting the type of write operation performed by the device host during the startup phase, and constructing a startup write acceleration table according to the type of write operation includes:
[0027] Detect the type of write operation performed by the device host during the startup phase;
[0028] If the type of write operation is a 4K misaligned write operation, construct a corresponding startup write acceleration table, and record the write operation address of the current 4K misaligned write operation in the constructed startup write acceleration table.
[0029] In an embodiment of the present invention, the using the startup write acceleration table for assisted table lookup when a subsequent write operation is initiated to reduce the table lookup frequency during the write operation in the startup phase includes:
[0030] Detect whether the type of the currently initiated write operation is a 4K misaligned write operation;
[0031] If the type of the currently initiated write operation is a 4K misaligned write operation, query whether there is a matching write operation address in the startup write acceleration table, and perform a 4K misaligned write operation or a normal table lookup according to the query result.
[0032] In one embodiment of the present application, querying whether there is a matching write operation address in the startup write acceleration table and performing a 4K unaligned write operation or a normal table read according to the query result includes:
[0033] Querying whether there is a write operation address in the startup write acceleration table that matches the current 4K unaligned write operation;
[0034] If there is, perform a 4K unaligned write operation at the matching write operation address;
[0035] If not, after a normal table read, perform a 4K unaligned write at the corresponding write operation address and record the write operation address of the current 4K unaligned write operation in the startup write acceleration table.
[0036] Based on the same inventive concept, another embodiment of the present invention further provides a device startup performance optimization device, which is implemented by using the device startup performance optimization method described in any of the above embodiments, and includes:
[0037] A status detection module, configured to obtain the working status of the device host and its eMMC memory. Among them, the working status of the device host includes a startup stage and an operating stage, and the working status of the eMMC memory includes an idle state and a busy state;
[0038] A foreground garbage collection mechanism adjustment module, configured to adjust the condition for triggering the foreground garbage collection mechanism of the eMMC memory to a preset remaining capacity threshold when the device host is in the startup stage, so as to postpone the triggering time of the foreground garbage collection mechanism in the startup stage;
[0039] A background garbage collection mechanism adjustment module, configured to dynamically adjust the condition for triggering the background garbage collection mechanism of the eMMC memory according to the working status of the device host when the eMMC memory is in the idle state;
[0040] An acceleration table construction module, configured to construct a startup write acceleration table according to the type of write operation executed by the device host in the startup stage, and use the startup write acceleration table for auxiliary table look-up operations when subsequent write operations are initiated, so as to reduce the table look-up frequency during the write operation in the startup stage.
[0041] Based on the same inventive concept, another embodiment of the present invention further provides an electronic device, characterized in that the electronic device includes:
[0042] One or more processors;
[0043] A storage device, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, enable the electronic device to implement the device startup performance optimization method described in any of the above embodiments.
[0044] Based on the same inventive concept, another embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer is enabled to execute the device startup performance optimization method as described in any of the above embodiments.
[0045] As described above, a startup method provided by the present invention includes obtaining the working states of a device host and its eMMC memory. Among them, the working state of the device host includes a startup stage and an operation stage, and the working state of the eMMC memory includes an idle state and a busy state. When the device host is in the startup stage, the condition for triggering the foreground garbage collection mechanism of the eMMC memory is adjusted to a preset remaining capacity threshold to postpone the triggering time of the foreground garbage collection mechanism in the startup stage. When the eMMC memory is in the idle state, the condition for triggering the background garbage collection mechanism of the eMMC memory is dynamically adjusted according to the working state of the device host. The method dynamically adjusts the triggering time of the foreground garbage collection mechanism and the triggering frequency of the background garbage collection mechanism according to different stages of the device host and the specific situation in the startup stage, and constructs a startup write acceleration table according to the write operation type in the startup stage of the device host, so as to achieve high-quality management of memory resources, improve the stability and performance of the device, especially in the startup stage, and ensure that the device starts quickly and smoothly. Of course, any product implementing the present invention does not necessarily need to achieve all the above-mentioned advantages at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for describing the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0047] Figure 1 It is a schematic flowchart of a device startup performance optimization method provided by an exemplary embodiment of the present application.
[0048] Figure 2 It is a schematic flowchart of constructing a startup write acceleration table provided by an exemplary embodiment of the present application.
[0049] Figure 3 It is a schematic flowchart of using the startup write acceleration table for assisted look-up provided by an exemplary embodiment of the present application.
[0050] Figure 4 It is a schematic flowchart of data pre-reading during write operation idle time provided by an exemplary embodiment of the present application.
[0051] Figure 5 A schematic structural diagram of a device startup performance optimization device provided by another exemplary embodiment of the present application.
[0052] Figure 6 A schematic structural diagram of an electronic device provided by another exemplary embodiment of the present application. Detailed implementation manners
[0053] The following uses specific specific examples to illustrate the implementation manners of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific implementation manners. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0054] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner. Therefore, only the components related to the present invention are shown in the diagrams, rather than being drawn according to the number, shape, and size of the components in actual implementation. The type, quantity, and ratio of each component in actual implementation can be arbitrarily changed, and the component layout type may also be more complex.
[0055] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0056] To solve the technical problem that in the prior art, devices using eMMC only focus on read performance optimization and are difficult to meet actual usage requirements, the present invention provides a device startup performance optimization method, which optimizes startup performance by starting from the write operation in the device startup stage.
[0057] Please refer to Figure 1 As shown, in an exemplary embodiment of the present application, the device startup performance optimization method includes the following steps:
[0058] S100: Obtain the working states of the device host and its eMMC memory. Among them, the working state of the device host includes the startup stage and the running stage, and the working state of the eMMC memory includes the idle state and the busy state;
[0059] S200: When the device host is in the startup phase, adjust the condition for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the triggering time of the foreground garbage collection mechanism in the startup phase;
[0060] S300: When the eMMC memory is in the idle state, dynamically adjust the condition for the eMMC memory to trigger the background garbage collection mechanism according to the working state of the device host.
[0061] It should be noted that, please continue to refer to Figure 1 As shown, in an exemplary embodiment of the present application, the device startup performance optimization method further includes:
[0062] S400: Detect the type of write operation executed by the device host in the startup phase, and construct a startup write acceleration table according to the type of write operation;
[0063] S500: When a subsequent write operation is initiated, use the startup write acceleration table for auxiliary look-up to reduce the look-up frequency during the write operation in the startup phase.
[0064] The steps in the above device startup performance optimization method will be discussed in detail below.
[0065] First, execute step S100, that is, obtain the working states of the device host and its eMMC memory. Among them, the working state of the device host includes the startup phase and the running phase, and the working state of the eMMC memory includes the idle state and the busy state.
[0066] In an exemplary embodiment of the present application, step S100 further includes the following steps:
[0067] S110: After the device host is powered on or reset, obtain the working state and the data write amount of the eMMC memory;
[0068] S120: When the data write amount of the eMMC memory is less than the preset data write amount threshold, it is determined that the device host is currently in the startup phase.
[0069] Specifically, after the device host powers on or resets, during the system initialization phase, status detection needs to be immediately performed. By reading the status register of the eMMC memory, it is confirmed whether the current working state of the eMMC memory is the busy state or the idle state. At the same time, the cumulative data write volume of the eMMC memory is obtained through the built-in counter or file system metadata of the eMMC memory, and the data write volume of the eMMC memory is compared with a preset data write volume threshold. If the data write volume is less than the preset data write volume threshold, it is determined that the device host is currently in the startup phase. If the data write volume is greater than or equal to the preset data write volume threshold, the device host may currently be in the running phase. It should be noted that in this embodiment, the running phase includes the idle state and the low-power state.
[0070] Next, step S200 is executed. That is, when the device host is in the startup phase, the condition for triggering the foreground garbage collection mechanism of the eMMC memory is adjusted to a preset remaining capacity threshold to postpone the triggering time of the foreground garbage collection mechanism in the startup phase.
[0071] In an exemplary embodiment of the present application, step S200 further includes the following steps:
[0072] S210: Detect the current working state of the device host;
[0073] S220: When the device host is currently in the startup phase, dynamically adjust the default remaining capacity threshold for triggering the foreground garbage collection mechanism of the eMMC memory to the preset remaining capacity threshold to postpone the triggering time of the foreground garbage collection mechanism in the startup phase, where the preset remaining capacity threshold is less than the default remaining capacity threshold.
[0074] It should be noted that the foreground garbage collection mechanism (Foreground GC) is usually triggered when the remaining capacity of the eMMC memory is low to release the space of the eMMC memory. During the startup phase of the device host, frequent GC operations may cause startup delays or resource contention. By dynamically adjusting the remaining capacity threshold for triggering the foreground GC, the triggering time of the foreground GC can be effectively postponed to ensure the efficiency of the startup process.
[0075] Specifically, the current working state of the device host is monitored in real time to confirm whether the device host is currently in the startup phase. When the device host is in the startup phase, the default remaining capacity threshold for triggering foreground GC in the system is reconfigured, that is, the threshold for triggering foreground GC is dynamically adjusted from the default remaining capacity threshold to a preset specific capacity threshold. After the startup phase of the device host ends, the adjusted remaining capacity threshold for triggering foreground GC needs to be restored to the default remaining capacity threshold. During this process, to avoid threshold jitter during state switching, which may cause foreground GC to be triggered immediately, a smooth transition strategy is adopted to adjust the threshold. That is, after the startup phase of the device host ends, the remaining capacity threshold for triggering foreground GC should not directly switch to the default remaining capacity threshold, but should be gradually and phased increased to the default remaining capacity threshold to ensure a smooth switch and stable operation of the system state.
[0076] Next, step S300 is executed. That is, when the eMMC memory is in an idle state, the conditions for triggering the background garbage collection mechanism of the eMMC memory are dynamically adjusted according to the working state of the device host.
[0077] In an exemplary embodiment of the present application, step S300 further includes the following steps:
[0078] S310: Detect the current working states of the device host and the eMMC memory;
[0079] S320: When the device host is in the startup phase and the eMMC memory is in an idle state, adjust the default time threshold for triggering the background garbage collection mechanism of the eMMC memory to a first preset time threshold, where the first preset time threshold is less than the default time threshold;
[0080] S330: Detect whether the device host has triggered the foreground garbage collection mechanism during the startup phase, and make a secondary adjustment to the first preset time threshold according to the detection result.
[0081] It should be noted that in an exemplary embodiment of the present application, step S330 further includes the following steps:
[0082] S331: Detect whether the device host has triggered the foreground garbage collection mechanism during the startup phase;
[0083] S332: If the device host has triggered the foreground garbage collection mechanism during the startup phase, adjust the first preset time threshold for triggering the background garbage collection mechanism of the eMMC memory to a second preset time threshold, where the second preset time threshold is less than the first preset time threshold.
[0084] Specifically, according to the different stages of the device host, the conditions for triggering the Background Garbage Collection (Background GC) mechanism for the eMMC memory are dynamically adjusted. In this embodiment, the background GC trigger threshold conditions are divided into three levels to meet the storage management requirements of different stages. More specifically, the first level is the normal background GC trigger condition, which applies to the device host in the normal operation stage. In this stage, the usage mode of the eMMC memory is relatively stable, and the trigger of the background GC aims to maintain system performance and optimize the storage space utilization rate. For example, the normal background GC trigger condition is set to the eMMC memory being in the idle state for 100 milliseconds. Then, when the idle time reaches 100 milliseconds, the background GC operation will be triggered to recycle the invalid data in the memory, thereby releasing the storage space and ensuring the continuous and stable operation of the device host. The second level is the background GC trigger condition during the startup stage. The device host needs to perform a large number of initialization operations during the startup stage. At this time, the access mode and resource requirements of the eMMC memory are significantly different from those in the normal operation stage. To cope with the frequent storage allocation requirements during the boot process, the trigger condition of the background GC needs to be adjusted. For example, the background GC trigger condition during the startup stage is set to the eMMC memory being in the idle state for 80 milliseconds. Compared with the normal operation stage, this adjustment enables the background GC to be triggered more frequently during the startup stage, thereby timely recycling the storage space and meeting the storage resource requirements during the boot process. The third level is the background GC trigger condition after triggering the foreground GC during the startup stage. When the device host is in the startup stage, if the foreground GC has been triggered, it indicates that the GC buffer (GC buf) has been completely consumed and the storage space utilization rate has reached a relatively high level. To further improve the recycling efficiency of the storage resources, the trigger condition of the background GC needs to be adjusted again. For example, when the foreground GC is not triggered during the startup stage, the background GC trigger condition is 80 milliseconds of idle time. After triggering the foreground GC, the background GC trigger condition is further tightened to 50 milliseconds of idle time. This adjustment aims to maximize the recycling of the storage space by increasing the trigger frequency of the background GC and avoid boot failure or performance bottlenecks caused by the exhaustion of storage resources.
[0085] Immediately afterwards, step S400 is executed, that is, detecting the type of write operation performed by the device host during the startup stage and constructing a startup write acceleration table according to the type of write operation.
[0086] In an exemplary embodiment of the present application, step S400 further includes the following steps:
[0087] S410: Detecting the type of write operation performed by the device host during the startup stage;
[0088] S420: If the write operation type is a 4K misaligned write operation, construct a corresponding startup write acceleration table, and record the write operation address of the current 4K misaligned write operation in the constructed startup write acceleration table.
[0089] Specifically, in this embodiment, for each startup phase of the device host, the system executes a specific process to construct a startup write acceleration table (Startup Write Acceleration Table). The core function of this table is to record the address information of each 4K misaligned write operation, aiming to optimize the device startup performance by reducing the number of table lookups caused by write operations during subsequent boot processes. Please refer to Figure 2 As shown, during the startup phase of the device host, all write operation requests need to be continuously monitored. For each write operation request, first determine whether it is a 4K misaligned write operation. If it is detected that the current write operation is a 4K misaligned write, record the address information of this write operation in the startup write acceleration table. It should be noted that during the initial construction phase of the startup write acceleration table, it will temporarily occupy a predefined storage space, which is normally used to store the Program / Erase Cycle Counter (PEC) table. After the startup phase ends, write the data of the startup write acceleration table into a specific table block to ensure data persistence and facilitate quick loading during subsequent startups. Then load the normal PEC table and overwrite the storage space temporarily occupied by the startup write acceleration table, thereby restoring the normal function of the PEC table.
[0090] Finally, execute step S500, that is, when subsequent write operations are initiated, use the startup write acceleration table for auxiliary table lookup to reduce the table lookup frequency during write operations in the startup phase.
[0091] In an exemplary embodiment of the present application, step S500 further includes the following steps:
[0092] S510: Detect whether the type of the currently initiated write operation is a 4K misaligned write operation;
[0093] S520: If the type of the currently initiated write operation is a 4K misaligned write operation, query whether there is a matching write operation address in the startup write acceleration table, and perform a 4K misaligned write operation or a normal table read according to the query result.
[0094] It should be noted that in an exemplary embodiment of the present application, step S520 further includes the following steps:
[0095] S521: Query whether there is a write operation address in the startup write acceleration table that matches the current 4K misaligned write operation;
[0096] S522: If it exists, perform a 4K misaligned write operation at the matched write operation address;
[0097] S523: If it does not exist, after reading the table normally, perform a 4K misaligned write at the corresponding write operation address, and record the write operation address of the current 4K misaligned write operation in the startup write acceleration table.
[0098] Specifically, please refer to Figure 3 As shown, in the initialization stage of device startup, load the startup write acceleration table into the Read Cache Table Buffer (RCT buf). In the subsequent stages of device startup, detect whether the currently executed write operation is a 4K misaligned write operation. If it is detected that the current write operation is a 4K misaligned write, immediately query whether there is a matched write operation address in the startup write acceleration table. If it exists, directly perform a 4K misaligned write operation at the corresponding address recorded in the startup write acceleration table, thus avoiding frequent reads and updates of the RCT table and improving the efficiency of write operations. If it does not exist, first read the RCT table to obtain the correct write operation address, then perform a 4K misaligned write operation, and at the same time record the address of this 4K misaligned write operation in the startup write acceleration table for subsequent query and use. After the end of the device host startup stage, load the normal RCT table and overwrite the storage space temporarily occupied by the startup write acceleration table before, thus restoring the normal function of the RCT table.
[0099] It should be noted that when the write operation is in an idle state during the device host startup stage, the startup write acceleration table can be used to perform pre-reading processing on subsequent potential 4K misaligned write operations to improve the execution efficiency of write operations during the device startup stage. If the pre-reading prediction is accurate, the number of read operations during the actual write operation process can be effectively reduced, thereby optimizing the overall performance. Please refer to Figure 4 As shown, during the device startup stage, when the device host startup stage enters the write operation idle state, detect whether the current eMMC memory has triggered the background GC process. If the background GC has not been triggered, it indicates that the resources are relatively abundant and the current environment can perform data pre-reading operations. In this case, perform data pre-reading on the startup write acceleration table. It should be noted that the purpose of the pre-reading process is to load the possible write operation addresses that may be needed into the cache or related processing units in advance, so as to quickly respond when subsequent write operation requests arrive. When a 4K misaligned write operation request is received subsequently, immediately detect whether the address of this request matches the pre-read address. If the match is successful, it indicates that the pre-reading operation accurately predicts the subsequent write operation requirements, and directly perform a 4K misaligned write operation at the corresponding write operation address without having to perform a read operation again to obtain the address information, thus significantly improving the execution efficiency of write operations.
[0100] In summary, a startup method provided by the present invention includes obtaining the working states of a device host and its eMMC memory. Among them, the working state of the device host includes a startup phase and an operation phase, and the working state of the eMMC memory includes an idle state and a busy state. When the device host is in the startup phase, the condition for triggering the foreground garbage collection mechanism of the eMMC memory is adjusted to a preset remaining capacity threshold to postpone the triggering time of the foreground garbage collection mechanism in the startup phase. When the eMMC memory is in the idle state, the condition for triggering the background garbage collection mechanism of the eMMC memory is dynamically adjusted according to the working state of the device host. The method dynamically adjusts the triggering time of the foreground garbage collection mechanism and the triggering frequency of the background garbage collection mechanism according to the different phases of the device host and the specific situation in the startup phase, and constructs a startup write acceleration table according to the write operation type in the startup phase of the device host, so as to achieve high-quality management of memory resources, improve the stability and performance of the device, and especially ensure that the device starts quickly and smoothly in the startup phase.
[0101] Based on the same inventive concept, please refer to Figure 5 As shown, another embodiment of the present invention further provides a device startup performance optimization device 100. The device 100 is implemented by using the device startup performance optimization method described in any of the above embodiments, and includes:
[0102] A state detection module 110, configured to obtain the working states of a device host and its eMMC memory. Among them, the working state of the device host includes a startup phase and an operation phase, and the working state of the eMMC memory includes an idle state and a busy state;
[0103] A foreground garbage collection mechanism adjustment module 120, configured to, when the device host is in the startup phase, adjust the condition for triggering the foreground garbage collection mechanism of the eMMC memory to a preset remaining capacity threshold to postpone the triggering time of the foreground garbage collection mechanism in the startup phase;
[0104] A background garbage collection mechanism adjustment module 130, configured to, when the eMMC memory is in the idle state, dynamically adjust the condition for triggering the background garbage collection mechanism of the eMMC memory according to the working state of the device host;
[0105] An acceleration table construction module 140, configured to construct a startup write acceleration table according to the write operation type executed by the device host in the startup phase, and use the startup write acceleration table for auxiliary look-up table operations when subsequent write operations are initiated, so as to reduce the look-up table frequency during the write operation process in the startup phase.
[0106] It should be noted that since the device startup performance optimization device 100 provided in this embodiment belongs to the same inventive concept as the device startup performance optimization method provided in any of the above embodiments, it has at least the same beneficial effects as them, and will not be elaborated herein one by one.
[0107] Based on the same inventive concept, please refer to Figure 6 As shown, another embodiment of the present invention further provides an electronic device 11. The electronic device 11 may include a memory 111, a processor 112, and a bus, and may further include a computer program stored in the memory 111 and executable on the processor 112, such as a program for optimizing the device startup performance.
[0108] Among them, the memory 111 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 111 may be an internal storage unit of the electronic device 11 in some embodiments, such as the mobile hard disk of the electronic device 11. The memory 111 may also be an external storage device of the electronic device 11 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the electronic device 11. Further, the memory 111 may include both an internal storage unit and an external storage device of the electronic device 11. The memory 111 can be used not only to store application software installed in the electronic device 11 and various types of data, such as the code for optimizing the device startup performance, but also to temporarily store data that has been output or will be output.
[0109] The processor 112 may be composed of integrated circuits in some embodiments. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 112 is the control core (Control Unit) of the electronic device 11, connecting various components of the entire electronic device 11 through various interfaces and circuits, and by running or executing programs or modules stored in the memory 111 (such as the program for optimizing the device startup performance, etc.), and calling data stored in the memory 111, to perform various functions of the electronic device 11 and process data.
[0110] The processor 112 executes the operating system of the electronic device 11 and various installed application programs. The processor 112 executes the application programs to implement the steps in the above-mentioned device startup performance optimization method.
[0111] Exemplarily, the computer program may be divided into one or more modules, and the one or more modules are stored in the memory 111 and executed by the processor 112 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 11. For example, the computer program may be divided into a status detection module 110, a foreground garbage collection mechanism adjustment module 120, a background garbage collection mechanism adjustment module 130, and an acceleration table construction module 140.
[0112] The above-mentioned integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium, and the computer-readable storage medium may be non-volatile or volatile. The above-mentioned software functional module is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor to execute some functions of the device startup performance optimization method described in various embodiments of the present application.
[0113] The above embodiments are only illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Any person familiar with this technology can modify or change the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field without departing from the spirit and technical idea disclosed by the present invention should still be covered by the claims of the present invention.
Claims
1. A method for optimizing the startup performance of a device, characterized in that, Including: Obtain the working states of the device host and its eMMC memory. Among them, the working state of the device host includes a startup phase and an operating phase, and the working state of the eMMC memory includes an idle state and a busy state; When the device host is in the startup phase, adjust the condition for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the trigger time of the foreground garbage collection mechanism in the startup phase; When the device host is in the startup phase and the eMMC memory is in the idle state, adjust the default time threshold for the eMMC memory to trigger the background garbage collection mechanism to a first preset time threshold, where the first preset time threshold is less than the default time threshold; Detect whether the device host has triggered the foreground garbage collection mechanism in the startup phase. If the device host has triggered the foreground garbage collection mechanism in the startup phase, adjust the first preset time threshold for the eMMC memory to trigger the background garbage collection mechanism to a second preset time threshold, where the second preset time threshold is less than the first preset time threshold.
2. The method for optimizing the device startup performance according to claim 1, wherein The obtaining the working states of the device host and its eMMC memory includes: After the device host is powered on or reset, obtain the working state and data write amount of the eMMC memory; When the data write amount of the eMMC memory is less than a preset data write amount threshold, it is determined that the device host is currently in the startup phase.
3. The method for optimizing the device startup performance according to claim 1, wherein The when the device host is in the startup phase, adjust the condition for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the trigger time of the foreground garbage collection mechanism in the startup phase, includes: Detect the current working state of the device host; If the device host is currently in the startup phase, dynamically adjust the default remaining capacity threshold for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the trigger time of the foreground garbage collection mechanism in the startup phase, where the preset remaining capacity threshold is less than the default remaining capacity threshold.
4. The method for optimizing the device startup performance according to claim 1, characterized in that, The method further includes: Detect the write operation type executed by the device host in the startup phase, and construct a startup write acceleration table according to the write operation type; When a subsequent write operation is initiated, use the startup write acceleration table for auxiliary look-up to reduce the look-up frequency during the write operation in the startup phase.
5. The method for optimizing the device startup performance according to claim 4, wherein The detecting the write operation type executed by the device host in the startup phase, and constructing a startup write acceleration table according to the write operation type, includes: Detect the write operation type executed by the device host in the startup phase; If the write operation type is a 4K misaligned write operation, construct a corresponding startup write acceleration table, and record the write operation address of the current 4K misaligned write operation in the constructed startup write acceleration table.
6. The method for optimizing the device startup performance according to claim 4, wherein The when a subsequent write operation is initiated, use the startup write acceleration table for auxiliary look-up to reduce the look-up frequency during the write operation in the startup phase, includes: Detect whether the currently initiated write operation type is a 4K misaligned write operation; If the type of the currently initiated write operation is a 4K unaligned write operation, query whether there is a matching write operation address in the startup write acceleration table, and perform a 4K unaligned write operation or a normal table read according to the query result.
7. The method for optimizing the device startup performance according to claim 6, wherein The querying whether there is a matching write operation address in the startup write acceleration table and performing a 4K unaligned write operation or a normal table read according to the query result includes: Query whether there is a write operation address in the startup write acceleration table that matches the current 4K unaligned write operation; If there is, perform a 4K unaligned write operation at the matching write operation address; If not, perform a 4K unaligned write at the corresponding write operation address after a normal table read, and record the write operation address of the current 4K unaligned write operation in the startup write acceleration table.
8. An apparatus for optimizing the startup performance of a device, characterized in that, The device is implemented by using the device startup performance optimization method according to any one of claims 1 to 7, including: A status detection module, configured to obtain the working status of the device host and its eMMC memory, where the working status of the device host includes a startup phase and an operation phase, and the working status of the eMMC memory includes an idle state and a busy state; A foreground garbage collection mechanism adjustment module, configured to, when the device host is in the startup phase, adjust the condition for the eMMC memory to trigger the foreground garbage collection mechanism to a preset remaining capacity threshold, so as to postpone the triggering time of the foreground garbage collection mechanism in the startup phase; A background garbage collection mechanism adjustment module, configured to, when the device host is in the startup phase and the eMMC memory is in the idle state, adjust the default time threshold for the eMMC memory to trigger the background garbage collection mechanism to a first preset time threshold, where the first preset time threshold is less than the default time threshold, detect whether the device host has triggered the foreground garbage collection mechanism in the startup phase, and if the device host has triggered the foreground garbage collection mechanism in the startup phase, adjust the first preset time threshold for the eMMC memory to trigger the background garbage collection mechanism to a second preset time threshold, where the second preset time threshold is less than the first preset time threshold; An acceleration table construction module, configured to construct a startup write acceleration table according to the type of write operation performed by the device host in the startup phase, and use the startup write acceleration table for auxiliary table look-up operations when subsequent write operations are initiated, so as to reduce the table look-up frequency during the write operation process in the startup phase.
9. An electronic device, characterized in that, The electronic device includes: One or more processors; A storage device, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, enable the electronic device to implement the device startup performance optimization method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is enabled to execute the device startup performance optimization method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Application program starting method and system, storage medium and mobile equipment
CN110633113A
Application program hot start method and device, equipment and storage medium
CN119883589A