Flash memory capacity optimization method and device, equipment and storage medium
By obtaining the working voltage data of the flash memory, evaluating its stability, combining the memory capacity ratio, selecting appropriate algorithms and parameters for optimization, the problem of flash memory capacity optimization is solved and the stability and efficiency improvement is achieved.
Patent Information
- Application Number
- CN202510426503.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-08-01
AI Technical Summary
How to optimize flash memory capacity to adapt to the requirements of improving storage performance by the development of electronic technology.
By obtaining the working voltage data of the flash within a certain period of time, determining its stability evaluation value, combining the ratio of the total memory capacity to the current memory capacity, selecting appropriate memory optimization algorithms and algorithm control parameters to perform memory optimization processing on the flash memory.
Accurately evaluate the working stability and utilization rate of flash memory, deeply adapt the algorithm to control parameters, realize the optimization of memory capacity, and ensure stability and efficiency.
Smart Images

Figure CN120407432A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a flash memory capacity optimization method, apparatus, device and storage medium. Background Art
[0002] With the rapid development of electronic technology, storage technology has become increasingly popular, and the requirements for storage performance have become increasingly higher. Taking flash memory as an example, the actual use process has also led to higher and higher requirements for flash memory. To a certain extent, the problem of how to optimize flash memory capacity also needs to be solved urgently. Summary of the Invention
[0003] The embodiments of the present application provide a flash memory capacity optimization method, apparatus, device and storage medium, which can achieve flash memory capacity optimization.
[0004] In a first aspect, an embodiment of the present application provides a flash memory capacity optimization method, which is applied to an electronic device, wherein the electronic device includes a flash memory, and the method includes:
[0005] Acquire operating voltage data of the flash memory within a first time period; the first time period is a time period before and including the current moment;
[0006] determining a first stability evaluation value of the flash memory according to the operating voltage data; a greater first stability evaluation value indicates a better stability of the flash memory;
[0007] Obtaining the total memory capacity and current memory capacity of the flash memory;
[0008] determining a first ratio between the current memory capacity and the total memory capacity;
[0009] determining a stability threshold corresponding to the first ratio;
[0010] determining a first memory optimization algorithm corresponding to the first ratio;
[0011] Obtaining a first algorithm control parameter corresponding to the first memory optimization algorithm;
[0012] determining a second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter;
[0013] Memory optimization processing is performed on the flash memory according to the first memory optimization algorithm and the second algorithm control parameters to obtain a target memory optimization result.
[0014] In a second aspect, an embodiment of the present application provides a flash memory capacity optimization device, which is applied to an electronic device, wherein the electronic device includes a flash memory, and the device includes: an acquisition unit, a determination unit, and a memory optimization unit, wherein:
[0015] The obtaining unit is configured to obtain the working voltage data of the flash memory within a first time period; the first time period is a time period before and including the current moment between the current moment;
[0016] The determining unit is configured to determine a first stability evaluation value of the flash memory according to the working voltage data; the greater the first stability evaluation, the better the stability of the flash memory;
[0017] The obtaining unit is further configured to obtain the total memory capacity and the current memory capacity of the flash memory;
[0018] The determining unit is further configured to determine a first ratio between the current memory capacity and the total memory capacity; determine a stability threshold corresponding to the first ratio; determine a first memory optimization algorithm corresponding to the first ratio;
[0019] The obtaining unit is further configured to obtain a first algorithm control parameter corresponding to the first memory optimization algorithm;
[0020] The determining unit is further configured to determine a second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter;
[0021] The memory optimization unit is configured to perform a memory optimization process on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain a target memory optimization result.
[0022] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for performing the steps in the first aspect of the embodiments of the present application.
[0023] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute some or all of the steps described in the first aspect of the embodiments of the present application.
[0024] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
[0025] Implementing the embodiments of the present application has the following beneficial effects:
[0026] It can be seen that the flash memory capacity optimization method, device, equipment, and storage medium described in the embodiments of the present application are applied to an electronic device. The electronic device includes a flash memory, and the working voltage data of the flash memory within a first time period is obtained. The first time period is a time period before and including the current moment. The first stability evaluation value of the flash memory is determined according to the working voltage data. The greater the first stability evaluation, the better the stability of the flash memory. The total memory capacity and the current memory capacity of the flash memory are obtained, the first ratio between the current memory capacity and the total memory capacity is determined, the stability threshold corresponding to the first ratio is determined, the first memory optimization algorithm corresponding to the first ratio is determined, the first algorithm control parameter corresponding to the first memory optimization algorithm is obtained, the second algorithm control parameter is determined according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter, and the flash memory is subjected to memory optimization processing according to the first memory optimization algorithm and the second algorithm control parameter to obtain the target memory optimization result. First, the working voltage data can reflect the working stability of the flash memory to a certain extent, that is, the working stability of the corresponding flash memory can be accurately determined by using the working voltage data. Second, the first ratio can reflect the flash memory usage rate or flash memory occupancy rate to a certain extent, that is, the stability threshold corresponding to the actual flash memory usage rate or flash memory occupancy rate can be determined. Third, the algorithm control parameters corresponding to the actual stability of the flash memory can be deeply adapted. Therefore, while optimizing the memory, the memory capacity optimization effect can be ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0028] Figure 1 It is a schematic flowchart of a flash memory capacity optimization method provided by an embodiment of the present application;
[0029] Figure 2 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0030] Figure 3 It is a schematic structural diagram of another electronic device provided by an embodiment of the present application;
[0031] Figure 4 It is a block diagram of the functional units of a flash memory capacity optimization device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] To enable those skilled in the art to better understand the solution of this application, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
[0033] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned accompanying drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0034] Referring to "embodiment" herein means that a specific feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of this application. The phrase appears in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0035] In the embodiments of this application, the electronic device involved can be a device with communication capabilities. The electronic device can include various handheld devices with storage functions, vehicle-mounted devices (such as dash cams, in-vehicle cameras, car speakers, etc.), smart home devices, wearable devices (such as smart glasses, smart bracelets, Internet of Things devices (such as smart refrigerators, smart washing machines, smart TVs), smart watches, etc.), smart mobile power supplies, smart mobile hard drives, computing devices or other processing devices connected to a wireless modem, as well as various forms of user equipment (User Equipment, UE), mobile stations (Mobile Station, MS), terminal devices, etc.
[0036] The following will introduce the embodiments of this application in detail.
[0037] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of a flash memory capacity optimization method provided by an embodiment of this application. As shown in the figure, it is applied to an electronic device, and the electronic device includes a flash memory. The flash memory capacity optimization method includes:
[0038] 101. Obtain the working voltage data of the flash memory within the first time period; the first time period is a time period before and including the current moment.
[0039] Among them, as Figure 2 shown, the electronic device may include a flash memory. The time length of the first time period can be set in advance or be the system default. The first time period is a time period before and including the current moment. The time length of the first time period can be related to the remaining service life of the flash memory, or the time length of the first time period can be related to the device attributes of the flash memory, and the device attributes may include at least one of the following: device model, circuit structure of the flash memory, etc., which are not limited herein.
[0040] In specific implementation, the working voltage data of the flash memory within the first time period can be obtained, and this working voltage data reflects the working stability of the flash memory to a certain extent.
[0041] 102. Determine the first stability evaluation value of the flash memory according to the working voltage data; the larger the first stability evaluation, the better the stability of the flash memory.
[0042] Among them, in specific implementation, the first stability evaluation value of the flash memory can be determined according to the working voltage data. The larger the first stability evaluation, the better the stability of the flash memory. The first stability evaluation value reflects the degree of stability of the flash memory, that is, the quality of the flash memory stability.
[0043] Optionally, the working voltage data includes multiple voltage data, and each voltage data corresponds to a sampling moment; in step 102 above, determining the first stability evaluation value of the flash memory according to the working voltage data can be implemented as follows:
[0044] Perform fitting according to the multiple voltage data and the corresponding sampling moments to obtain a fitting straight line, and obtain the absolute value of the slope of the fitting straight line to obtain the first absolute value;
[0045] Determine the voltage difference corresponding to two adjacent sampling moments according to the multiple voltage data to obtain multiple voltage differences;
[0046] Perform standard deviation operation according to the multiple voltage differences to obtain the first standard deviation;
[0047] Determine the first reference stability evaluation value corresponding to the first absolute value;
[0048] Determine the second reference stability evaluation value corresponding to the first standard deviation;
[0049] Obtain the target weight pair;
[0050] Performing a weighted operation on the first reference stability evaluation value, the second reference stability evaluation value, and the target weight pair to obtain the first stability evaluation value.
[0051] Among them, the working voltage data may include multiple voltage data, and each voltage data corresponds to a sampling moment. In a specific implementation, voltage data can be collected at preset time intervals, and the preset time interval can be set in advance or be the system default.
[0052] In a specific implementation, fitting can be performed based on multiple voltage data and the corresponding sampling moments to obtain a fitting straight line. Specifically, each voltage data and the corresponding sampling moment can be mapped to a coordinate system, that is, regarded as a coordinate point. The horizontal axis of this coordinate system is time, and the vertical axis is voltage. Correspondingly, multiple voltage data and the corresponding sampling moments can be regarded as multiple coordinate points, and then these multiple coordinate points can be fitted to obtain a fitting straight line.
[0053] Next, the absolute value of the slope of the fitting straight line can be obtained to get a first absolute value, and the first absolute value reflects the change trend of the working stability of the flash memory to a certain extent. Then, based on multiple voltage data, the voltage difference corresponding to two adjacent sampling moments is determined to obtain multiple voltage differences, and the voltage difference reflects the voltage difference between each sampling time interval.
[0054] Furthermore, standard deviation operation can be performed based on multiple voltage differences to obtain a first standard deviation, and the first standard deviation reflects the fluctuation of the working stability of the flash memory to a certain extent.
[0055] Next, the mapping relationship between the preset absolute value and the stability evaluation value can be stored in advance. Furthermore, based on this mapping relationship, the first reference stability evaluation value corresponding to the first absolute value can be determined. The mapping relationship between the preset standard deviation and the stability evaluation value can also be stored in advance. Furthermore, based on this mapping relationship, the second reference stability evaluation value corresponding to the first standard deviation can be determined. Then, the target weight pair is obtained. The target weight pair can include two weights, and the sum of the two weights is 1. Finally, performing a weighted operation on the first reference stability evaluation value, the second reference stability evaluation value, and the target weight pair to obtain the first stability evaluation value. In this way, the stability of the flash memory can be evaluated from two dimensions: the change trend of the working stability of the flash memory and the fluctuation of the working stability of the flash memory. In this way, the stability evaluation value of the flash memory can be deeply determined, and thus the actual stability evaluation value of the flash memory can be accurately evaluated.
[0056] Optionally, the target weight pair includes a target first weight and a target second weight. The above step of obtaining the target weight pair may include the following steps:
[0057] Obtain the current working temperature of the flash memory at the current moment;
[0058] Determine a reference weight pair corresponding to the current operating temperature, the reference weight pair including a first weight and a second weight; the sum of the first weight and the second weight is 1; the first weight is the weight corresponding to the first reference stability evaluation value, and the second weight is the weight corresponding to the second reference stability evaluation value;
[0059] Obtain the ambient temperature at the current moment;
[0060] Determine a second deviation degree between the current operating temperature and the ambient temperature;
[0061] Determine a first feedback adjustment parameter corresponding to the second deviation degree;
[0062] Perform feedback adjustment on the first weight according to the first feedback adjustment parameter to obtain the target first weight;
[0063] Determine the target second weight according to the target first weight.
[0064] In specific implementation, the current operating temperature of the flash memory at the current moment can be obtained. Different temperatures correspond to different weight pairs. Furthermore, the mapping relationship between the preset operating temperature and the weight pair can be stored in advance. That is, the reference weight pair corresponding to the current operating temperature can be determined based on this mapping relationship. The reference weight pair includes a first weight and a second weight; the sum of the first weight and the second weight is 1. The first weight is the weight corresponding to the first reference stability evaluation value, and the second weight is the weight corresponding to the second reference stability evaluation value.
[0065] Next, the ambient temperature at the current moment can also be obtained, and then the second deviation degree between the current operating temperature and the ambient temperature can be determined. The second deviation degree = (current operating temperature - ambient temperature) / current ambient temperature. The mapping relationship between the preset deviation degree and the feedback adjustment parameter can also be stored in advance. Furthermore, the first feedback adjustment parameter corresponding to the second deviation degree can be determined based on this mapping relationship, and then the first weight is feedback-adjusted according to the first feedback adjustment parameter to obtain the target first weight, as follows:
[0066] Target first weight = (1 + first feedback adjustment parameter) * first weight
[0067] Finally, the target second weight can be determined according to the target first weight, that is, target second weight = 1 - target first weight.
[0068] In this example, since different temperatures have different perturbation effects on two dimensions, namely the changing trend of the working stability of the flash memory and the fluctuation of the working stability of the flash memory, the corresponding weight pair can be determined according to the actual temperature of the flash memory. In addition, the second deviation reflects the deviation degree between the actual temperature of the flash memory and the ambient temperature. Based on this deviation degree, the weight pair is feedback-regulated to make the final weight pair depth conform to the actual situation, which helps to determine the stability evaluation value of the flash memory accurately, and thus, accurately evaluate the actual stability evaluation value of the flash memory.
[0069] 103. Obtain the total memory capacity and the current memory capacity of the flash memory.
[0070] In specific implementation, the total memory capacity of the flash memory can be obtained, and the current memory capacity, that is, the used memory capacity, can also be obtained.
[0071] 104. Determine the first ratio between the current memory capacity and the total memory capacity.
[0072] Among them, the ratio between the current memory capacity and the total memory capacity can be determined to obtain the first ratio. The first ratio = current memory capacity / total memory capacity. The first ratio reflects the flash memory usage rate or flash memory occupancy rate to a certain extent.
[0073] 105. Determine the stability threshold corresponding to the first ratio.
[0074] Among them, in specific implementation, the mapping relationship between the preset ratio and the stability threshold can be set in advance. Then, the stability threshold corresponding to the first ratio can be determined based on this mapping relationship. That is, for different ratios, the stability threshold is different. In this way, the stability threshold corresponding to the actual flash memory usage rate or flash memory occupancy rate can be determined.
[0075] Among them, when the first stability evaluation value is greater than or equal to the stability threshold, it indicates that the working state of the flash memory is stable. On the contrary, when the first stability evaluation value is less than the stability threshold, it indicates that the working state of the flash memory is unstable.
[0076] For example, when the remaining space is small, the performance may decrease because the flash memory needs to perform erase and rewrite operations when writing data, and insufficient remaining space will lead to more erase operations, thus affecting the writing performance and also the stability of the flash memory.
[0077] Optionally, for step 105 above, determining the stability threshold corresponding to the first ratio can be implemented as follows:
[0078] Determine the reference stability threshold corresponding to the first ratio;
[0079] Obtain the current data read and write speed of the flash memory;
[0080] Determine a first fine-tuning parameter corresponding to the current data read / write speed;
[0081] Fine-tune the reference stability threshold according to the first fine-tuning parameter to obtain the stability threshold corresponding to the first ratio.
[0082] In specific implementation, a mapping relationship between a preset ratio and a stability threshold can be set in advance, and then based on this mapping relationship, the reference stability threshold corresponding to the first ratio can be determined, the current data read / write speed of the flash memory can be obtained, and then a mapping relationship between a preset data read / write speed and a fine-tuning parameter can be stored in advance. Based on this mapping relationship, the first fine-tuning parameter corresponding to the current data read / write speed can be determined. Finally, the reference stability threshold can be fine-tuned according to the first fine-tuning parameter to obtain the stability threshold corresponding to the first ratio, that is, the stability threshold corresponding to the first ratio = (1 + first fine-tuning parameter) * reference stability threshold. In this way, not only can the stability threshold corresponding to the actual flash memory usage rate or flash memory occupancy rate be determined, but also fine-tuning can be performed based on the actual data read / write speed, so that the final stability threshold depth conforms to the actual situation.
[0083] 106. Determine a first memory optimization algorithm corresponding to the first ratio.
[0084] In specific implementation, a mapping relationship between a preset ratio and a memory optimization algorithm can be stored in advance. Furthermore, based on this mapping relationship, the first memory optimization algorithm corresponding to the first ratio can be determined. In this way, a memory optimization algorithm corresponding to the actual flash memory usage rate or flash memory occupancy rate can be obtained. [[ID=...]]
[0085] Among them, the memory optimization algorithm may include at least one of the following: cache replacement algorithm, prefetch algorithm, delayed allocation algorithm, memory compression algorithm, etc., which are not limited herein. The memory compression algorithm may include at least one of the following: Huffman coding-based memory compression algorithm, LZ77- and LZ78-based memory compression algorithm, dictionary-based memory compression algorithm, neural network-based memory compression algorithm, etc., which are not limited herein.
[0086] 107. Obtain a first algorithm control parameter corresponding to the first memory optimization algorithm.
[0087] In specific implementation, the first algorithm control parameter is used to control the optimization effect of the first memory optimization algorithm, and the optimization effect may include at least one of the following: optimization speed, optimization degree, etc., which are not limited herein.
[0088] Optionally, for step 107 above, obtaining the first algorithm control parameter corresponding to the first memory optimization algorithm is implemented in the following manner:
[0089] Obtain an algorithm control parameter set corresponding to the first memory optimization algorithm, where the algorithm control parameter set includes multiple algorithm control parameters, and each algorithm control parameter corresponds to a stability evaluation value;
[0090] Determine the absolute value of the difference between the stability evaluation values corresponding to the multiple algorithm control parameters and the first stability evaluation value to obtain multiple absolute values;
[0091] Select the minimum value among the multiple absolute values, obtain the algorithm control parameter corresponding to the minimum value, and obtain the first algorithm control parameter.
[0092] In specific implementation, an algorithm control parameter set corresponding to the first memory optimization algorithm can be obtained. The algorithm control parameter set may include multiple algorithm control parameters, and each algorithm control parameter corresponds to a stability evaluation value. It is also possible to determine the absolute value of the difference between the stability evaluation values corresponding to the multiple algorithm control parameters and the first stability evaluation value to obtain multiple absolute values, then select the minimum value among the multiple absolute values, obtain the algorithm control parameter corresponding to the minimum value, and obtain the first algorithm control parameter. In this way, algorithm control parameters corresponding to the actual stability of the flash memory can be adapted, so that while optimizing the memory, the memory capacity optimization effect can be ensured.
[0093] 108. Determine a second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter.
[0094] In specific implementation, a second algorithm control parameter can be determined based on the first stability evaluation value, the stability threshold, and the first algorithm control parameter, that is, the first stability evaluation value and the stability threshold reflect the actual stability to determine the corresponding algorithm control parameter. In this way, algorithm control parameters corresponding to the actual stability of the flash memory can be deeply adapted, so that while optimizing the memory, the memory capacity optimization effect can be ensured.
[0095] Optionally, in step 108 above, determining the second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter can be implemented as follows:
[0096] Determine the first deviation degree between the first stability evaluation value and the stability threshold;
[0097] Determine the first optimization coefficient corresponding to the first deviation degree;
[0098] Optimize the first algorithm control parameter according to the first optimization coefficient to obtain the second algorithm control parameter.
[0099] Among them, the first deviation degree between the first stability evaluation value and the stability threshold can be determined, that is, the first deviation degree = (the first stability evaluation value - the stability threshold) / the stability threshold, and the first deviation degree reflects the quality of stability.
[0100] Next, the mapping relationship between the preset deviation degree and the optimization coefficient can also be pre-stored. Furthermore, based on this mapping relationship, the first optimization coefficient corresponding to the first deviation degree can be determined, and then the first algorithm control parameter can be optimized according to the first optimization coefficient to obtain the second algorithm control parameter, that is, the second algorithm control parameter = (1 + the first optimization coefficient) * the first algorithm control parameter. In this way, the algorithm control parameter corresponding to the actual stability of the flash memory can be deeply adapted, so that while optimizing the memory, the memory capacity optimization effect can be ensured.
[0101] 109. Perform memory optimization processing on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain the target memory optimization result.
[0102] In specific implementation, the flash memory can be subjected to memory optimization processing according to the first memory optimization algorithm and the second algorithm control parameter to obtain the target memory optimization result. In this way, the algorithm control parameter corresponding to the actual stability of the flash memory can be deeply adapted, so that while optimizing the memory, the memory capacity optimization effect can be ensured.
[0103] It can be seen that the flash memory capacity optimization method described in the embodiments of the present application is applied to an electronic device. The electronic device includes a flash memory, and the working voltage data of the flash memory within the first time period is obtained; the first time period is a time period before and including the current moment. The first stability evaluation value of the flash memory is determined according to the working voltage data; the greater the first stability evaluation, the better the stability of the flash memory. The total memory capacity and the current memory capacity of the flash memory are obtained, the first ratio between the current memory capacity and the total memory capacity is determined, the stability threshold corresponding to the first ratio is determined, the first memory optimization algorithm corresponding to the first ratio is determined, the first algorithm control parameter corresponding to the first memory optimization algorithm is obtained, the second algorithm control parameter is determined according to the first stability evaluation value, the stability threshold and the first algorithm control parameter, and the flash memory is subjected to memory optimization processing according to the first memory optimization algorithm and the second algorithm control parameter to obtain the target memory optimization result. First, the working voltage data can reflect the working stability of the flash memory to a certain extent, that is, the working stability of the corresponding flash memory can be accurately determined by using the working voltage data. Second, the first ratio reflects the flash memory usage rate or flash memory occupancy rate to a certain extent, that is, the stability threshold corresponding to the actual flash memory usage rate or flash memory occupancy rate can be determined. Third, the algorithm control parameter corresponding to the actual stability of the flash memory can be deeply adapted, so that while optimizing the memory, the memory capacity optimization effect can be ensured.
[0104] Consistent with the above embodiments, please refer to Figure 3 , Figure 3 which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As shown in the figure, the electronic device includes a processor, a memory, a communication interface, and one or more programs. The above one or more programs are stored in the above memory and are configured to be executed by the above processor. In the embodiment of the present application, the electronic device includes a flash memory, and the above program includes instructions for performing the following steps:
[0105] Obtain the working voltage data of the flash memory within a first time period; the first time period is a time period before and including the current moment;
[0106] Determine a first stability evaluation value of the flash memory according to the working voltage data; the greater the first stability evaluation, the better the stability of the flash memory;
[0107] Obtain the total memory capacity and the current memory capacity of the flash memory;
[0108] Determine a first ratio between the current memory capacity and the total memory capacity;
[0109] Determine a stability threshold corresponding to the first ratio;
[0110] Determine a first memory optimization algorithm corresponding to the first ratio;
[0111] Obtain a first algorithm control parameter corresponding to the first memory optimization algorithm;
[0112] Determine a second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter;
[0113] Perform memory optimization processing on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain a target memory optimization result.
[0114] Optionally, in terms of determining the second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter, the above program includes instructions for performing the following steps:
[0115] Determine a first deviation degree between the first stability evaluation value and the stability threshold;
[0116] Determine a first optimization coefficient corresponding to the first deviation degree;
[0117] Optimize the first algorithm control parameter according to the first optimization coefficient to obtain the second algorithm control parameter.
[0118] Optionally, the operating voltage data includes a plurality of voltage data, and each voltage data corresponds to a sampling moment; in terms of determining the first stability evaluation value of the flash memory according to the operating voltage data, the above program includes instructions for performing the following steps:
[0119] Perform fitting according to the plurality of voltage data and the corresponding sampling moments to obtain a fitting line, and obtain the absolute value of the slope of the fitting line to obtain a first absolute value;
[0120] Determine the voltage differences corresponding to two adjacent sampling moments according to the plurality of voltage data to obtain a plurality of voltage differences;
[0121] Perform standard deviation calculation according to the plurality of voltage differences to obtain a first standard deviation;
[0122] Determine a first reference stability evaluation value corresponding to the first absolute value;
[0123] Determine a second reference stability evaluation value corresponding to the first standard deviation;
[0124] Obtain a target weight pair;
[0125] Perform weighted calculation according to the first reference stability evaluation value, the second reference stability evaluation value and the target weight pair to obtain the first stability evaluation value.
[0126] Optionally, the target weight pair includes a target first weight and a target second weight. In terms of obtaining the target weight pair, the above program includes instructions for performing the following steps:
[0127] Obtain the current operating temperature of the flash memory at the current moment;
[0128] Determine a reference weight pair corresponding to the current operating temperature. The reference weight pair includes a first weight and a second weight; the sum of the first weight and the second weight is 1; the first weight is the weight corresponding to the first reference stability evaluation value, and the second weight is the weight corresponding to the second reference stability evaluation value;
[0129] Obtain the ambient temperature at the current moment;
[0130] Determine a second deviation degree between the current operating temperature and the ambient temperature;
[0131] Determine a first feedback adjustment parameter corresponding to the second deviation degree;
[0132] Perform feedback adjustment on the first weight according to the first feedback adjustment parameter to obtain the target first weight;
[0133] Determine the target second weight value according to the target first weight value.
[0134] Optionally, in terms of determining the stability threshold corresponding to the first ratio, the above program includes instructions for performing the following steps:
[0135] Determine the reference stability threshold corresponding to the first ratio;
[0136] Obtain the current data read / write speed of the flash memory;
[0137] Determine the first fine-tuning parameter corresponding to the current data read / write speed;
[0138] Fine-tune the reference stability threshold according to the first fine-tuning parameter to obtain the stability threshold corresponding to the first ratio.
[0139] It can be seen that in the electronic device described in the embodiments of the present application, the electronic device includes a flash memory, and obtains the working voltage data of the flash memory within a first time period; the first time period is a time period before and including the current moment, and determines the first stability evaluation value of the flash memory according to the working voltage data; the greater the first stability evaluation, the better the stability of the flash memory, obtains the total memory capacity and the current memory capacity of the flash memory, determines the first ratio between the current memory capacity and the total memory capacity, determines the stability threshold corresponding to the first ratio, determines the first memory optimization algorithm corresponding to the first ratio, obtains the first algorithm control parameter corresponding to the first memory optimization algorithm, determines the second algorithm control parameter according to the first stability evaluation value, the stability threshold and the first algorithm control parameter, and performs memory optimization processing on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain the target memory optimization result. First, the working voltage data can reflect the working stability of the flash memory to a certain extent, that is, the working stability of the corresponding flash memory can be accurately determined by using the working voltage data. Second, the first ratio can reflect the flash memory usage rate or flash memory occupancy rate to a certain extent, that is, the stability threshold corresponding to the actual flash memory usage rate or flash memory occupancy rate can be determined. Third, the algorithm control parameters can be deeply adapted to the actual stability of the flash memory. Therefore, while optimizing the memory, the memory capacity optimization effect can be ensured.
[0140] Figure 4 It is a functional unit composition block diagram of a flash memory capacity optimization device 400 involved in the embodiments of the present application. The flash memory capacity optimization device 400 is applied to an electronic device, the electronic device includes a flash memory, and the flash memory capacity optimization device 400 includes: an acquisition unit 401, a determination unit 402, and a memory optimization unit 403, where,
[0141] The obtaining unit 401 is configured to obtain the working voltage data of the flash memory within a first time period; the first time period is a time period before and including the current moment between the current moment;
[0142] The determining unit 402 is configured to determine a first stability evaluation value of the flash memory according to the working voltage data; the greater the first stability evaluation, the better the stability of the flash memory;
[0143] The obtaining unit 401 is further configured to obtain the total memory capacity and the current memory capacity of the flash memory;
[0144] The determining unit 402 is further configured to determine a first ratio between the current memory capacity and the total memory capacity; determine a stability threshold corresponding to the first ratio; determine a first memory optimization algorithm corresponding to the first ratio;
[0145] The obtaining unit 401 is further configured to obtain a first algorithm control parameter corresponding to the first memory optimization algorithm;
[0146] The determining unit 402 is further configured to determine a second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter;
[0147] The memory optimization unit 403 is configured to perform memory optimization processing on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain a target memory optimization result.
[0148] Optionally, in terms of determining the second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter, the determining unit 402 is specifically configured to:
[0149] Determine a first deviation degree between the first stability evaluation value and the stability threshold;
[0150] Determine a first optimization coefficient corresponding to the first deviation degree;
[0151] Optimize the first algorithm control parameter according to the first optimization coefficient to obtain the second algorithm control parameter.
[0152] Optionally, the working voltage data includes a plurality of voltage data, and each voltage data corresponds to a sampling moment; in terms of determining the first stability evaluation value of the flash memory according to the working voltage data, the determining unit 402 is specifically configured to:
[0153] Perform fitting according to the plurality of voltage data and the corresponding sampling moments to obtain a fitting straight line, and obtain an absolute value of the slope of the fitting straight line to obtain a first absolute value;
[0154] Determine the voltage differences corresponding to two adjacent sampling moments based on the multiple voltage data to obtain multiple voltage differences;
[0155] Perform a standard deviation operation on the multiple voltage differences to obtain a first standard deviation;
[0156] Determine a first reference stability evaluation value corresponding to the first absolute value;
[0157] Determine a second reference stability evaluation value corresponding to the first standard deviation;
[0158] Obtain a target weight pair;
[0159] Perform a weighted operation based on the first reference stability evaluation value, the second reference stability evaluation value, and the target weight pair to obtain the first stability evaluation value.
[0160] Optionally, the target weight pair includes a target first weight and a target second weight. In terms of obtaining the target weight pair, the determining unit 402 is specifically configured to:
[0161] Obtain the current working temperature of the flash memory at the current moment;
[0162] Determine a reference weight pair corresponding to the current working temperature. The reference weight pair includes a first weight and a second weight; the sum of the first weight and the second weight is 1; the first weight is the weight corresponding to the first reference stability evaluation value, and the second weight is the weight corresponding to the second reference stability evaluation value;
[0163] Obtain the ambient temperature at the current moment;
[0164] Determine a second deviation degree between the current working temperature and the ambient temperature;
[0165] Determine a first feedback adjustment parameter corresponding to the second deviation degree;
[0166] Perform feedback adjustment on the first weight according to the first feedback adjustment parameter to obtain the target first weight; [[ID=u40]]
[0167] Determine the target second weight according to the target first weight.
[0168] Optionally, in terms of determining the stability threshold corresponding to the first ratio, the determining unit 4022 is specifically configured to:
[0169] Determine a reference stability threshold corresponding to the first ratio;
[0170] Obtain the current data read / write speed of the flash memory;
[0171] Determine a first fine-tuning parameter corresponding to the current data read / write speed;
[0172] Fine-tune the reference stability threshold according to the first fine-tuning parameter to obtain the stability threshold corresponding to the first ratio.
[0173] It can be seen that the flash memory capacity optimization device described in the embodiments of the present application is applied to an electronic device. The electronic device includes a flash memory, and obtains the working voltage data of the flash memory within a first time period. The first time period is a time period before and including the current moment. Determine the first stability evaluation value of the flash memory according to the working voltage data. The greater the first stability evaluation, the better the stability of the flash memory. Obtain the total memory capacity and the current memory capacity of the flash memory, determine the first ratio between the current memory capacity and the total memory capacity, determine the stability threshold corresponding to the first ratio, determine the first memory optimization algorithm corresponding to the first ratio, obtain the first algorithm control parameter corresponding to the first memory optimization algorithm, and determine the second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter. Perform memory optimization processing on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain the target memory optimization result. First, the working voltage data can reflect the working stability of the flash memory to a certain extent, that is, the working stability of the corresponding flash memory can be accurately determined by using the working voltage data. Second, the first ratio reflects the flash memory usage rate or flash memory occupancy rate to a certain extent, that is, the stability threshold corresponding to the actual flash memory usage rate or flash memory occupancy rate can be determined. Third, the algorithm control parameters corresponding to the actual stability of the flash memory can be deeply adapted. Therefore, while optimizing the memory, the memory capacity optimization effect can be ensured.
[0174] It can be understood that the functions of the various program modules of the flash memory capacity optimization device in this embodiment can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can refer to the relevant descriptions of the above method embodiments and will not be elaborated here.
[0175] The embodiments of the present application also provide a computer storage medium. The computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute some or all of the steps of any of the methods described in the above method embodiments.
[0176] The embodiments of the present application also provide a computer program product. The computer program product includes a non-transitory computer-readable storage medium storing a computer program. The computer program is operable to enable a computer to execute some or all of the steps of any of the methods described in the above method embodiments. The computer program product can be a software installation package.
[0177] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0178] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0179] In several embodiments provided by this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the above division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in electrical or other forms.
[0180] The units described as separate components above may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0181] In addition, in each embodiment of this application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0182] When the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the above methods in various embodiments of this application. The aforementioned memory includes: various media such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), external hard drives, magnetic disks, or optical discs that can store program codes.
[0183] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program. This program can be stored in a computer-readable memory, and the memory can include: flash drives, read-only memories (abbreviation: ROM), random access memories (abbreviation: RAM), magnetic disks, or optical discs, etc.
[0184] The above has introduced the embodiments of this application in detail. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A flash memory capacity optimization method, characterized in that Applied to an electronic device, the electronic device includes a flash memory, and the method includes: Obtain the working voltage data of the flash memory within a first time period; the first time period is a time period before and including the current moment; Determine a first stability evaluation value of the flash memory according to the working voltage data; the greater the first stability evaluation, the better the stability of the flash memory; Obtain the total memory capacity and the current memory capacity of the flash memory; Determine a first ratio between the current memory capacity and the total memory capacity; Determine a stability threshold corresponding to the first ratio; Determine a first memory optimization algorithm corresponding to the first ratio; Obtain a first algorithm control parameter corresponding to the first memory optimization algorithm; Determine a second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter; Perform a memory optimization process on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain a target memory optimization result.
2. The method according to claim 1, wherein The determining the second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter includes: Determine a first deviation degree between the first stability evaluation value and the stability threshold; Determine a first optimization coefficient corresponding to the first deviation degree; Optimize the first algorithm control parameter according to the first optimization coefficient to obtain the second algorithm control parameter.
3. The method according to claim 1 or 2, characterized in that, The working voltage data includes a plurality of voltage data, and each voltage data corresponds to a sampling moment; the determining the first stability evaluation value of the flash memory according to the working voltage data includes: Perform fitting according to the plurality of voltage data and the corresponding sampling moments to obtain a fitting straight line, and obtain the absolute value of the slope of the fitting straight line to obtain a first absolute value; Determine the voltage difference corresponding to two adjacent sampling moments according to the plurality of voltage data to obtain a plurality of voltage differences; Perform a standard deviation operation according to the plurality of voltage differences to obtain a first standard deviation; Determine a first reference stability evaluation value corresponding to the first absolute value; Determine a second reference stability evaluation value corresponding to the first standard deviation; Obtain a target weight pair; Perform a weighted operation according to the first reference stability evaluation value, the second reference stability evaluation value, and the target weight pair to obtain the first stability evaluation value.
4. The method according to claim 3, wherein The target weight pair includes a target first weight and a target second weight, and the obtaining the target weight pair includes: Obtain the current working temperature of the flash memory at the current moment; Determine a reference weight pair corresponding to the current working temperature, the reference weight pair includes a first weight and a second weight; the sum of the first weight and the second weight is 1; the first weight is the weight corresponding to the first reference stability evaluation value, and the second weight is the weight corresponding to the second reference stability evaluation value; Obtain the ambient temperature at the current moment; Determine a second deviation degree between the current working temperature and the ambient temperature; Determine a first feedback adjustment parameter corresponding to the second deviation degree; Feedback - adjust the first weight according to the first feedback - adjustment parameter to obtain the target first weight; Determine the target second weight according to the target first weight.
5. The method according to claim 1 or 2, characterized in that, The determining the stability threshold corresponding to the first ratio includes: Determine a reference stability threshold corresponding to the first ratio; Obtain the current data read - write speed of the flash memory; Determine a first fine - tuning parameter corresponding to the current data read - write speed; Fine - tune the reference stability threshold according to the first fine - tuning parameter to obtain the stability threshold corresponding to the first ratio.
6. A flash memory capacity optimization device, characterized in that, Applied to an electronic device, the electronic device includes a flash memory, and the device includes: an acquisition unit, a determination unit, and a memory optimization unit, where, The acquisition unit is configured to acquire the working voltage data of the flash memory within a first time period; the first time period is a time period before and including the current moment; The determination unit is configured to determine a first stability evaluation value of the flash memory according to the working voltage data; the larger the first stability evaluation, the better the stability of the flash memory; The acquisition unit is further configured to acquire the total memory capacity and the current memory capacity of the flash memory; The determination unit is further configured to determine a first ratio between the current memory capacity and the total memory capacity; determine the stability threshold corresponding to the first ratio; determine a first memory optimization algorithm corresponding to the first ratio; The acquisition unit is further configured to acquire a first algorithm control parameter corresponding to the first memory optimization algorithm; The determination unit is further configured to determine a second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter; The memory optimization unit is configured to perform memory optimization processing on the flash memory according to the first memory optimization algorithm and the second algorithm control parameter to obtain a target memory optimization result.
7. The device according to claim 6, characterized in that, In terms of determining the second algorithm control parameter according to the first stability evaluation value, the stability threshold, and the first algorithm control parameter, the determination unit is specifically configured to: Determine a first deviation degree between the first stability evaluation value and the stability threshold; Determine a first optimization coefficient corresponding to the first deviation degree; Optimize the first algorithm control parameter according to the first optimization coefficient to obtain the second algorithm control parameter.
8. The device according to claim 6 or 7, characterized in that, The working voltage data includes a plurality of voltage data, and each voltage data corresponds to a sampling moment; in terms of determining the first stability evaluation value of the flash memory according to the working voltage data, the determination unit is specifically configured to: Perform fitting according to the plurality of voltage data and the corresponding sampling moments to obtain a fitting line, and obtain the absolute value of the slope of the fitting line to obtain a first absolute value; Determine the voltage differences corresponding to adjacent two sampling moments according to the plurality of voltage data to obtain a plurality of voltage differences; Perform standard - deviation operation according to the plurality of voltage differences to obtain a first standard deviation; Determine a first reference stability evaluation value corresponding to the first absolute value; Determine a second reference stability evaluation value corresponding to the first standard deviation; Obtain a target weight pair; Performing a weighted operation on the first reference stability evaluation value, the second reference stability evaluation value, and the target weight pair to obtain the first stability evaluation value.
9. An electronic device, characterized in that, It includes a processor, a memory, a communication interface, and one or more programs. The one or more programs are stored in the memory and are configured to be executed by the processor. The programs include instructions for performing the steps in the method according to any one of claims 1-5.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 5.